本文整理汇总了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 ;
}
示例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
}
示例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);
}
示例4: compute
public Result compute (Entry entry) {
return new Result (location, Anchor.DIRECTION_ANY);
}
示例5: compute
public Result compute (Entry entry) {
return new Result (getRelatedSceneLocation (), Anchor.DIRECTION_ANY);
}
示例6: compute
public Result compute(Entry entry) {
return new Result(getRelatedSceneLocation(), Anchor.DIRECTION_ANY);
}
示例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
}
示例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;
}
示例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;
}
示例10: compute
@Override
public Anchor.Result compute(Entry entry) {
Point center = getLocationPoint(locationRatio);
return new Anchor.Result(center, Anchor.DIRECTION_ANY);
}