import java.awt.Graphics2D;\r
import java.awt.geom.AffineTransform;\r
import java.awt.geom.Path2D;\r
-import java.awt.geom.Rectangle2D;\r
import java.io.Serializable;\r
import java.util.StringTokenizer;\r
\r
protected Path2D path;\r
protected double lineEndLength;\r
\r
- protected Rectangle2D bounds = new Rectangle2D.Double();\r
- \r
- public FlowArrowLineStyle(String desc, Rectangle2D bounds) {\r
+ public FlowArrowLineStyle(String desc) {\r
this.type = ArrowType.None;\r
this.lineEndLength = 0.0;\r
\r
double l = length;\r
double w = width;\r
double s = space;\r
- this.bounds = bounds;\r
\r
StringTokenizer tokenizer = new StringTokenizer(desc);\r
if (tokenizer.hasMoreTokens()) {\r
public void render(Graphics2D g, double x, double y, int dir) {\r
if (type == ArrowType.None || path == null)\r
return;\r
- // Calculate coordinates to the border of the terminal\r
- switch(dir) {\r
- case 0:\r
- x = bounds.getMinX();\r
- break;\r
- case 1:\r
- y = bounds.getMinY();\r
- break;\r
- case 2:\r
- x = bounds.getMaxX();\r
- break;\r
- case 3:\r
- y = bounds.getMaxY();\r
- break;\r
- default:\r
- return;\r
- }\r
AffineTransform old = g.getTransform();\r
g.translate(x, y);\r
g.rotate(dir*Math.PI*0.5);\r
\r
@Override\r
public double getLineEndLength(int direction) {\r
- switch(direction) {\r
- case 0:\r
- lineEndLength = bounds.getWidth() / 2.0;\r
- break;\r
- case 1:\r
- lineEndLength = bounds.getHeight() / 2.0;\r
- break;\r
- case 2:\r
- lineEndLength = bounds.getWidth() / 2.0;\r
- break;\r
- case 3:\r
- lineEndLength = bounds.getHeight() / 2.0;\r
- break;\r
- }\r
return lineEndLength;\r
}\r
\r
// Expand bounds by 4mm to make the connections enter the terminals\r
// at a straight angle and from a distance instead of coming in\r
// "horizontally".\r
- GeometryUtils.expandRectangle(bounds, 4);\r
+ //GeometryUtils.expandRectangle(bounds, 4);\r
\r
minx = bounds.getMinX();\r
miny = bounds.getMinY();\r
direction = 0xf;\r
\r
//System.out.println("load line style: " + NameUtils.getSafeLabel(graph, attachmentRelation));\r
- ILineEndStyle endStyle = loadLineEndStyle(graph, te, attachmentRelation, new Rectangle2D.Double(\r
- bounds.getX(), \r
- bounds.getY(), \r
- bounds.getWidth(), \r
- bounds.getHeight())\r
- );\r
-\r
- RouteTerminal routeTerminal = rg.addTerminal(x, y, minx, miny, maxx, maxy, direction, endStyle);\r
+ ILineEndStyle endStyle = loadLineEndStyle(graph, te, attachmentRelation);\r
+\r
+ RouteTerminal routeTerminal = rg.addBigTerminal(/*x, y,*/ minx, miny, maxx, maxy, /*direction,*/ endStyle);\r
routeTerminal.setData( RouteGraphConnection.serialize(graph, connector) );\r
\r
nodes.add( connector );\r
return null;\r
}\r
\r
- public ILineEndStyle loadLineEndStyle(ReadGraph graph, IElement te, Resource attachmentRelation, Rectangle2D bounds)\r
+ public ILineEndStyle loadLineEndStyle(ReadGraph graph, IElement te, Resource attachmentRelation)\r
throws DatabaseException {\r
ILineEndStyle style;\r
// TODO: change bounds according to terminal type: Very small rectangle for Valves, Text box size for Stocks and Clouds\r
if(te.getElementClass().containsClass(ValveSceneGraph.class)) {\r
- GeometryUtils.expandRectangle(bounds, -4);\r
- style = new FlowArrowLineStyle("none 0 0 0", bounds);\r
+ style = new FlowArrowLineStyle("none 0 0 0");\r
} else {\r
if (graph.isSubrelationOf(attachmentRelation, DIA.HasHeadConnector)) {\r
- GeometryUtils.expandRectangle(bounds, -2.5);\r
- style = new FlowArrowLineStyle("fill 2 2 -1.5", bounds);\r
+ style = new FlowArrowLineStyle("fill 2 2 0");\r
} else {\r
- GeometryUtils.expandRectangle(bounds, -4);\r
- style = new FlowArrowLineStyle("none 0 0 0", bounds);\r
+ style = new FlowArrowLineStyle("none 0 0 0");\r
}\r
}\r
return style;\r