Package org.antlr.xjlib.appkit.gview.base

Examples of org.antlr.xjlib.appkit.gview.base.Vector2D


        this.end = end.copy();
        computeOffsets();
    }

    public void setEnd(double x, double y) {
        setEnd(new Vector2D(x, y));
    }
View Full Code Here


                buildHorizontalRightBelowPath();
        }
    }

    public void buildHorizontalPath(int direction) {
        Vector2D start_ = link.getStartWithOffset();
        Vector2D end_ = link.getEndWithOffset();

        if(link.offsetToMouse != null) {
            double y = link.offsetToMouse.y+link.start.y;
            start_.y = end_.y = y;
        }

        double farest_y = 0;
        if(direction == BOTTOM_BOTTOM)
            farest_y = Math.max(start_.y,  end_.y);
        else
            farest_y = Math.min(start_.y, end_.y);

        Vector2D p1 = start_.add(new Vector2D(0, farest_y-start_.y));
        Vector2D p2 = end_.add(new Vector2D(0, farest_y-end_.y));

        path.add(link.start);
        path.add(start_);
        path.add(p1);
        path.add(p2);
        path.add(end_);
        path.add(link.end);

        if(direction == BOTTOM_BOTTOM)
            link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(0, LABEL_OFFSET));
        else
            link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(0, -LABEL_OFFSET));
    }
View Full Code Here

        else
            link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(0, -LABEL_OFFSET));
    }

    public void buildHorizontalRightBelowPath() {
        Vector2D start_ = link.getStartWithOffset();
        Vector2D end_ = link.getEndWithOffset();

        Vector2D start = link.start;
        Vector2D end = link.end;

        double farest_x = start_.x+GElementRect.DEFAULT_WIDTH*0.5+10;

        // Extend the link to the RIGHT

        Vector2D p1 = start_.add(new Vector2D(farest_x-start_.x, 0));
        Vector2D p2 = end_.add(new Vector2D(farest_x-end_.x, 0));

        path.add(start);
        path.add(start_);
        path.add(p1);
        path.add(p2);
        path.add(end_);
        path.add(end);

        link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(LABEL_OFFSET, 0));
    }
View Full Code Here

        link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(LABEL_OFFSET, 0));
    }

    public void buildHorizontalRightAbovePath() {
        Vector2D start_ = link.getStartWithOffset();
        Vector2D end_ = link.getEndWithOffset();

        Vector2D start = link.start;
        Vector2D end = link.end;

        double farest_x = end_.x+GElementRect.DEFAULT_WIDTH*0.5+10;

        // Extend the link to the RIGHT

        Vector2D p1 = start_.add(new Vector2D(farest_x-start_.x, 0));
        Vector2D p2 = end_.add(new Vector2D(farest_x-end_.x, 0));

        path.add(start);
        path.add(start_);
        path.add(p1);
        path.add(p2);
        path.add(end_);
        path.add(end);

        link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(LABEL_OFFSET, 0));
    }
View Full Code Here

                buildHorizontalRightBelowPath();
        }
    }

    public void buildVerticalPath(int direction) {
        Vector2D start_ = link.getStartWithOffset();
        Vector2D end_ = link.getEndWithOffset();

        double farest_x = 0;
        if(direction == LEFT_LEFT)
            farest_x = Math.min(start_.x,  end_.x);
        else
            farest_x = Math.max(start_.x, end_.x);

        Vector2D p1 = start_.add(new Vector2D(farest_x-start_.x, 0));
        Vector2D p2 = end_.add(new Vector2D(farest_x-end_.x, 0));

        path.add(link.start);
        path.add(start_);
        path.add(p1);
        path.add(p2);
        path.add(end_);
        path.add(link.end);

        link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(-LABEL_OFFSET, 0));
    }
View Full Code Here

        link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(-LABEL_OFFSET, 0));
    }

    public void buildHorizontalRightBelowPath() {
        Vector2D start_ = link.getStartWithOffset();
        Vector2D end_ = link.getEndWithOffset();

        Vector2D start = link.start;
        Vector2D end = link.end;

        double farest_y = start_.y+GElementRect.DEFAULT_WIDTH*0.5+10;

        // Extend the link to the RIGHT

        Vector2D p1 = start_.add(new Vector2D(0, farest_y-start_.y));
        Vector2D p2 = end_.add(new Vector2D(0, farest_y-end_.y));

        path.add(start);
        path.add(start_);
        path.add(p1);
        path.add(p2);
        path.add(end_);
        path.add(end);

        link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(-LABEL_OFFSET, 0));
    }
