]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/TerminalLayout.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / element / handler / TerminalLayout.java
diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/TerminalLayout.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/TerminalLayout.java
new file mode 100644 (file)
index 0000000..87152e5
--- /dev/null
@@ -0,0 +1,58 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.g2d.element.handler;\r
+\r
+import java.awt.Shape;\r
+import java.awt.geom.AffineTransform;\r
+\r
+import org.simantics.g2d.diagram.handler.Topology.Terminal;\r
+import org.simantics.g2d.element.IElement;\r
+import org.simantics.g2d.element.handler.impl.StaticTerminals;\r
+import org.simantics.g2d.utils.geom.DirectionSet;\r
+\r
+/**\r
+ * \r
+ * @See {@link TerminalTopology} Enumeration of terminals\r
+ * @See {@link StaticTerminals} Compile handler for elements with static terminals (almost all)\r
+ * @author Toni Kalajainen\r
+ */\r
+public interface TerminalLayout extends ElementHandler {\r
+       \r
+       /**\r
+        * Get a copy of terminal transformation (on element)\r
+        * @param node\r
+        * @param t\r
+        * @return position of a terminal or null\r
+        */\r
+       AffineTransform getTerminalPosition(IElement node, Terminal t);\r
+       \r
+       /**\r
+        * Get Terminal direction  \r
+        * @param node node\r
+        * @param t terminal\r
+        * @param directions collection where directions are added (compass direction, 0 + n*360=north, n e N)\r
+        * @return true if this handler could tell the terminal direction \r
+        */\r
+       boolean getTerminalDirection(IElement node, Terminal t, DirectionSet directions);\r
+       \r
+       /**\r
+        * Get shape of a terminal.\r
+        * If terminal has a shape its selection is based on it and is zoom-level dependent.\r
+        * If a terminal has no shape it is a point and zoom-level independent.\r
+        * \r
+        * Only the area that fits into the element will be picked. \r
+        * \r
+        * @return shape shape or null\r
+        */\r
+       Shape getTerminalShape(IElement node, Terminal t);\r
+       \r
+}\r