]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/connection/ConnectionVisuals.java
Improvements to styling of connection lines
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / connection / ConnectionVisuals.java
index 802881e1610efa52d787e0670edddb4c291e45de..e7a31692b5ea2cb22a5bda1bd044bdd3a199ad8c 100644 (file)
@@ -27,12 +27,17 @@ public class ConnectionVisuals {
     public final Stroke stroke;
     public final Double branchPointRadius;
     public final Double rounding;
+    public final Double offset;
 
     public ConnectionVisuals(float[] color, StrokeType strokeType, Stroke stroke, Double rounding) {
        this(color, strokeType, stroke, null, rounding);
     }
 
     public ConnectionVisuals(float[] color, StrokeType strokeType, Stroke stroke, Double branchPointRadius, Double rounding) {
+        this(color, strokeType, stroke, null, rounding, null);
+    }
+
+    public ConnectionVisuals(float[] color, StrokeType strokeType, Stroke stroke, Double branchPointRadius, Double rounding, Double offset) {
         if (color != null && color.length < 3)
             throw new IllegalArgumentException("colors must have at least 3 components (rgb), got " + color.length);
         this.color = color;
@@ -40,6 +45,7 @@ public class ConnectionVisuals {
         this.stroke = stroke;
         this.branchPointRadius = branchPointRadius;
         this.rounding = rounding;
+        this.offset = offset;
     }
 
     public Color toColor() {
@@ -57,6 +63,7 @@ public class ConnectionVisuals {
         result = prime * result + ((branchPointRadius == null) ? 0 : branchPointRadius.hashCode());
         result = prime * result + Arrays.hashCode(color);
         result = prime * result + ((rounding == null) ? 0 : rounding.hashCode());
+        result = prime * result + ((offset == null) ? 0 : offset.hashCode());
         result = prime * result + ((stroke == null) ? 0 : stroke.hashCode());
         result = prime * result + ((strokeType == null) ? 0 : strokeType.hashCode());
         return result;
@@ -83,6 +90,11 @@ public class ConnectionVisuals {
                 return false;
         } else if (!rounding.equals(other.rounding))
             return false;
+        if (offset == null) {
+            if (other.offset != null)
+                return false;
+        } else if (!offset.equals(other.offset))
+            return false;
         if (stroke == null) {
             if (other.stroke != null)
                 return false;