View Full Code Here

        link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(-LABEL_OFFSET, 0));
    }

    public void buildHorizontalRightAbovePath() {
        Vector2D start_ = link.getStartWithOffset();
        Vector2D end_ = link.getEndWithOffset();

        Vector2D start = link.start;
        Vector2D end = link.end;

        double farest_y = end_.y+GElementRect.DEFAULT_WIDTH*0.5+10;

        // Extend the link to the RIGHT

        Vector2D p1 = start_.add(new Vector2D(0, farest_y-start_.y));
        Vector2D p2 = end_.add(new Vector2D(0, farest_y-end_.y));

        path.add(start);
        path.add(start_);
        path.add(p1);
        path.add(p2);
        path.add(end_);
        path.add(end);

        link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(-LABEL_OFFSET, 0));
    }
View Full Code Here

        else
            buildHorizontalLeftPath(true);
    }

    public void buildVerticalPath() {
        Vector2D start_ = link.getStartWithOffset();
        Vector2D end_ = link.getEndWithOffset();

        if(link.end.x > link.start.x+link.outOffsetLength && link.endDirection == Anchor2D.DIRECTION_LEFT) {
            path.add(link.start);
            path.add(link.start.x, link.end.y);
            path.add(link.end);

            link.label.setPosition(link.start.x+(link.end.x-link.start.x)*0.5, link.end.y-LABEL_OFFSET);
        } else if(link.end.x < link.start.x-link.outOffsetLength && link.endDirection == Anchor2D.DIRECTION_RIGHT) {
            path.add(link.start);
            path.add(link.start.x, link.end.y);
            path.add(link.end);

            link.label.setPosition(link.start.x+(link.end.x-link.start.x)*0.5, link.end.y-LABEL_OFFSET);
        } else if(link.end.y+GElementRect.DEFAULT_HEIGHT*0.5>start_.y-10) {
            Vector2D p1 = new Vector2D(link.start.x, link.end.y-GElementRect.DEFAULT_HEIGHT*0.5-10);
            Vector2D p2 = new Vector2D(end_.x, p1.y);

            path.add(link.start);
            path.add(p1);
            path.add(p2);
            path.add(end_);
            path.add(link.end);

            link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(0, -LABEL_OFFSET));
        } else {
            Vector2D ab = end_.sub(link.start);
            Vector2D p1 = new Vector2D(link.start.x, link.start.y+ab.y*0.5);
            Vector2D p2 = new Vector2D(p1.x+ab.x, p1.y);
            Vector2D p3 = new Vector2D(p2.x, end_.y);

            path.add(link.start);
            path.add(p1);
            path.add(p2);
            path.add(p3);
View Full Code Here

            link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(0, LABEL_OFFSET));
        }
    }

    public void buildHorizontalPath() {
        Vector2D start_ = link.getStartWithOffset();
        Vector2D end_ = link.getEndWithOffset();

        Vector2D ab = link.end.sub(start_);
        Vector2D p1 = new Vector2D(start_.x+ab.x*0.5, start_.y);
        Vector2D p2 = new Vector2D(p1.x, end_.y);

        path.add(link.start);
        path.add(start_);
        path.add(p1);
        path.add(p2);
        path.add(end_);
        path.add(link.end);

        link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(LABEL_OFFSET, 0));
    }
View Full Code Here

        link.label.setPosition(p1.add(p2.sub(p1).stretch(0.5)).shift(LABEL_OFFSET, 0));
    }

    public void buildHorizontalLeftPath(boolean left) {
        Vector2D start_ = link.getStartWithOffset();
        Vector2D end_ = link.getEndWithOffset();

        double farest_x;
        double farest_y = Math.min(start_.y, end_.y-GElementRect.DEFAULT_HEIGHT*0.5-10);

        if(left)
            farest_x = Math.min(start_.x-GElementRect.DEFAULT_WIDTH*0.5-10, end_.x);
        else
            farest_x = Math.max(start_.x+GElementRect.DEFAULT_WIDTH*0.5+10, end_.x);

        Vector2D p1 = new Vector2D(start_.x, farest_y);
        Vector2D p2 = new Vector2D(farest_x, p1.y);
        Vector2D p3 = new Vector2D(p2.x, end_.y);

        path.add(link.start);
        path.add(start_);
        path.add(p1);
        path.add(p2);
View Full Code Here

TOP

Related Classes of org.antlr.xjlib.appkit.gview.base.Vector2D

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.