]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram.connection/tests/org/simantics/diagram/connection/tests/actions/HighlightReconnectPointsAction.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.diagram.connection / tests / org / simantics / diagram / connection / tests / actions / HighlightReconnectPointsAction.java
index 0e10aae73800237a05f5c0dc3dfb12b081223f0e..dc9d7352bfe337962606c49a7eda542ca60ce66a 100644 (file)
@@ -1,64 +1,64 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
- * 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.diagram.connection.tests.actions;\r
-\r
-import java.awt.Graphics2D;\r
-import java.awt.geom.Line2D;\r
-\r
-import org.simantics.diagram.connection.RouteGraph;\r
-import org.simantics.diagram.connection.RouteLineHalf;\r
-import org.simantics.diagram.connection.actions.IAction;\r
-import org.simantics.diagram.connection.rendering.IRouteGraphRenderer;\r
-\r
-public class HighlightReconnectPointsAction implements IAction {\r
-\r
-    public static final double DEGENERATED_LINE_LENGTH = 0.8;\r
-    public static final double CROSS_SIZE = 0.5;\r
-\r
-    RouteGraph rg;\r
-    double crossSize;\r
-\r
-    public HighlightReconnectPointsAction(RouteGraph rg) {\r
-        this(rg, CROSS_SIZE);\r
-    }\r
-\r
-    public HighlightReconnectPointsAction(RouteGraph rg, double crossSize) {\r
-        this.rg = rg;\r
-        this.crossSize = crossSize;\r
-    }\r
-\r
-    @Override\r
-    public void render(Graphics2D g, IRouteGraphRenderer renderer, double mouseX, double mouseY) {\r
-        renderer.render(g, rg);\r
-        for(RouteLineHalf lh : rg.getLineHalves()) {\r
-            if(lh.getLine().getLength() < DEGENERATED_LINE_LENGTH)\r
-                continue;\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 += crossSize*2;\r
-                else\r
-                    x -= crossSize*2;\r
-            }\r
-            else {\r
-                if(lh.getLink() == lh.getLine().getBegin())\r
-                    y += crossSize*2;\r
-                else\r
-                    y -= crossSize*2;\r
-            }\r
-            g.draw(new Line2D.Double(x-crossSize,y-crossSize,x+crossSize,y+crossSize));\r
-            g.draw(new Line2D.Double(x-crossSize,y+crossSize,x+crossSize,y-crossSize));\r
-        }\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.diagram.connection.tests.actions;
+
+import java.awt.Graphics2D;
+import java.awt.geom.Line2D;
+
+import org.simantics.diagram.connection.RouteGraph;
+import org.simantics.diagram.connection.RouteLineHalf;
+import org.simantics.diagram.connection.actions.IAction;
+import org.simantics.diagram.connection.rendering.IRouteGraphRenderer;
+
+public class HighlightReconnectPointsAction implements IAction {
+
+    public static final double DEGENERATED_LINE_LENGTH = 0.8;
+    public static final double CROSS_SIZE = 0.5;
+
+    RouteGraph rg;
+    double crossSize;
+
+    public HighlightReconnectPointsAction(RouteGraph rg) {
+        this(rg, CROSS_SIZE);
+    }
+
+    public HighlightReconnectPointsAction(RouteGraph rg, double crossSize) {
+        this.rg = rg;
+        this.crossSize = crossSize;
+    }
+
+    @Override
+    public void render(Graphics2D g, IRouteGraphRenderer renderer, double mouseX, double mouseY) {
+        renderer.render(g, rg);
+        for(RouteLineHalf lh : rg.getLineHalves()) {
+            if(lh.getLine().getLength() < DEGENERATED_LINE_LENGTH)
+                continue;
+            double x = lh.getLink().getX();
+            double y = lh.getLink().getY();
+            if(lh.getLine().isHorizontal()) {
+                if(lh.getLink() == lh.getLine().getBegin())
+                    x += crossSize*2;
+                else
+                    x -= crossSize*2;
+            }
+            else {
+                if(lh.getLink() == lh.getLine().getBegin())
+                    y += crossSize*2;
+                else
+                    y -= crossSize*2;
+            }
+            g.draw(new Line2D.Double(x-crossSize,y-crossSize,x+crossSize,y+crossSize));
+            g.draw(new Line2D.Double(x-crossSize,y+crossSize,x+crossSize,y-crossSize));
+        }
+    }
+
+}