+ private static Point2D removeLocation(RouteLineHalf lh, Point2D p) {\r
+ if (lh.getLine().getTerminal() == null)\r
+ return null;\r
+\r
+ double x = lh.getLink().getX();\r
+ double y = lh.getLink().getY();\r
+ if (lh.getLine().isHorizontal()) {\r
+ x = (lh.getLine().getBegin().getX() + lh.getLine().getEnd().getX()) * .5;\r
+ } else {\r
+ y = (lh.getLine().getBegin().getY() + lh.getLine().getEnd().getY()) * .5;\r
+ }\r
+ p.setLocation(x, y);\r
+ return p;\r
+ }\r
+\r
+ private static Point2D reconnectLocation(RouteLineHalf lh, Point2D p) {\r
+ if (lh.getLine().getLength() < DEGENERATED_LINE_LENGTH*3)\r
+ return null;\r
+\r
+ final double dist = CUT_DIST_FROM_END;\r
+ double x = lh.getLink().getX();\r
+ double y = lh.getLink().getY();\r
+ if (lh.getLine().isHorizontal()) {\r
+ if (lh.getLink() == lh.getLine().getBegin())\r
+ x += dist*2;\r
+ else\r
+ x -= dist*2;\r
+ } else {\r
+ if (lh.getLink() == lh.getLine().getBegin())\r
+ y += dist*2;\r
+ else\r
+ y -= dist*2;\r
+ }\r
+ p.setLocation(x, y);\r
+ return p;\r
+ }\r
+\r