]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/TerminalLayout.java
Sync git svn branch with SVN repository r33324.
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / element / handler / TerminalLayout.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.g2d.element.handler;\r
13 \r
14 import java.awt.Shape;\r
15 import java.awt.geom.AffineTransform;\r
16 \r
17 import org.simantics.g2d.diagram.handler.Topology.Terminal;\r
18 import org.simantics.g2d.element.IElement;\r
19 import org.simantics.g2d.element.handler.impl.StaticTerminals;\r
20 import org.simantics.g2d.utils.geom.DirectionSet;\r
21 \r
22 /**\r
23  * \r
24  * @See {@link TerminalTopology} Enumeration of terminals\r
25  * @See {@link StaticTerminals} Compile handler for elements with static terminals (almost all)\r
26  * @author Toni Kalajainen\r
27  */\r
28 public interface TerminalLayout extends ElementHandler {\r
29         \r
30         /**\r
31          * Get a copy of terminal transformation (on element)\r
32          * @param node\r
33          * @param t\r
34          * @return position of a terminal or null\r
35          */\r
36         AffineTransform getTerminalPosition(IElement node, Terminal t);\r
37         \r
38         /**\r
39          * Get Terminal direction  \r
40          * @param node node\r
41          * @param t terminal\r
42          * @param directions collection where directions are added (compass direction, 0 + n*360=north, n e N)\r
43          * @return true if this handler could tell the terminal direction \r
44          */\r
45         boolean getTerminalDirection(IElement node, Terminal t, DirectionSet directions);\r
46         \r
47         /**\r
48          * Get shape of a terminal.\r
49          * If terminal has a shape its selection is based on it and is zoom-level dependent.\r
50          * If a terminal has no shape it is a point and zoom-level independent.\r
51          * \r
52          * Only the area that fits into the element will be picked. \r
53          * \r
54          * @return shape shape or null\r
55          */\r
56         Shape getTerminalShape(IElement node, Terminal t);\r
57         \r
58 }\r