X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fparticipant%2FControlPoint.java;fp=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fparticipant%2FControlPoint.java;h=940a84426e95ee86e255b2907cecb52b8299a018;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=69d90a72ed4bfefd22ae269d0c76a1518fc4d9ef;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ControlPoint.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ControlPoint.java index 69d90a72e..940a84426 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ControlPoint.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ControlPoint.java @@ -1,82 +1,82 @@ -package org.simantics.diagram.participant; - -import java.awt.geom.AffineTransform; -import java.awt.geom.Point2D; - -import org.simantics.g2d.diagram.participant.pointertool.TerminalUtil.TerminalInfo; -import org.simantics.g2d.elementclass.BranchPoint.Direction; - -/** - * @author Tuukka Lehtonen - */ -public class ControlPoint { - - private final Point2D position = new Point2D.Double(); - private Direction direction; - private TerminalInfo attachedToTerminal = null; - - public ControlPoint(Point2D pos) { - this(pos, Direction.Any); - } - - public ControlPoint(Point2D pos, Direction direction) { - this.position.setLocation(pos); - this.direction = direction; - } - - public ControlPoint setPosition(Point2D position) { - this.position.setLocation(position); - return this; - } - - public ControlPoint setPosition(double x, double y) { - this.position.setLocation(x, y); - return this; - } - - /** - * Take the control point position from the translation part of the - * specified AffineTransform. - * - * @param at - * @return - */ - public ControlPoint setPosition(AffineTransform at) { - this.position.setLocation(at.getTranslateX(), at.getTranslateY()); - return this; - } - - public ControlPoint setDirection(Direction direction) { - if (direction == null) - throw new NullPointerException("trying to set null direction"); - this.direction = direction; - return this; - } - - public ControlPoint setAttachedToTerminal(TerminalInfo info) { - this.attachedToTerminal = info; - return this; - } - - public Direction getDirection() { - return direction; - } - - public Point2D getPosition() { - return new Point2D.Double(position.getX(), position.getY()); - } - - public boolean isAttachedToTerminal() { - return attachedToTerminal != null; - } - - public TerminalInfo getAttachedTerminal() { - return attachedToTerminal; - } - - @Override - public String toString() { - return "[" + position + ", " + direction + ", " + isAttachedToTerminal() + "]"; - } - +package org.simantics.diagram.participant; + +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; + +import org.simantics.g2d.diagram.participant.pointertool.TerminalUtil.TerminalInfo; +import org.simantics.g2d.elementclass.BranchPoint.Direction; + +/** + * @author Tuukka Lehtonen + */ +public class ControlPoint { + + private final Point2D position = new Point2D.Double(); + private Direction direction; + private TerminalInfo attachedToTerminal = null; + + public ControlPoint(Point2D pos) { + this(pos, Direction.Any); + } + + public ControlPoint(Point2D pos, Direction direction) { + this.position.setLocation(pos); + this.direction = direction; + } + + public ControlPoint setPosition(Point2D position) { + this.position.setLocation(position); + return this; + } + + public ControlPoint setPosition(double x, double y) { + this.position.setLocation(x, y); + return this; + } + + /** + * Take the control point position from the translation part of the + * specified AffineTransform. + * + * @param at + * @return + */ + public ControlPoint setPosition(AffineTransform at) { + this.position.setLocation(at.getTranslateX(), at.getTranslateY()); + return this; + } + + public ControlPoint setDirection(Direction direction) { + if (direction == null) + throw new NullPointerException("trying to set null direction"); + this.direction = direction; + return this; + } + + public ControlPoint setAttachedToTerminal(TerminalInfo info) { + this.attachedToTerminal = info; + return this; + } + + public Direction getDirection() { + return direction; + } + + public Point2D getPosition() { + return new Point2D.Double(position.getX(), position.getY()); + } + + public boolean isAttachedToTerminal() { + return attachedToTerminal != null; + } + + public TerminalInfo getAttachedTerminal() { + return attachedToTerminal; + } + + @Override + public String toString() { + return "[" + position + ", " + direction + ", " + isAttachedToTerminal() + "]"; + } + } \ No newline at end of file