@Override public void onMoveAdjusted(final Point2D dxy) { m_delta = dxy.copy(); }
@Override public void onMoveAdjusted(final Point2D dxy) { m_delta = dxy.copy(); }
@Override public void onMoveAdjusted(final Point2D dxy) { m_delta = dxy.copy(); }
@Override public Point2D getShapeLocation() { return getShapeInitialLocation().copy().offset(getCurrentDelta()); }
@Override public Point2D getShapeLocation() { return getShapeInitialLocation().copy().offset(getCurrentDelta()); }
@Override public Point2D getShapeLocation() { return getShapeInitialLocation().copy().offset(getCurrentDelta()); }
private static Point2D correctP0(final Direction headDirection, final double correction, final OrthogonalPolyLine pline, final boolean write, final NFastDoubleArrayJSO buffer, Point2D p0) { if (!write) { p0 = p0.copy(); } final double headOffset = pline.getHeadOffset(); // correct for headOffset if (headOffset > 0) { correctEndWithOffset(headOffset, headDirection, p0); } // add starting point, that may have head offset addPoint(buffer, p0.getX(), p0.getY(), write); // correct for correction if (correction > 0) { // must do this off a cloned Point2D, as points[0] is used for M operation, during line drawing. if (write) { // if !write, we are already working on a copy p0 = p0.copy(); } correctEndWithOffset(correction, headDirection, p0); // add another point of the correction, to ensure the line is always visible at the tip of the arrow addPoint(buffer, p0.getX(), p0.getY(), write); } return p0; }
private Point2D adjustForPosition(final Point2D dxy) { final Point2D adjustedDXY = dxy.copy(); double x = adjustedDXY.getX(); double y = adjustedDXY.getY(); switch (m_handle.getPosition()) { case 0: //tl x *= -1; y *= -1; break; case 1: //tr y *= -1; break; case 2: //br break; case 3: //bl x *= -1; break; } adjustedDXY.setX(x); adjustedDXY.setY(y); return adjustedDXY; } }
private static Point2D correctP0(final Direction headDirection, final double correction, final OrthogonalPolyLine pline, final boolean write, final NFastDoubleArrayJSO buffer, Point2D p0) { if (!write) { p0 = p0.copy(); } final double headOffset = pline.getHeadOffset(); // correct for headOffset if (headOffset > 0) { correctEndWithOffset(headOffset, headDirection, p0); } // add starting point, that may have head offset addPoint(buffer, p0.getX(), p0.getY(), write); // correct for correction if (correction > 0) { // must do this off a cloned Point2D, as points[0] is used for M operation, during line drawing. if (write) { // if !write, we are already working on a copy p0 = p0.copy(); } correctEndWithOffset(correction, headDirection, p0); // add another point of the correction, to ensure the line is always visible at the tip of the arrow addPoint(buffer, p0.getX(), p0.getY(), write); } return p0; }
private static Point2D correctP0(final Direction headDirection, final double correction, final OrthogonalPolyLine pline, final boolean write, final NFastDoubleArrayJSO buffer, Point2D p0) { if (!write) { p0 = p0.copy(); } final double headOffset = pline.getHeadOffset(); // correct for headOffset if (headOffset > 0) { correctEndWithOffset(headOffset, headDirection, p0); } // add starting point, that may have head offset addPoint(buffer, p0.getX(), p0.getY(), write); // correct for correction if (correction > 0) { // must do this off a cloned Point2D, as points[0] is used for M operation, during line drawing. if (write) { // if !write, we are already working on a copy p0 = p0.copy(); } correctEndWithOffset(correction, headDirection, p0); // add another point of the correction, to ensure the line is always visible at the tip of the arrow addPoint(buffer, p0.getX(), p0.getY(), write); } return p0; }
private Point2D adjustForPosition(final Point2D dxy) { final Point2D adjustedDXY = dxy.copy(); double x = adjustedDXY.getX(); double y = adjustedDXY.getY(); switch (m_handle.getPosition()) { case 0: //tl x *= -1; y *= -1; break; case 1: //tr y *= -1; break; case 2: //br break; case 3: //bl x *= -1; break; } adjustedDXY.setX(x); adjustedDXY.setY(y); return adjustedDXY; } }
private Point2D adjustForPosition(final Point2D dxy) { final Point2D adjustedDXY = dxy.copy(); double x = adjustedDXY.getX(); double y = adjustedDXY.getY(); switch (m_handle.getPosition()) { case 0: //tl x *= -1; y *= -1; break; case 1: //tr y *= -1; break; case 2: //br break; case 3: //bl x *= -1; break; } adjustedDXY.setX(x); adjustedDXY.setY(y); return adjustedDXY; } }
private static Point2DArray getPoint2Ds(final Point2DArray linePoints, Point2DArray intersectPoints, final Point2D absLoc, final PathPartList pathPartList) { final Point2DArray offsetLinePoints = new Point2DArray(); for (final Point2D p : linePoints) { offsetLinePoints.push(p.copy().offset(-absLoc.getX(), -absLoc.getY())); } final Point2DArray pathPartIntersectPoints = Geometry.getIntersectPolyLinePath(offsetLinePoints, pathPartList, false); if (pathPartIntersectPoints != null) { if (intersectPoints == null) { intersectPoints = new Point2DArray(); } for (final Point2D p : pathPartIntersectPoints) { intersectPoints.push(p); } } return intersectPoints; } }
private static Point2DArray getPoint2Ds(final Point2DArray linePoints, Point2DArray intersectPoints, final Point2D absLoc, final PathPartList pathPartList) { final Point2DArray offsetLinePoints = new Point2DArray(); for (final Point2D p : linePoints) { offsetLinePoints.push(p.copy().offset(-absLoc.getX(), -absLoc.getY())); } final Point2DArray pathPartIntersectPoints = Geometry.getIntersectPolyLinePath(offsetLinePoints, pathPartList, false); if (pathPartIntersectPoints != null) { if (intersectPoints == null) { intersectPoints = new Point2DArray(); } for (final Point2D p : pathPartIntersectPoints) { intersectPoints.push(p); } } return intersectPoints; } }
private static Point2DArray getPoint2Ds(final Point2DArray linePoints, Point2DArray intersectPoints, final Point2D absLoc, final PathPartList pathPartList) { final Point2DArray offsetLinePoints = new Point2DArray(); for (final Point2D p : linePoints) { offsetLinePoints.push(p.copy().offset(-absLoc.getX(), -absLoc.getY())); } final Point2DArray pathPartIntersectPoints = Geometry.getIntersectPolyLinePath(offsetLinePoints, pathPartList, false); if (pathPartIntersectPoints != null) { if (intersectPoints == null) { intersectPoints = new Point2DArray(); } for (final Point2D p : pathPartIntersectPoints) { intersectPoints.push(p); } } return intersectPoints; } }
Point2D p = plist.get(pointIndex).copy();
Point2D p = plist.get(pointIndex).copy();
public static void updateForCenterConnection(final WiresConnector connector, final WiresConnection connection, final int pointIndex) { if ((connection.getMagnet() != null) && (connection.getMagnet().getIndex() == 0)) { final MultiPath path = connection.getMagnet().getMagnets().getWiresShape().getPath(); final BoundingBox box = path.getBoundingBox(); final Point2D c = Geometry.findCenter(box); Point2D intersectPoint = Geometry.getPathIntersect(connection, path, c, pointIndex); if (null == intersectPoint) { intersectPoint = new Point2D(); } final Direction d = MagnetManager.getDirection(intersectPoint, box); final Point2D loc = path.getComputedLocation().copy(); connection.setXOffset(intersectPoint.getX() - c.getX()); connection.setYOffset(intersectPoint.getY() - c.getY()); if (connector.getHeadConnection() == connection) { connector.getLine().setHeadDirection(d); } else { connector.getLine().setTailDirection(d); } connection.move(loc.getX() + c.getX(), loc.getY() + c.getY()); } }
public static void updateForCenterConnection(final WiresConnector connector, final WiresConnection connection, final int pointIndex) { if ((connection.getMagnet() != null) && (connection.getMagnet().getIndex() == 0)) { final MultiPath path = connection.getMagnet().getMagnets().getWiresShape().getPath(); final BoundingBox box = path.getBoundingBox(); final Point2D c = Geometry.findCenter(box); Point2D intersectPoint = Geometry.getPathIntersect(connection, path, c, pointIndex); if (null == intersectPoint) { intersectPoint = new Point2D(); } final Direction d = MagnetManager.getDirection(intersectPoint, box); final Point2D loc = path.getComputedLocation().copy(); connection.setXOffset(intersectPoint.getX() - c.getX()); connection.setYOffset(intersectPoint.getY() - c.getY()); if (connector.getHeadConnection() == connection) { connector.getLine().setHeadDirection(d); } else { connector.getLine().setTailDirection(d); } connection.move(loc.getX() + c.getX(), loc.getY() + c.getY()); } }
public static void updateForCenterConnection(final WiresConnector connector, final WiresConnection connection, final int pointIndex) { if ((connection.getMagnet() != null) && (connection.getMagnet().getIndex() == 0)) { final MultiPath path = connection.getMagnet().getMagnets().getWiresShape().getPath(); final BoundingBox box = path.getBoundingBox(); final Point2D c = Geometry.findCenter(box); Point2D intersectPoint = Geometry.getPathIntersect(connection, path, c, pointIndex); if (null == intersectPoint) { intersectPoint = new Point2D(); } final Direction d = MagnetManager.getDirection(intersectPoint, box); final Point2D loc = path.getComputedLocation().copy(); connection.setXOffset(intersectPoint.getX() - c.getX()); connection.setYOffset(intersectPoint.getY() - c.getY()); if (connector.getHeadConnection() == connection) { connector.getLine().setHeadDirection(d); } else { connector.getLine().setTailDirection(d); } connection.move(loc.getX() + c.getX(), loc.getY() + c.getY()); } }