Examples of Anchor2D


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

    public void updateAnchors() {
    }

    public void setAnchor(String key, Vector2D position, Vector2D direction) {
        Anchor2D anchor = getAnchor(key);
        if(anchor == null) {
            anchor = new Anchor2D();
            anchors.put(key, anchor);
        }
        anchor.setPosition(position);
        anchor.setDirection(direction);
    }
View Full Code Here

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

    public Anchor2D getAnchor(String key) {
        return anchors.get(key);
    }

    public String getAnchorKeyClosestToPoint(Point p) {
        Anchor2D anchor = getAnchorClosestToPoint(p);
        for (String key : anchors.keySet()) {
            if (anchors.get(key) == anchor)
                return key;
        }
        return null;
View Full Code Here

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

        return null;
    }

    public Anchor2D getAnchorClosestToPoint(Point p) {
        double smallest_distance = Integer.MAX_VALUE;
        Anchor2D closest_anchor = null;

        for (Anchor2D anchor : anchors.values()) {
            double dx = anchor.position.getX() - p.x;
            double dy = anchor.position.getY() - p.y;
            double d = Math.sqrt(dx * dx + dy * dy);
 
View Full Code Here

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

        setLinkStartAnchor(startElement.getAnchor(startAnchorKey));

        if(ce == null || ce instanceof GLink) {
            setLinkEnd(Vector2D.vector(mouse), Anchor2D.DIRECTION_BOTTOM);
        } else {
            Anchor2D anchor = ce.getAnchorClosestToPoint(mouse);
            String anchorKey = ce.getAnchorKeyClosestToPoint(mouse);
            setLinkEnd(anchor.position, anchor.direction);

            if(selfLoop) {
                if(anchor.direction == Anchor2D.DIRECTION_FREE)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.