@Override public boolean apply(Node<?> node, double percent) { double x = m_origin.getX() + ((m_target.getX() - m_origin.getX()) * percent); double y = m_origin.getY() + ((m_target.getY() - m_origin.getY()) * percent); node.getAttributes().putPoint2D(m_attribute.getProperty(), new Point2D(x, y)); return true; } }
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; }
/** * Constructor. Creates an instance of a line. * * @param x1 first point X coordinate * @param y1 first point Y coordinate * @param x2 second point X coordinate * @param y2 second point Y coordinate */ public Line(final double x1, final double y1, final double x2, final double y2) { this(new Point2D(x1, y1), new Point2D(x2, y2)); }
private Point2D getCandidateShapeLocationRelativeToInitialParent(final WiresShape shape) { final Point2D candidate = shape.getControl().getContainmentControl().getCandidateLocation(); final WiresParentPickerControlImpl parentPickerControl = (WiresParentPickerControlImpl) shape.getControl().getParentPickerControl(); final Point2D io = null != parentPickerControl.getInitialParent() ? parentPickerControl.getInitialParent().getComputedLocation() : new Point2D(0, 0); final Point2D co = null != parentPickerControl.getParent() ? parentPickerControl.getParent().getComputedLocation() : new Point2D(0, 0); return co.add(candidate).minus(io); }
@Override public double getY() { return getLocation().getY(); } }
@Override public double getX() { return getLocation().getX(); }
class Point2D{ private int x; private int y; <getter & setter> } class Constant{ Public static final Point2D A = new Point2D(1,2); public static void main(String[] args){ A.setX(10); // this will work A = new Point2D(10,20);// this will not work } }
private void updateControlLocations() { if (controls == null) { return; } if (!isControlsVisible) { return; } for (Group ctrl : controls) { final Point2D target = getControlTarget(ctrl).add(WiresBaseShape.this.getLocation()); ctrl.setLocation(target); } }
@Override public Point2D getAdjust() { return new Point2D(0, 0); }
private Point2D getCandidateShapeLocationRelativeToInitialParent(final WiresShape shape) { final Point2D candidate = shape.getControl().getContainmentControl().getCandidateLocation(); final WiresParentPickerControlImpl parentPickerControl = (WiresParentPickerControlImpl) shape.getControl().getParentPickerControl(); final Point2D io = null != parentPickerControl.getInitialParent() ? parentPickerControl.getInitialParent().getComputedLocation() : new Point2D(0, 0); final Point2D co = null != parentPickerControl.getParent() ? parentPickerControl.getParent().getComputedLocation() : new Point2D(0, 0); return co.add(candidate).minus(io); }
/** * Constructs a Shadow from a color (as a String), a blur and an offset (offx, offy). * * @param color String * @param blur * @param offx * @param offy */ public Shadow(final String color, final int blur, final double offx, final double offy) { this(ShadowJSO.make(normalizeShadowColor(color), blur, true, new Point2D(offx, offy).getJSO())); }
@Override protected Point2D getControlTarget( final Group ctrl ) { final Point2D target = super.getControlTarget( ctrl ); target.setX( circle.getRadius() + 25 ); return target; }