当前位置: 首页>>代码示例>>Java>>正文


Java Anchor.DIRECTION_ANY属性代码示例

本文整理汇总了Java中org.netbeans.api.visual.anchor.Anchor.DIRECTION_ANY属性的典型用法代码示例。如果您正苦于以下问题:Java Anchor.DIRECTION_ANY属性的具体用法?Java Anchor.DIRECTION_ANY怎么用?Java Anchor.DIRECTION_ANY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.netbeans.api.visual.anchor.Anchor的用法示例。


在下文中一共展示了Anchor.DIRECTION_ANY属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compute

public Result compute(Entry entry) {
    Point relatedLocation = getRelatedSceneLocation();
    Point oppositeLocation = null;

    if (oppositeLocation == null) {
        oppositeLocation = getOppositeSceneLocation(entry);
    }
    
    Result boundaryIntersection =
            computeBoundaryIntersectionPoint(relatedLocation, oppositeLocation);

    if (boundaryIntersection == null) {
        return new Anchor.Result(relatedLocation, Anchor.DIRECTION_ANY);
    }
    
    return boundaryIntersection ;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:RectangularAnchor.java

示例2: compute

public Result compute (Entry entry) {
    Point relatedLocation = getRelatedSceneLocation ();
    Point oppositeLocation = getOppositeSceneLocation (entry);

    double angle = Math.atan2 (oppositeLocation.y - relatedLocation.y, oppositeLocation.x - relatedLocation.x);

    Point location = new Point (relatedLocation.x + (int) (radius * Math.cos (angle)), relatedLocation.y + (int) (radius * Math.sin (angle)));
    return new Anchor.Result (location, Anchor.DIRECTION_ANY); // TODO - resolve direction
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CircularAnchor.java

示例3: compute

@Override
    public Result compute(Entry entry) {
//          NodeWidget nodeWidget = (NodeWidget)getRelatedWidget().getParentWidget();
        Point relatedLocation = getRelatedSceneLocation();
        Point oppositeLocation = null;

        java.util.List<Point> points = entry.getAttachedConnectionWidget().getControlPoints();

        if (entry.getAttachedConnectionWidget() instanceof IFlowEdgeWidget) {
            IFlowEdgeWidget flowEdgeWidget = (IFlowEdgeWidget) entry.getAttachedConnectionWidget();
            INodeWidget sourceNodeWidget = (INodeWidget) flowEdgeWidget.getSourceWidget();
            INodeWidget targetNodeWidget = (INodeWidget) flowEdgeWidget.getTargetWidget();
            if (!sourceNodeWidget.isAnchorEnable() && !targetNodeWidget.isAnchorEnable() && !points.isEmpty()) {        //if edge both nodes anchor not enabled (if any one is allowed then calculated[means this if condition failed])
                if (entry.isAttachedToConnectionSource()) {
                    return new Anchor.Result(points.get(0), Anchor.DIRECTION_ANY); //return current
                } else {
                    return new Anchor.Result(points.get(points.size() - 1), Anchor.DIRECTION_ANY); //return current
                }
            }
        }

        if (points.size() > 2) {
            if (entry.isAttachedToConnectionSource()) {
                oppositeLocation = points.get(1);
                type = "SOURCE";
            } else {
                oppositeLocation = points.get(points.size() - 2);
                type = "TARGET";
            }
        } else {
            oppositeLocation = getOppositeSceneLocation(entry);
            type = "NONE";
        }

        return computeBoundaryIntersectionPoint((int) nodeWidget.getBounds().getWidth() / 2, relatedLocation, oppositeLocation);
    }
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:36,代码来源:CustomCircularAnchor.java

示例4: compute

public Result compute (Entry entry) {
    return new Result (location, Anchor.DIRECTION_ANY);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:FixedAnchor.java

示例5: compute

public Result compute (Entry entry) {
    return new Result (getRelatedSceneLocation (), Anchor.DIRECTION_ANY);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:CenterAnchor.java

示例6: compute

public Result compute(Entry entry) {
    return new Result(getRelatedSceneLocation(), Anchor.DIRECTION_ANY);
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:3,代码来源:ConnectionAnchor.java

示例7: computeBoundaryIntersectionPoint

private Result computeBoundaryIntersectionPoint(int radius, Point relatedLocation, Point oppositeLocation) { //Source Center , Target Center
    double angle = Math.atan2(oppositeLocation.y - relatedLocation.y, oppositeLocation.x - relatedLocation.x);
    Point location = new Point(relatedLocation.x + (int) (radius * Math.cos(angle)), relatedLocation.y + (int) (radius * Math.sin(angle)));
    type = "NONE";
    return new Anchor.Result(location, Anchor.DIRECTION_ANY); // TODO - resolve direction
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:6,代码来源:CustomCircularAnchor.java

示例8: compute

@Override
    public Anchor.Result compute(Anchor.Entry entry) {
//        NodeWidget nodeWidget = (NodeWidget) getRelatedWidget().getParentWidget();
        Point relatedLocation = getRelatedSceneLocation();
        Point oppositeLocation = null;

        List<Point> points = entry.getAttachedConnectionWidget().getControlPoints();
        if (entry.getAttachedConnectionWidget() instanceof IFlowEdgeWidget) {
            IFlowEdgeWidget flowEdgeWidget = (IFlowEdgeWidget) entry.getAttachedConnectionWidget();
            INodeWidget sourceNodeWidget = (INodeWidget) flowEdgeWidget.getSourceWidget();
            INodeWidget targetNodeWidget = (INodeWidget) flowEdgeWidget.getTargetWidget();
            if (!sourceNodeWidget.isAnchorEnable() && !targetNodeWidget.isAnchorEnable() && !points.isEmpty()) {        //if edge both nodes anchor not enabled (if any one is allowed then calculated[means this if condition failed])
                if (entry.isAttachedToConnectionSource()) {
                    return new Anchor.Result(points.get(0), Anchor.DIRECTION_ANY); //return current
                } else {
                    return new Anchor.Result(points.get(points.size() - 1), Anchor.DIRECTION_ANY); //return current
                }
            }
        }
        if (points.size() > 2) {
            if (entry.isAttachedToConnectionSource()) {
                oppositeLocation = points.get(1);
                type = "SOURCE";
            } else {
                oppositeLocation = points.get(points.size() - 2);
                type = "TARGET";
            }
        } else {
            oppositeLocation = getOppositeSceneLocation(entry);
            type = "NONE";
        }

        Anchor.Result boundaryIntersection
                = computeBoundaryIntersectionPoint(relatedLocation, oppositeLocation);

        if (boundaryIntersection == null) {
            return new Anchor.Result(relatedLocation, Anchor.DIRECTION_ANY);
        }

        return boundaryIntersection;
    }
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:41,代码来源:CustomPathAnchor.java

示例9: compute

@Override
    public Result compute(Entry entry) {
//           NodeWidget nodeWidget = (NodeWidget)getRelatedWidget().getParentWidget();
        Point relatedLocation = getRelatedSceneLocation();
        Point oppositeLocation = null;
        List<Point> points = entry.getAttachedConnectionWidget().getControlPoints();

        if (entry.getAttachedConnectionWidget() instanceof IFlowEdgeWidget) {
            IFlowEdgeWidget flowEdgeWidget = (IFlowEdgeWidget) entry.getAttachedConnectionWidget();
            INodeWidget sourceNodeWidget = (INodeWidget) flowEdgeWidget.getSourceWidget();
            INodeWidget targetNodeWidget = (INodeWidget) flowEdgeWidget.getTargetWidget();
            if (sourceNodeWidget != null && targetNodeWidget != null && !sourceNodeWidget.isAnchorEnable() && !targetNodeWidget.isAnchorEnable() && !points.isEmpty()) {        //if edge both nodes anchor not enabled (if any one is allowed then calculated[means this if condition failed])
                if (entry.isAttachedToConnectionSource()) {
                    return new Anchor.Result(points.get(0), Anchor.DIRECTION_ANY); //return current
                } else {
                    return new Anchor.Result(points.get(points.size() - 1), Anchor.DIRECTION_ANY); //return current
                }
            }
        }
        if (points.size() > 2) {
            if (entry.isAttachedToConnectionSource()) {
                oppositeLocation = points.get(1);
                type = "SOURCE";
            } else {
                oppositeLocation = points.get(points.size() - 2);
                type = "TARGET";
            }
        } else {
            oppositeLocation = getOppositeSceneLocation(entry);
            type = "NONE";
        }

        Result boundaryIntersection
                = computeBoundaryIntersectionPoint(relatedLocation, oppositeLocation);

        if (boundaryIntersection == null) {
            return new Anchor.Result(relatedLocation, Anchor.DIRECTION_ANY);
        }

        return boundaryIntersection;
    }
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:41,代码来源:CustomRectangularAnchor.java

示例10: compute

@Override
public Anchor.Result compute(Entry entry) {

    Point center = getLocationPoint(locationRatio);
    return new Anchor.Result(center, Anchor.DIRECTION_ANY);
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:6,代码来源:ConnectionAnchor.java


注:本文中的org.netbeans.api.visual.anchor.Anchor.DIRECTION_ANY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。