X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network.ui%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fui%2Fnodes%2FNetworkDrawingNode.java;h=aaf26a10855545bd97f3eb585a573981d775bba2;hb=3354c578fb8e65421d0fdb123310232ccdc597cf;hp=13bd2cbe9426a536e9ce3b8030a0a4b0ca1b5158;hpb=1bc60c2213f9b3fc7b4d935ba9afda2b767290e5;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/NetworkDrawingNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/NetworkDrawingNode.java index 13bd2cbe..aaf26a10 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/NetworkDrawingNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/NetworkDrawingNode.java @@ -163,12 +163,14 @@ public class NetworkDrawingNode extends G2DNode { * String str = formatValue(val); */ // TODO: fix scale - double scale = 100000; - 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 }; @@ -178,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); } });