]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/connection/ConnectionVisuals.java
(refs #7177) Rounded connections
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / connection / ConnectionVisuals.java
index 5aa8048acb7e5d415936a96c2a5dc5e30cdec3f4..45e4079065f76f1932f26c04b5035f61229a13ec 100644 (file)
@@ -25,13 +25,15 @@ public class ConnectionVisuals {
     public final float[] color;
     public final StrokeType strokeType;
     public final Stroke stroke;
+    public final Double rounding;
 
-    public ConnectionVisuals(float[] color, StrokeType strokeType, Stroke stroke) {
+    public ConnectionVisuals(float[] color, StrokeType strokeType, Stroke stroke, Double rounding) {
         if (color != null && color.length < 3)
             throw new IllegalArgumentException("colors must have at least 3 components (rgb), got " + color.length);
         this.color = color;
         this.strokeType = strokeType;
         this.stroke = stroke;
+        this.rounding = rounding;
     }
 
     public Color toColor() {
@@ -47,6 +49,7 @@ public class ConnectionVisuals {
         final int prime = 31;
         int result = 1;
         result = prime * result + Arrays.hashCode(color);
+        result = prime * result + ((rounding == null) ? 0 : rounding.hashCode());
         result = prime * result + ((stroke == null) ? 0 : stroke.hashCode());
         result = prime * result + ((strokeType == null) ? 0 : strokeType.hashCode());
         return result;
@@ -58,20 +61,22 @@ public class ConnectionVisuals {
             return true;
         if (obj == null)
             return false;
-        if (!(obj instanceof ConnectionVisuals))
+        if (getClass() != obj.getClass())
             return false;
         ConnectionVisuals other = (ConnectionVisuals) obj;
         if (!Arrays.equals(color, other.color))
             return false;
+        if (rounding == null) {
+            if (other.rounding != null)
+                return false;
+        } else if (!rounding.equals(other.rounding))
+            return false;
         if (stroke == null) {
             if (other.stroke != null)
                 return false;
         } else if (!stroke.equals(other.stroke))
             return false;
-        if (strokeType == null) {
-            if (other.strokeType != null)
-                return false;
-        } else if (!strokeType.equals(other.strokeType))
+        if (strokeType != other.strokeType)
             return false;
         return true;
     }