-package org.simantics.diagram.participant;\r
-\r
-import java.awt.geom.AffineTransform;\r
-import java.awt.geom.Point2D;\r
-\r
-import org.simantics.g2d.diagram.participant.pointertool.TerminalUtil.TerminalInfo;\r
-import org.simantics.g2d.elementclass.BranchPoint.Direction;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class ControlPoint {\r
-\r
- private final Point2D position = new Point2D.Double();\r
- private Direction direction;\r
- private TerminalInfo attachedToTerminal = null;\r
-\r
- public ControlPoint(Point2D pos) {\r
- this(pos, Direction.Any);\r
- }\r
-\r
- public ControlPoint(Point2D pos, Direction direction) {\r
- this.position.setLocation(pos);\r
- this.direction = direction;\r
- }\r
-\r
- public ControlPoint setPosition(Point2D position) {\r
- this.position.setLocation(position);\r
- return this;\r
- }\r
-\r
- public ControlPoint setPosition(double x, double y) {\r
- this.position.setLocation(x, y);\r
- return this;\r
- }\r
-\r
- /**\r
- * Take the control point position from the translation part of the\r
- * specified AffineTransform.\r
- * \r
- * @param at\r
- * @return\r
- */\r
- public ControlPoint setPosition(AffineTransform at) {\r
- this.position.setLocation(at.getTranslateX(), at.getTranslateY());\r
- return this;\r
- }\r
-\r
- public ControlPoint setDirection(Direction direction) {\r
- if (direction == null)\r
- throw new NullPointerException("trying to set null direction");\r
- this.direction = direction;\r
- return this;\r
- }\r
-\r
- public ControlPoint setAttachedToTerminal(TerminalInfo info) {\r
- this.attachedToTerminal = info;\r
- return this;\r
- }\r
-\r
- public Direction getDirection() {\r
- return direction;\r
- }\r
-\r
- public Point2D getPosition() {\r
- return new Point2D.Double(position.getX(), position.getY());\r
- }\r
-\r
- public boolean isAttachedToTerminal() {\r
- return attachedToTerminal != null;\r
- }\r
-\r
- public TerminalInfo getAttachedTerminal() {\r
- return attachedToTerminal;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "[" + position + ", " + direction + ", " + isAttachedToTerminal() + "]";\r
- }\r
-\r
+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