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=335f9e118cd1d8c14bd640cc6bd850f6dadb3a18;hb=c12e4bf01324aac07efeac121a794cb98949ef20;hp=4d527c1a1c5fe038af161fafe706f668a133f267;hpb=426a4ef58cf0b7e755a9111881800806f1374d59;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 4d527c1a..335f9e11 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 @@ -172,17 +172,6 @@ public class NetworkDrawingNode extends G2DNode { double x = ModelledCRS.xToLongitude(pos.getX() / scale); double y = ModelledCRS.yToLatitude(-pos.getY() / scale); - double elevation = 0; - if (MapsElevationServerPreferences.useElevationServer()) { - // ok! we use new elevation API to resolve possible elevations for the starting points - try { - elevation = SingletonTiffTileInterface.lookup(x, y).doubleValue(); - } catch (Exception ee) { - LOGGER.error("Could not get elevation from tiff interface", ee); - } - } - final double felevation = elevation; - boolean leftButton = e.button == MouseEvent.LEFT_BUTTON; ThreadUtils.getNonBlockingWorkExecutor().schedule(() -> { @@ -200,7 +189,7 @@ public class NetworkDrawingNode extends G2DNode { if (mapping == null) { mapping = graph.getSingleObject(diagramResource, DistrictNetworkResource.getInstance(graph).VertexDefaultMapping); } - DistrictNetworkUtil.createVertex(graph, diagramResource, new double[] { x, y }, felevation, mapping); + DistrictNetworkUtil.createVertex(graph, diagramResource, new double[] { x, y }, Double.MAX_VALUE, mapping); } }); }, 100, TimeUnit.MILLISECONDS); @@ -251,26 +240,13 @@ public class NetworkDrawingNode extends G2DNode { detailedGeometryCoords[i++] = lon; detailedGeometryCoords[i++] = lat; } - - double startElevation = 0; - double endElevation = 0; - if (MapsElevationServerPreferences.useElevationServer()) { - // ok! we use new elevation API to resolve possible elevations for the starting points - try { - startElevation = SingletonTiffTileInterface.lookup(startLat, startLon).doubleValue(); - endElevation = SingletonTiffTileInterface.lookup(endLat, endLon).doubleValue(); - } catch (Exception e) { - LOGGER.error("Could not get elevation from tiff interface", e); - } - } - final double se = startElevation; - final double ee = endElevation; + DNEdgeBuilder builder = new DNEdgeBuilder(diagramResource, diagram); Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { - builder.create(graph, startCoords, se, endCoords, ee, detailedGeometryCoords, padding); + builder.create(graph, startCoords, Double.MAX_VALUE, endCoords, Double.MAX_VALUE, detailedGeometryCoords, padding); } }); @@ -323,7 +299,8 @@ public class NetworkDrawingNode extends G2DNode { boolean repaint = false; Point2D p = NodeUtil.worldToLocal(this, e.controlPosition, new Point2D.Double()); boolean isConnectionTool = mode == Hints.CONNECTTOOL || e.hasAnyModifier(MouseEvent.ALT_MASK | MouseEvent.ALT_GRAPH_MASK); - if (participant.pickHoveredElement(p, isConnectionTool)) { + // To boost pan perf hovering is only considered if no mouse button is pressed) + if (e.buttons == 0 && participant.pickHoveredElement(p, isConnectionTool)) { repaint = true; } if (!nodes.isEmpty()) {