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


Java Anchor.Direction方法代码示例

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


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

示例1: OrthogonalSearchRouterRegion

import org.netbeans.api.visual.anchor.Anchor; //导入方法依赖的package包/类
public OrthogonalSearchRouterRegion (/*OrthogonalLinkRouterRegion parentRegion, */int x, int y, int width, int height, Anchor.Direction direction, int depth) {
        super (x, y, width, height);
//        this.parent = parentRegion;
        this.direction = direction;
        switch (direction) {
            case LEFT:
            case RIGHT:
                horizontal = true;
                break;
            case TOP:
            case BOTTOM:
                horizontal = false;
                break;
            default:
                throw new IllegalArgumentException ();
        }
        this.depth = depth;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:OrthogonalSearchRouterRegion.java

示例2: cloneWithEdge

import org.netbeans.api.visual.anchor.Anchor; //导入方法依赖的package包/类
private OrthogonalSearchRouterRegion cloneWithEdge (/*OrthogonalLinkRouterRegion parent, */Anchor.Direction dir, int depth) {
    switch (dir) {
        case LEFT:
            return new OrthogonalSearchRouterRegion (/*parent, */x, y, 0, height, dir, depth);
        case RIGHT:
            return new OrthogonalSearchRouterRegion (/*parent, */x + width, y, 0, height, dir, depth);
        case TOP:
            return new OrthogonalSearchRouterRegion (/*parent, */x, y, width, 0, dir, depth);
        case BOTTOM:
            return new OrthogonalSearchRouterRegion (/*parent, */x, y + height, width, 0, dir, depth);
        default:
            throw new IllegalArgumentException ();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:OrthogonalSearchRouterRegion.java

示例3: getCounterClockWiseDirection

import org.netbeans.api.visual.anchor.Anchor; //导入方法依赖的package包/类
public static Anchor.Direction getCounterClockWiseDirection (Anchor.Direction direction) {
    switch (direction) {
        case LEFT:
            return Anchor.Direction.BOTTOM;
        case RIGHT:
            return Anchor.Direction.TOP;
        case TOP:
            return Anchor.Direction.LEFT;
        case BOTTOM:
            return Anchor.Direction.RIGHT;
        default:
            throw new IllegalArgumentException ();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:OrthogonalSearchRouterRegion.java

示例4: getClockWiseDirection

import org.netbeans.api.visual.anchor.Anchor; //导入方法依赖的package包/类
public static Anchor.Direction getClockWiseDirection (Anchor.Direction direction) {
    switch (direction) {
        case LEFT:
            return Anchor.Direction.TOP;
        case RIGHT:
            return Anchor.Direction.BOTTOM;
        case TOP:
            return Anchor.Direction.RIGHT;
        case BOTTOM:
            return Anchor.Direction.LEFT;
        default:
            throw new IllegalArgumentException ();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:OrthogonalSearchRouterRegion.java

示例5: OrthogonalSearchRouterCore

import org.netbeans.api.visual.anchor.Anchor; //导入方法依赖的package包/类
public OrthogonalSearchRouterCore (Scene scene, ArrayList<Rectangle> verticalCollisions, ArrayList<Rectangle> horizontalCollisions, Point sourcePoint, Anchor.Direction sourceDirection, Point targetPoint, Anchor.Direction targetDirection) {
    this.scene = scene;
    this.verticalCollisions = verticalCollisions;
    this.horizontalCollisions = horizontalCollisions;
    this.sourcePoint = sourcePoint;
    this.sourceDirection = sourceDirection;
    this.targetPoint = targetPoint;
    this.targetDirection = targetDirection;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:OrthogonalSearchRouterCore.java

示例6: computeBoundaryIntersectionPoint

import org.netbeans.api.visual.anchor.Anchor; //导入方法依赖的package包/类
private Result computeBoundaryIntersectionPoint(Point relatedLocation, Point oppositeLocation) {
    
    Widget widget = getRelatedWidget();
    Rectangle bounds = widget.getBounds();
    if (!includeBorders) {
        Insets insets = widget.getBorder().getInsets();
        bounds.x += insets.left;
        bounds.y += insets.top;
        bounds.width -= insets.left + insets.right;
        bounds.height -= insets.top + insets.bottom;
    }
    bounds = widget.convertLocalToScene(bounds);

    if (bounds.isEmpty() || relatedLocation.equals(oppositeLocation)) {
        return null;
    }
    float dx = oppositeLocation.x - relatedLocation.x;
    float dy = oppositeLocation.y - relatedLocation.y;

    float ddx = Math.abs(dx) / (float) bounds.width;
    float ddy = Math.abs(dy) / (float) bounds.height;

    Anchor.Direction direction;

    if (ddx >= ddy) {
        direction = dx >= 0.0f ? Direction.RIGHT : Direction.LEFT;
    } else {
        direction = dy >= 0.0f ? Direction.BOTTOM : Direction.TOP;
    }

    float scale = 0.5f / Math.max(ddx, ddy);

    Point point = new Point(Math.round(relatedLocation.x + scale * dx), 
            Math.round(relatedLocation.y + scale * dy));
    
    return new Anchor.Result(point, direction);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:RectangularAnchor.java

示例7: OrthogonalSearchRouterCore

import org.netbeans.api.visual.anchor.Anchor; //导入方法依赖的package包/类
public OrthogonalSearchRouterCore(Scene scene, ArrayList<Rectangle> verticalCollisions,
        ArrayList<Rectangle> horizontalCollisions, Point sourcePoint, Anchor.Direction sourceDirection,
        Point targetPoint, Anchor.Direction targetDirection,
        int maxDepth) {
    this.scene = scene;
    this.verticalCollisions = verticalCollisions;
    this.horizontalCollisions = horizontalCollisions;
    this.sourcePoint = sourcePoint;
    this.sourceDirection = sourceDirection;
    this.targetPoint = targetPoint;
    this.targetDirection = targetDirection;
    this.maxDepth = maxDepth;
    regions = new OrthogonalSearchRouterRegion[maxDepth  + 1];
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:15,代码来源:OrthogonalSearchRouterCore.java

示例8: getDirection

import org.netbeans.api.visual.anchor.Anchor; //导入方法依赖的package包/类
public Anchor.Direction getDirection () {
    return direction;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:OrthogonalSearchRouterRegion.java

示例9: computeBoundaryIntersectionPoint

import org.netbeans.api.visual.anchor.Anchor; //导入方法依赖的package包/类
private Result computeBoundaryIntersectionPoint(Point relatedLocation, Point oppositeLocation) { //Source Center , Target Center

        Widget widget = getRelatedWidget();

        Rectangle bounds = widget.getBounds();
        if (!includeBorders) {
            Insets insets = widget.getBorder().getInsets();
            bounds.x += insets.left;
            bounds.y += insets.top;
            bounds.width -= insets.left + insets.right;
            bounds.height -= insets.top + insets.bottom;
        }
        bounds = widget.convertLocalToScene(bounds);

        if (bounds.isEmpty() || relatedLocation.equals(oppositeLocation)) {
            return null;
        }
        float dx = oppositeLocation.x - relatedLocation.x;
        float dy = oppositeLocation.y - relatedLocation.y;

        float ddx = Math.abs(dx) / (float) bounds.width;
        float ddy = Math.abs(dy) / (float) bounds.height;

        Anchor.Direction direction;

        if (ddx >= ddy) {
            direction = dx >= 0.0f ? Direction.RIGHT : Direction.LEFT;
        } else {
            direction = dy >= 0.0f ? Direction.BOTTOM : Direction.TOP;
        }

        float scale = 0.5f / Math.max(ddx, ddy);

        Point point = new Point(Math.round(relatedLocation.x + scale * dx), Math.round(relatedLocation.y + scale * dy));

//        if(direction== Direction.BOTTOM){
//            point.y = point.y - margin;
//        } else if(direction== Direction.TOP){
//            point.y = point.y + margin;
//        } else if(direction== Direction.LEFT){
//            point.x = point.x + margin;
//        } else if(direction== Direction.RIGHT){
//            point.x = point.x - margin;
//        }
        SvgNodeWidget imageWidget = (SvgNodeWidget) widget;
        Point movePo = null;
        if (imageWidget.getTransform() != null) {

            Shape shape = imageWidget.getTransform().createTransformedShape(imageWidget.getOutlineShape());
            Point widgetLoc = widget.convertLocalToScene(widget.getLocation());
            ClosestSegment cs = GeometryClosestPointManager.getClosetsPoint(shape, new Point2D.Double(point.x - widgetLoc.x, point.y - widgetLoc.y));
            int padX = 0;//padding
            int padY = 0;
            if (direction == Direction.TOP) {
                padY = - 2;
            } else if (direction == Direction.RIGHT) {
                padX = +2;
            } else if (direction == Direction.BOTTOM) {
                padY = +2;
            } else if (direction == Direction.LEFT) {
                padX = - 2;
            }

            movePo = new Point(widgetLoc.x + (int) cs.getBestPoint().getX() + padX, widgetLoc.y + (int) cs.getBestPoint().getY() + padY);

//            movePo = Util.getComputedPoint(oppositeLocation, movePo, 10);
        } else {
            movePo = point;
        }
        type = "NONE";
        return new Anchor.Result(movePo, direction);
    }
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:73,代码来源:CustomPathAnchor.java


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