/** * Gets the end point of this arrow. * * @return Point2D */ public Point2D getEnd() { return getPoints().get(1); }
public static BoundingBox getBoundingBoxOfArcTo(final Point2D p0, final Point2D p1, final Point2D p2, final double r) { final Point2DArray arcPoints = getCanvasArcToPoints(p0, p1, p2, r); final BoundingBox box = getBoundingBoxOfArc(arcPoints.get(0), arcPoints.get(1), arcPoints.get(2), r); if (!arcPoints.get(0).equals(p0)) { box.add(p0);//p0 is always the start point of the path, but not necessary of the arc - depending on the radius } return box; }
/** * Gets the start point of this arrow. * * @return Point2D */ public Point2D getStart() { return getPoints().get(0); }
/** * Gets the end point of this arrow. * * @return Point2D */ public Point2D getEnd() { return getPoints().get(1); }
public final Collection<Point2D> getPoints() { final int size = size(); final ArrayList<Point2D> list = new ArrayList<>(size); for (int i = 0; i < size; i++) { list.add(get(i)); } return Collections.unmodifiableCollection(list); }
public static BoundingBox getBoundingBoxForQuadraticCurve(final Point2DArray points) { final NFastDoubleArray cubicPoints = quadraticToCubic(points.get(0).getX(), points.get(0).getY(), points.get(1).getX(), points.get(1).getY(), points.get(2).getX(), points.get(2).getY()); final double[] xval = new double[4]; final double[] yval = new double[4]; for (int i = 0; i < cubicPoints.size(); i = i + 2) { xval[i] = cubicPoints.get(i); yval[i] = cubicPoints.get(i + 1); } return getBoundingBoxOfCubicCurve(xval, yval); }
@Override public Point2D getTailOffsetPoint() { final Point2DArray list = getPoints(); if ((null != list) && (list.size() == 2)) { return list.get(0); } return null; }
public final BoundingPoints transform(Transform transform) { int leng = m_array.size(); for (int i = 0; i < leng; i++) { Point2D p = m_array.get(i); transform.transform(p, p); } return this; }
@Override public Point2D getHeadOffsetPoint() { final Point2DArray list = getPoints(); if ((null != list) && (list.size() == 2)) { return list.get(1); } return null; }
public WiresConnection(final WiresConnector connector, final MultiPath endPath, final ArrowEnd end) { m_connector = connector; m_line = connector.getLine(); m_endPath = endPath; m_end = end; m_point = (end == ArrowEnd.HEAD) ? m_line.getPoint2DArray().get(0) : m_line.getPoint2DArray().get(m_line.getPoint2DArray().size() - 1); m_end = end; }
@Override public boolean contains(final double cx, final double cy) { final double _x = cx - getX(); final double _y = cy - getY(); return Math.sqrt(GeometryUtil.ptSegDistSq(arrow.getPoints().get(0).getX(), arrow.getPoints().get(0).getY(), arrow.getPoints().get(1).getX(), arrow.getPoints().get(1).getY(), _x, _y)) < BOUNDARY_SIZE; }
@Override public boolean contains(final double cx, final double cy) { final double _x = cx - getX(); final double _y = cy - getY(); return Math.sqrt(GeometryUtil.ptSegDistSq(line.getPoints().get(0).getX(), line.getPoints().get(0).getY(), line.getPoints().get(1).getX(), line.getPoints().get(1).getY(), _x, _y)) < BOUNDARY_SIZE; }
@Override public void onMove(final double x, final double y) { curve.getControlPoints().get(0).setX(x - getX()); curve.getControlPoints().get(0).setY(y - getY()); bounding.getControlPoints().get(0).setX(x - getX()); bounding.getControlPoints().get(0).setY(y - getY()); controlLine1.getPoints().get(0).setX(x - getX()); controlLine1.getPoints().get(0).setY(y - getY()); } }
@Override public void onMove(final double x, final double y) { curve.getControlPoints().get(2).setX(x - getX()); curve.getControlPoints().get(2).setY(y - getY()); bounding.getControlPoints().get(2).setX(x - getX()); bounding.getControlPoints().get(2).setY(y - getY()); controlLine2.getPoints().get(0).setX(x - getX()); controlLine2.getPoints().get(0).setY(y - getY()); } }
public static final Point2DArray getCardinalIntersects(final AbstractMultiPathPartShape<?> shape, final Direction[] requestedCardinals) { final Point2DArray cardinals = getCardinals(shape.getBoundingBox(), requestedCardinals); final Set<Point2D>[] intersections = getCardinalIntersects(shape, cardinals); final Point2DArray points = removeInnerPoints(cardinals.get(0), intersections); return points; }
public void draw(final Point2DArray points) { final Point2D p1 = points.get(1); final double px = p1.getX(); final double py = p1.getY(); final double w2 = getWidth() / 2; final double dt = Geometry.getClockwiseAngleBetweenThreePoints(new Point2D(px, py + getHeight()), p1, points.get(0)); m_path.setX(px - w2).setY(py).setOffset(w2, 0).setRotation(dt); }
public static Point2DArray getCardinalIntersects(final PathPartList path, final Direction[] requestedCardinals) { final Point2DArray cardinals = getCardinals(path.getBoundingBox(), requestedCardinals); @SuppressWarnings("unchecked") final Set<Point2D>[] intersections = new Set[cardinals.size()];// c is removed, so -1 getCardinalIntersects(path, cardinals, intersections, true); return removeInnerPoints(cardinals.get(0), intersections); }
@Override public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) { for (WiresTreeNodeConnector connector : connectors) { connector.getPoints().get(0).set(getLocation()); } getLayer().batch(); } });
@Override public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) { for (WiresTreeNodeConnector connector : connectors) { connector.getPoints().get(0).set(getLocation()); } getLayer().batch(); } });