+ Point pos1 = pin1.getPos(), pos2 = pin2.getPos();
+
+ double boundsX1 = Math.min(pos1.x, pos2.x);
+ double boundsY1 = Math.min(pos1.y, pos2.y);
+ double boundsX2 = Math.max(pos1.x, pos2.x);
+ double boundsY2 = Math.max(pos1.y, pos2.y);
+
+ if (path == null)
+ effectivePath = new double[] { pos1.x, pos1.y, (pos1.x + pos2.x) / 2, pos1.y, (pos1.x + pos2.x) / 2, pos2.y, pos2.x, pos2.y };
+ else
+ {
+ effectivePath = new double[path.length * 2 + 4];
+ effectivePath[0] = pos1.x;
+ effectivePath[1] = pos1.y;
+ for (int srcI = 0, dstI = 2; srcI < path.length; srcI++, dstI += 2)
+ {
+ double pathX = path[srcI].x;
+ double pathY = path[srcI].y;
+ effectivePath[dstI + 0] = pathX;
+ effectivePath[dstI + 1] = pathY;
+ if (pathX < boundsX1)
+ boundsX1 = pathX;
+ if (pathX > boundsX2)
+ boundsX2 = pathX;
+ if (pathY < boundsY1)
+ boundsY1 = pathY;
+ if (pathY > boundsY2)
+ boundsY2 = pathY;
+ }
+ effectivePath[effectivePath.length - 2] = pos2.x;
+ effectivePath[effectivePath.length - 1] = pos2.y;
+ }
+
+ bounds.x = boundsX1;
+ bounds.y = boundsY1;
+ bounds.width = boundsX2 - boundsX1;
+ bounds.height = boundsY2 - boundsY1;
+ }
+
+ /**
+ * Returns the bounds of this wire, excluding line width (and line joins, if the line join is {@link SWT#JOIN_MITER})
+ *
+ * @author Daniel Kirschten
+ */
+ public Rectangle getBounds()
+ {
+ return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height);