]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java
Stash for edge styling & import progress monitoring
[simantics/district.git] / org.simantics.district.network.ui / src / org / simantics / district / network / ui / nodes / DistrictNetworkVertexNode.java
index c566981e05261b5f735ae18c77538a18a97a2dc2..99eb3cc117b7fb91cbb8352016a62da7e9836249 100644 (file)
@@ -24,10 +24,10 @@ public class DistrictNetworkVertexNode extends G2DNode {
     private static final long serialVersionUID = -2641639101400236719L;
     private DistrictNetworkVertex vertex;
 
-    private static final double left = -0.5;
-    private static final double top = -0.5;
-    private static final double width = 1;
-    private static final double height = 1;
+    private static final double left = -0.25;
+    private static final double top = -0.25;
+    private static final double width = 0.5;
+    private static final double height = 0.5;
     
     private static final Rectangle2D NORMAL = new Rectangle2D.Double(left, top, width, height);
     private static final Rectangle2D HOVERED = new Rectangle2D.Double(left * 3, top * 3, width * 3, height * 3);
@@ -40,6 +40,8 @@ public class DistrictNetworkVertexNode extends G2DNode {
 
     private Rectangle2D bounds;
 
+    private Double strokee;
+
     @Override
     public void init() {
         setZIndex(2);
@@ -65,7 +67,11 @@ public class DistrictNetworkVertexNode extends G2DNode {
         double scaleRecip = 1;
         if (scaleStroke) {
             double scale = GeometryUtils.getScale(g2d.getTransform());
-            
+            double str;
+            if (strokee != null)
+                str = strokee;
+            else
+                str = 1.0;
             //System.out.println("scale: " + scale);
             scaleRecip = 1.0 / scale;
         }
@@ -131,7 +137,7 @@ public class DistrictNetworkVertexNode extends G2DNode {
     private static Point2D calculatePoint2D(DistrictNetworkVertex vertex) {
         Point2D point= vertex.getPoint();
         double x = ModelledCRS.longitudeToX(point.getX());
-        double y = ModelledCRS.latitudeToY(point.getY());
+        double y = ModelledCRS.latitudeToY(-point.getY()); // Inverse because Simantics Diagram is inverted
 
         // Apply the scaling
         Point2D res = new Point2D.Double(x, y);
@@ -162,4 +168,8 @@ public class DistrictNetworkVertexNode extends G2DNode {
         return color;
     }
 
+    @PropertySetter(value = "stroke")
+    public void setStroke(Double stroke) {
+        this.strokee = stroke / 10;
+    }
 }