]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/NetworkDrawingNode.java
Some cleaning and fixing of district functionalities
[simantics/district.git] / org.simantics.district.network.ui / src / org / simantics / district / network / ui / nodes / NetworkDrawingNode.java
index b2c157184f07cf0c96b9eb342b3dc438f7cf53b8..1ccde2c7b18db0c459648af546428b57c3205428 100644 (file)
@@ -163,13 +163,14 @@ public class NetworkDrawingNode extends G2DNode {
          *    String str = formatValue(val);
          */
         // TODO: fix scale
-        double scale = 100000;
-//        double scale = 1;
-        double startLat = ModelledCRS.yToLatitude(start.getY() / scale);
-        double startLon = ModelledCRS.xToLongitude(start.getX() / scale);
+        double scaleY = getTransform().getScaleY();
+        double scaleX = getTransform().getScaleX();
         
-        double endLat = ModelledCRS.yToLatitude(end.getY() / scale);
-        double endLon = ModelledCRS.xToLongitude(end.getX() / scale);
+        double startLat = ModelledCRS.yToLatitude(start.getY() / scaleY);
+        double startLon = ModelledCRS.xToLongitude(start.getX() / scaleX);
+        
+        double endLat = ModelledCRS.yToLatitude(end.getY() / scaleY);
+        double endLon = ModelledCRS.xToLongitude(end.getX() / scaleX);
         
         double[] startCoords = new double[] { startLon, startLat };
         double[] endCoords = new double[] { endLon, endLat };
@@ -179,7 +180,7 @@ public class NetworkDrawingNode extends G2DNode {
             
             @Override
             public void perform(WriteGraph graph) throws DatabaseException {
-                builder.create(graph, startCoords, endCoords, padding / scale);
+                builder.create(graph, startCoords, endCoords, 1 / padding);
             }
         });