Package research.connection

Examples of research.connection.ElbowConnection


        fLastX = x;
        fLastY = y;
    }

    public void invokeStep(InputEvent inputEvent, int x, int y, int anchorX, int anchorY, DrawingView view) {
        ElbowConnection line = ownerConnection();

        if ((fSegment == 0) || (fSegment == line.pointCount() - 2)){
           return;
        } else {
            Point p1 = line.pointAt(fSegment);
            Point p2 = line.pointAt(fSegment + 1);
            int ddx = x - fLastX;
            int ddy = y - fLastY;

            boolean isStartVertical = true;

            int displayMode = ((Integer) line.getAttribute(ElbowConnection.DISPLAY_MODE)).intValue();

            if (displayMode == ElbowConnection.N_S_MODE) {
                isStartVertical = true;
            } else if (displayMode == ElbowConnection.W_E_MODE) {
                isStartVertical = false;
            } else {
                int direction = line.getStartConnector().getDirection();

                if (direction == Connector.NORTH_DIRECTION || direction == Connector.SOUTH_DIRECTION) {
                    isStartVertical = true;
                } else if (direction == Connector.WEST_DIRECTION || direction == Connector.EAST_DIRECTION) {
                    isStartVertical = false;
                } else if (direction == Connector.NONE_DIRECTION) {
                    isStartVertical = false;
                }
            }

            boolean isCurrentVertical = isStartVertical;

            if (fSegment % 2 == 1)
                isCurrentVertical = !isStartVertical;

            Point np1;
            Point np2;
            //if (isVertical(p1, p2)) {
            if (isCurrentVertical) {
                int cx = constrainX(p1.x + ddx);
                np1 = new Point(cx, p1.y);
                np2 = new Point(cx, p2.y);
            } else {
                int cy = constrainY(p1.y + ddy);
                np1 = new Point(p1.x, cy);
                np2 = new Point(p2.x, cy);
            }
            line.setPointAt(np1, fSegment);
            line.setPointAt(np2, fSegment + 1);
            fLastX = x;
            fLastY = y;
        }
    }
View Full Code Here

TOP

Related Classes of research.connection.ElbowConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.