public final void normalize(double length) { double x = getX(); double y = getY(); if (((x == 0) && (y == 0)) || (length == 0)) { return; } double angle = Math.atan2(y, x); setX(Math.cos(angle) * length); setY(Math.sin(angle) * length); }
@Override public boolean adjust(final Point2D dxy) { if (null == dragContext) { dxy.setX(0); dxy.setY(0); return true; } return doAdjust(dxy); }
@Override public boolean adjust(final Point2D dxy) { if (null == dragContext) { dxy.setX(0); dxy.setY(0); return true; } return doAdjust(dxy); }
private void childMoved(final WiresBaseTreeNode child, final double nx, final double ny) { final int index = children.indexOf(child); final WiresTreeNodeConnector connector = connectors.get(index); connector.getPoints().get(1).setX(nx); connector.getPoints().get(1).setY(ny); }
@Override public WiresShapeToolbox offset(final Point2D value) { this.toolboxOffset.setX(value.getX()); this.toolboxOffset.setY(value.getY()); return reposition(); }
private static final double closingArc(final PathPartList list, final Point2D p0, final Point2D p2, final Point2D p4, final Point2D plast, final Point2D p0new, final double radius) { final Point2D p1 = new Point2D(); final Point2D p3 = new Point2D(); final double closingRadius = adjustStartEndOffsets(p0, p2, p4, radius, p1, p3); list.M(p3.getX(), p3.getY()); plast.setX(p1.getX()); plast.setY(p1.getY()); p0new.setX(p3.getX()); p0new.setY(p3.getY()); return closingRadius; }
private static final double closingArc(final PathPartList list, final Point2D p0, final Point2D p2, final Point2D p4, final Point2D plast, final Point2D p0new, final double radius) { final Point2D p1 = new Point2D(); final Point2D p3 = new Point2D(); final double closingRadius = adjustStartEndOffsets(p0, p2, p4, radius, p1, p3); list.M(p3.getX(), p3.getY()); plast.setX(p1.getX()); plast.setY(p1.getY()); p0new.setX(p3.getX()); p0new.setY(p3.getY()); return closingRadius; }
@Override public void onMove(final double x, final double y) { curve.getControlPoints().get(1).setX(x - getX()); curve.getControlPoints().get(1).setY(y - getY()); bounding.getControlPoints().get(1).setX(x - getX()); bounding.getControlPoints().get(1).setY(y - getY()); controlLine1.getPoints().get(1).setX(x - getX()); controlLine1.getPoints().get(1).setY(y - getY()); } }
@Override public WiresShapeToolbox grid(final Point2DGrid grid) { toolbox.grid(grid); // Add some padding to fit the grid with a shape.. final Point2D go = getGridOffset(grid, toolbox.getAt()); gridOffset.setX(go.getX()); gridOffset.setY(go.getY()); return reposition(); }
@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()); } }
@Override public void onMove(final double x, final double y) { curve.getControlPoints().get(3).setX(x - getX()); curve.getControlPoints().get(3).setY(y - getY()); bounding.getControlPoints().get(3).setX(x - getX()); bounding.getControlPoints().get(3).setY(y - getY()); controlLine2.getPoints().get(1).setX(x - getX()); controlLine2.getPoints().get(1).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()); } }
@Override public void onMove(final double x, final double y) { curve.getControlPoints().get(1).setX(x - getX()); curve.getControlPoints().get(1).setY(y - getY()); bounding.getControlPoints().get(1).setX(x - getX()); bounding.getControlPoints().get(1).setY(y - getY()); controlLine1.getPoints().get(1).setX(x - getX()); controlLine1.getPoints().get(1).setY(y - getY()); } }
@Override public void onMove(final double x, final double y) { curve.getControlPoints().get(3).setX(x - getX()); curve.getControlPoints().get(3).setY(y - getY()); bounding.getControlPoints().get(3).setX(x - getX()); bounding.getControlPoints().get(3).setY(y - getY()); controlLine2.getPoints().get(1).setX(x - getX()); controlLine2.getPoints().get(1).setY(y - getY()); } }
@Override public void onNodeDragMove(final NodeDragMoveEvent event) { if ((m_handle.isActive()) && (m_handleList.isActive())) { m_point.setX(m_prim.getX() - m_shape.getX()); m_point.setY(m_prim.getY() - m_shape.getY()); m_shape.refresh(); m_shape.getLayer().batch(); } } }