From ac6ad8ff2b20a10e85e7b12c1af670500daebdd4 Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Mon, 30 Jul 2018 10:19:22 +0300 Subject: [PATCH] Stash for edge styling & import progress monitoring gitlab #2 Change-Id: I6f2b2349936641c9b4405335dc81bf7dbbce401c --- .../district/imports/ui/CSVImportWizard.java | 36 ++++++---- .../graph.tg | Bin 25552 -> 25809 bytes .../graph/DistrictNetwork.pgraph | 22 +++++++ .../ontology/DistrictNetworkResource.java | 6 ++ .../district/network/ui/DNEdgeBuilder.java | 62 +++++++++++------- .../network/ui/DistrictDiagramViewer.java | 10 +++ .../ui/DistrictPanZoomRotateHandler.java | 53 +++++++++++++++ .../DistrictNetworkEdgeElementFactory.java | 4 +- .../DistrictNetworkVertexElementFactory.java | 4 +- .../ui/nodes/DistrictNetworkEdgeNode.java | 18 ++++- .../ui/nodes/DistrictNetworkVertexNode.java | 22 +++++-- .../network/ui/nodes/NetworkDrawingNode.java | 4 +- .../ui/participants/DNTranslateMode.java | 6 +- .../META-INF/MANIFEST.MF | 3 +- org.simantics.district.network/adapters.xml | 11 ++++ .../scl/Simantics/District.scl | 5 ++ .../district/network/DistrictNetworkUtil.java | 17 ++++- 17 files changed, 229 insertions(+), 54 deletions(-) create mode 100644 org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictPanZoomRotateHandler.java diff --git a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizard.java b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizard.java index 80bf1447..76c30d98 100644 --- a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizard.java +++ b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizard.java @@ -2,6 +2,8 @@ package org.simantics.district.imports.ui; import java.lang.reflect.InvocationTargetException; import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; import org.apache.commons.csv.CSVRecord; @@ -23,13 +25,16 @@ import org.simantics.Simantics; import org.simantics.databoard.Bindings; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; +import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Write; +import org.simantics.diagram.stubs.DiagramResource; import org.simantics.district.imports.DistrictImportUtils; import org.simantics.district.network.DistrictNetworkUtil; import org.simantics.district.network.ontology.DistrictNetworkResource; import org.simantics.district.network.ui.DNEdgeBuilder; -import org.simantics.maps.MapScalingTransform; +import org.simantics.district.network.ui.DNEdgeBuilder.ResourceVertex; +import org.simantics.layer0.Layer0; import org.simantics.utils.ui.ExceptionUtils; public class CSVImportWizard extends Wizard implements IImportWizard { @@ -38,6 +43,7 @@ public class CSVImportWizard extends Wizard implements IImportWizard { public CSVImportWizard() { setWindowTitle("Import CSV data"); + setNeedsProgressMonitor(true); } @@ -56,12 +62,12 @@ public class CSVImportWizard extends Wizard implements IImportWizard { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - monitor.beginTask("Importing CSV", 1000); try { Path csvFile = model.getSource(); char delim = model.getDelimiter(); List rows = DistrictImportUtils.readRows(csvFile, delim, -1); + monitor.beginTask("Importing CSV", rows.size()); // Path wktFile = model.getWKTFile(); @@ -127,6 +133,13 @@ public class CSVImportWizard extends Wizard implements IImportWizard { DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); + Collection vertices = graph.syncRequest(new ObjectsWithType(model.getParentDiagram(), Layer0.getInstance(graph).ConsistsOf, DistrictNetworkResource.getInstance(graph).Vertex)); + List vv = new ArrayList<>(vertices.size()); + for (Resource vertex : vertices) { + double[] existingCoords = graph.getRelatedValue2(vertex, DiagramResource.getInstance(graph).HasLocation, Bindings.DOUBLE_ARRAY); + vv.add(new ResourceVertex(vertex, existingCoords)); + } + for (int k = 1; k < rows.size(); k++) { CSVRecord row = rows.get(k); @@ -136,7 +149,7 @@ public class CSVImportWizard extends Wizard implements IImportWizard { if (model.isVertexImport()) { String xCoords = row.get(xCoordColumnIndex); String yCoords = row.get(yCoordColumnIndex); - double xCoord = - Double.parseDouble(xCoords); // make negative for now + double xCoord = Double.parseDouble(xCoords); double yCoord = Double.parseDouble(yCoords); double z = 0; @@ -159,9 +172,9 @@ public class CSVImportWizard extends Wizard implements IImportWizard { DirectPosition res = actualTransform.transform(sourcePos, targetPos); coords = res.getCoordinate(); } else { - coords = new double[] { xCoord / MapScalingTransform.getScaleX(), yCoord / MapScalingTransform.getScaleY() }; + coords = new double[] { xCoord, yCoord }; } - Resource vertex = DistrictNetworkUtil.createVertex(graph, model.getParentDiagram(), new double[] { coords[1], -coords[0]}, model.getComponentMappings().get(mappingValue)); + Resource vertex = DistrictNetworkUtil.createVertex(graph, model.getParentDiagram(), coords, model.getComponentMappings().get(mappingValue)); writeStringValue(graph, row, idColumn, vertex, DN.HasId); @@ -192,10 +205,10 @@ public class CSVImportWizard extends Wizard implements IImportWizard { String endXCoords = row.get(endXCoordColumnIndex); String endYCoords = row.get(endYCoordColumnIndex); - double startXCoord = - Double.parseDouble(startXCoords); // make negative + double startXCoord = Double.parseDouble(startXCoords); // make negative double startYCoord = Double.parseDouble(startYCoords); - double endXCoord = - Double.parseDouble(endXCoords); // make negative + double endXCoord = Double.parseDouble(endXCoords); // make negative double endYCoord = Double.parseDouble(endYCoords); double[] startCoords; @@ -211,11 +224,11 @@ public class CSVImportWizard extends Wizard implements IImportWizard { DirectPosition endRes = actualTransform.transform(endSourcePos, endTargetPos); endCoords = endRes.getCoordinate(); } else { - startCoords = new double[] { startXCoord / MapScalingTransform.getScaleX(), startYCoord / MapScalingTransform.getScaleY() }; - endCoords = new double[] { endXCoord / MapScalingTransform.getScaleX(), endYCoord / MapScalingTransform.getScaleY() }; + startCoords = new double[] { startXCoord , startYCoord }; + endCoords = new double[] { endXCoord , endYCoord }; } - - Resource edge = DNEdgeBuilder.create(graph, model.getParentDiagram(), model.getComponentMappings().get(mappingValue), new double[] { startCoords[1], -startCoords[0]}, new double[] { endCoords[1], -endCoords[0]}, padding); + + Resource edge = DNEdgeBuilder.create(graph, vv, model.getParentDiagram(), model.getComponentMappings().get(mappingValue), startCoords, endCoords, padding); writeStringValue(graph, row, idColumn, edge, DN.HasId); writeValue(graph, row, diameterColumnIndex, edge, DN.Edge_HasDiameter); @@ -229,6 +242,7 @@ public class CSVImportWizard extends Wizard implements IImportWizard { } catch (MismatchedDimensionException | TransformException | DatabaseException e) { throw new DatabaseException(e); } + monitor.worked(1); } } }); diff --git a/org.simantics.district.network.ontology/graph.tg b/org.simantics.district.network.ontology/graph.tg index be35590cce833b30baf3448c0490abb4740de784..2bda23f8d57b1aa466c0c304240c0d739b4338d0 100644 GIT binary patch literal 25809 zcmeI4d3;nw_V(|EBxE5#SRx=|L{UeP9a%(4AS{v9B!G%6P11zMq&s#xU|bRRl^J*3 zHyjmr5nOOz(NR=Xbo@Ev=(vx=sN;q@zRz=RRo&AU-g*D|{rU3wlzqQ-o>O&dxmCAs z?8kox$NL=w_evWQai zFDIuumC9uK13=iOPSXkOQU`%KlI9<+00r3ZEk*5GW5(X zY{|qj@g_J00gG$i@>pZ*|GNdbB9nHbH{T5!;5XQoAdlVbm8@8?Vqi<6DTa=zYZ;hI zQ&Auz(5)uk7_Vb+a}x0tv#SmoGH?itn`ta4t;xia^|5sQtaPe5o@SqpkF~^MdWrVU z#pBbd6)hMRwCDH?a&o22j?*!ejfrFf3LA>t$C;bk!{$bu{7RZ1FGeX#5)G~C7=uC1 zed5(^O02~?*2bHf8_`#2R=pVWYbH#a!;XS{i{x~i5nnMO)zqA7Nl@p#&fG1XP)KEb zNvyRoGXnz&|96=GdWWjy@_1Sr^qL5}KcvE`JF3GW*A$U z7}~egHNyKD0oV2l>FTh<@@V#p+4s$}6)>b**b{$)uXl{KS$(JYC(|$ar26 zTS*eVcZ*1X=*2nscYDkss&S6&SV`xmE;tlzQ6(Y!zGK&oDh~e z)n$fl_ZXI!x6?Fdqr9g&R<%?m>l$0@M5J?cr+5?p*IhG2`ABmlilomz+{K z>~c7~4z&A)(v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b-o*f=H5035;G2bakrA->x4*;yavLkBp!3$fG$QY!&w+Q( zR3DS6O)bnUjp0Pf%7)Z}c)1+g$%lyclQzfk5Sg>F2D|%SyXQUq%8G7yiSogY?W;Dv z``(gw<5z!tfBE94W}nk*%BDpNp1XMYh*66-o$}31=bicVV+VXx*|qat|6F`U)!_ZR z?t7tMU-#4no7Qi-s&vEktF~+yy62Mv`yBT53#;Dx?yXyo?(Q%1yz;_j%hq4}*qJ;2 zv*PP7c7E~t)-j{{4O^Z*vO`6eHy8U259C(P9r5P3$KCVI>zg~Tc;V>ocV6+#-zI(j z!)|M@+uU^hY0u4A_vJSq&pUqdnAQ_dykq;EB}-2|@S@e@6MuiN{=tQP5?;si-#u^I zLzk?qTCy`$lb*A3zp*D(4&HrrL;bdz1w(4CXg}zjQOieqJAc0Z&7l|X*zv(f-~K6e z&#`}gV0Pn@=Wjdwwh^Bts!LCLpx@^7KHUp@R}AXYso&?X&?O0d4wd2lL&f9TB{m0vyKR)=>4cm)XOnzwiV?Q0T zao<;GZ5z3ILDfx_Ui%3XFaJZ!uwf_Mb@<84|9$ZYabpxf5#W|zS;8J_#Zld^~b9||Le7Pe0|xnk=_f> z)~)P5@#l^0FJ5}=v-h5TAG~w({I4(g{*mU`@NTblS-$M!r;|PN z&)9m@_S>hN{q)qOCmc3^-lhfXAKZS^Ve3yiz4FuZCnYx=)b>E$f;+za(<7^A&wYE- zZSQ`y`P<`H-nR0Ve|%Y6dj6A-_8oQRd!HP&?W<4s9CBwMXZG3j z@^OXbn@0XHc38JVHdI|Yarn9`X7=0E{^7rt9=3h^2`jE0yxhb6Q0Seter?lx?~VR> b%*qoFy>a)4E_w#T+^eacT6OQ(`OE(o2L5%2 diff --git a/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph b/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph index 75716c69..64dbb60f 100644 --- a/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph +++ b/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph @@ -354,6 +354,9 @@ DN.DistrictProfile : DIA.Profile DN.DistrictProfile.entry1 L0.HasLabel "Id" @DIA.groupStyleProfileEntry DN.ComponentIdStyle DN.Groups.ElementGroup + DN.DistrictProfile.entry2 + L0.HasLabel "Edge Node Styling" + @DIA.groupStyleProfileEntry DN.EdgeNodeStyle DN.Groups.ElementGroup DN.Groups : L0.Library @@ -375,3 +378,22 @@ DN.ComponentIdStyle : DIA.ResourceSCLTextGridStyle """ "String -> Variable -> (String, String, String)" @G2D.fontProperty DIA.TextElement.font "Arial" 30 G2D.FontStyle.normal_font_style + +//DN.EdgeNodeGroup : DIA.Group + +//DN.Profiles : L0.Library + +DN.EdgeNodeStyle : DIA.Style + +// Templates + +//groupStyleEntry : L0.Template +// @template %subject %style %group +// %subject : DIA.GroupStyleProfileEntry +// DIA.ProfileEntry.HasStyle %style +// DIA.ProfileEntry.HasGroup %group + + +//DN.Profiles.EdgeNodeStyle +// L0.HasLabel "Edge Node Style" +// @groupStyleEntry DN.EdgeNodeStyle DN.EdgeNodeGroup diff --git a/org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java b/org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java index 32aabfa2..d1e9ebd1 100644 --- a/org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java +++ b/org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java @@ -25,11 +25,13 @@ public class DistrictNetworkResource { public final Resource DistrictProfile; public final Resource DistrictProfile_entry; public final Resource DistrictProfile_entry1; + public final Resource DistrictProfile_entry2; public final Resource EPSG_4326; public final Resource Edge; public final Resource EdgeDefaultMapping; public final Resource EdgeDefaultMapping_Inverse; public final Resource EdgeMappingParameterType; + public final Resource EdgeNodeStyle; public final Resource Edge_HasDiameter; public final Resource Edge_HasDiameter_Inverse; public final Resource Edge_HasFlowArea; @@ -214,11 +216,13 @@ public class DistrictNetworkResource { public static final String DistrictProfile = "http://www.simantics.org/DistrictNetwork-1.0/DistrictProfile"; public static final String DistrictProfile_entry = "http://www.simantics.org/DistrictNetwork-1.0/DistrictProfile/entry"; public static final String DistrictProfile_entry1 = "http://www.simantics.org/DistrictNetwork-1.0/DistrictProfile/entry1"; + public static final String DistrictProfile_entry2 = "http://www.simantics.org/DistrictNetwork-1.0/DistrictProfile/entry2"; public static final String EPSG_4326 = "http://www.simantics.org/DistrictNetwork-1.0/EPSG_4326"; public static final String Edge = "http://www.simantics.org/DistrictNetwork-1.0/Edge"; public static final String EdgeDefaultMapping = "http://www.simantics.org/DistrictNetwork-1.0/EdgeDefaultMapping"; public static final String EdgeDefaultMapping_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/EdgeDefaultMapping/Inverse"; public static final String EdgeMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/EdgeMappingParameterType"; + public static final String EdgeNodeStyle = "http://www.simantics.org/DistrictNetwork-1.0/EdgeNodeStyle"; public static final String Edge_HasDiameter = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasDiameter"; public static final String Edge_HasDiameter_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasDiameter/Inverse"; public static final String Edge_HasFlowArea = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasFlowArea"; @@ -413,11 +417,13 @@ public class DistrictNetworkResource { DistrictProfile = getResourceOrNull(graph, URIs.DistrictProfile); DistrictProfile_entry = getResourceOrNull(graph, URIs.DistrictProfile_entry); DistrictProfile_entry1 = getResourceOrNull(graph, URIs.DistrictProfile_entry1); + DistrictProfile_entry2 = getResourceOrNull(graph, URIs.DistrictProfile_entry2); EPSG_4326 = getResourceOrNull(graph, URIs.EPSG_4326); Edge = getResourceOrNull(graph, URIs.Edge); EdgeDefaultMapping = getResourceOrNull(graph, URIs.EdgeDefaultMapping); EdgeDefaultMapping_Inverse = getResourceOrNull(graph, URIs.EdgeDefaultMapping_Inverse); EdgeMappingParameterType = getResourceOrNull(graph, URIs.EdgeMappingParameterType); + EdgeNodeStyle = getResourceOrNull(graph, URIs.EdgeNodeStyle); Edge_HasDiameter = getResourceOrNull(graph, URIs.Edge_HasDiameter); Edge_HasDiameter_Inverse = getResourceOrNull(graph, URIs.Edge_HasDiameter_Inverse); Edge_HasFlowArea = getResourceOrNull(graph, URIs.Edge_HasFlowArea); diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java index c2238d8e..0270fea0 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java @@ -1,7 +1,9 @@ package org.simantics.district.network.ui; import java.awt.geom.Rectangle2D; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import org.simantics.databoard.Bindings; import org.simantics.db.Resource; @@ -37,10 +39,16 @@ public class DNEdgeBuilder { } public static Resource create(WriteGraph graph, Resource diagramResource, double[] start, double[] end, double padding) throws DatabaseException { - return create(graph, diagramResource, null, start, end, padding); + Collection vertices = graph.syncRequest(new ObjectsWithType(diagramResource, Layer0.getInstance(graph).ConsistsOf, DistrictNetworkResource.getInstance(graph).Vertex)); + List vv = new ArrayList<>(vertices.size()); + for (Resource vertex : vertices) { + double[] existingCoords = graph.getRelatedValue2(vertex, DiagramResource.getInstance(graph).HasLocation, Bindings.DOUBLE_ARRAY); + vv.add(new ResourceVertex(vertex, existingCoords)); + } + return create(graph, vv, diagramResource, null, start, end, padding); } - public static Resource create(WriteGraph graph, Resource diagramResource, Resource mapping, double[] start, double[] end, double padding) throws DatabaseException { + public static Resource create(WriteGraph graph, Collection vertices, Resource diagramResource, Resource mapping, double[] start, double[] end, double padding) throws DatabaseException { DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); @@ -48,24 +56,23 @@ public class DNEdgeBuilder { Resource edge = getOrCreateEdge(graph, diagramResource, mapping); // 2. Add vertices - Collection vertices = graph.syncRequest(new ObjectsWithType(diagramResource, Layer0.getInstance(graph).ConsistsOf, DistrictNetworkResource.getInstance(graph).Vertex)); - Resource startVertex = getOrCreateVertex(graph, diagramResource, vertices, start, padding); - Resource endVertex = getOrCreateVertex(graph, diagramResource, vertices, end, padding); + Resource startVertex = getOrCreateVertex(graph, diagramResource, vertices, start, padding, null); + Resource endVertex = getOrCreateVertex(graph, diagramResource, vertices, end, padding, startVertex); graph.claim(edge, DN.HasStartVertex, startVertex); graph.claim(edge, DN.HasEndVertex, endVertex); // We need to put GraphLayer to newLayers so... - for (Resource layer : graph.getObjects(diagramResource, DiagramResource.getInstance(graph).HasLayer)) { - IGraphLayerUtil layerUtil = graph.adapt(graph.getSingleObject(layer, Layer0.getInstance(graph).InstanceOf), IGraphLayerUtil.class); - - GraphLayer gl = layerUtil.loadLayer(graph, layer); - gl.forEachTag(tag -> { - DiagramGraphUtil.tag(graph, startVertex, tag, true); - DiagramGraphUtil.tag(graph, endVertex, tag, true); - }); - } - +// for (Resource layer : graph.getObjects(diagramResource, DiagramResource.getInstance(graph).HasLayer)) { +// IGraphLayerUtil layerUtil = graph.adapt(graph.getSingleObject(layer, Layer0.getInstance(graph).InstanceOf), IGraphLayerUtil.class); +// +// GraphLayer gl = layerUtil.loadLayer(graph, layer); +// gl.forEachTag(tag -> { +// DiagramGraphUtil.tag(graph, startVertex, tag, true); +// DiagramGraphUtil.tag(graph, endVertex, tag, true); +// }); +// } +// return edge; } public void create(WriteGraph graph, double[] start, double[] end, double padding) throws DatabaseException { @@ -85,23 +92,24 @@ public class DNEdgeBuilder { glm.putElementOnVisibleLayers(diagram, graph, res); } - private static Resource getOrCreateVertex(WriteGraph graph, Resource diagramResource, Collection vertices, double[] coords, double padding) throws DatabaseException { + private static Resource getOrCreateVertex(WriteGraph graph, Resource diagramResource, Collection vertices, double[] coords, double padding, Resource startVertex) throws DatabaseException { Resource vertex = null; double halfPadding = padding / 2; double maxDistance = Double.MAX_VALUE; - for (Resource vertx : vertices) { - double[] existingCoords = graph.getRelatedValue2(vertx, DiagramResource.getInstance(graph).HasLocation, Bindings.DOUBLE_ARRAY); - Rectangle2D existing = new Rectangle2D.Double(existingCoords[0] - halfPadding, existingCoords[1] - halfPadding, padding, padding); + for (ResourceVertex vertx : vertices) { + Rectangle2D existing = new Rectangle2D.Double(vertx.coords[0] - halfPadding, vertx.coords[1] - halfPadding, padding, padding); Rectangle2D tobecreated = new Rectangle2D.Double(coords[0] - halfPadding, coords[1] - halfPadding, padding, padding); if (existing.intersects(tobecreated)) { - double dist = Math.sqrt((Math.pow(coords[0] - existingCoords[0], 2) + (Math.pow(coords[1] - existingCoords[1], 2)))); - if (dist <= maxDistance) { - vertex = vertx; + double dist = Math.sqrt((Math.pow(coords[0] - vertx.coords[0], 2) + (Math.pow(coords[1] - vertx.coords[1], 2)))); + if (dist <= maxDistance && !vertx.vertex.equals(startVertex)) { + vertex = vertx.vertex; + maxDistance = dist; } } } if (vertex == null) { vertex = DistrictNetworkUtil.createVertex(graph, diagramResource, coords); + vertices.add(new ResourceVertex(vertex, coords)); } return vertex; } @@ -110,4 +118,14 @@ public class DNEdgeBuilder { return DistrictNetworkUtil.createEdge(graph, diagramResource, mapping); } + public static class ResourceVertex { + + final Resource vertex; + final double[] coords; + + public ResourceVertex(Resource vertex, double[] coords) { + this.vertex = vertex; + this.coords = coords; + } + } } diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java index 8187002b..9d07f037 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java @@ -15,6 +15,7 @@ import org.simantics.g2d.participant.BackgroundPainter; import org.simantics.g2d.participant.GridPainter; import org.simantics.g2d.participant.PanZoomRotateHandler; import org.simantics.g2d.participant.RenderingQualityInteractor; +import org.simantics.g2d.participant.ZoomToAreaHandler; import org.simantics.maps.MapScalingTransform; import org.simantics.maps.eclipse.MapPainter; import org.simantics.modeling.ui.diagramEditor.DiagramViewer; @@ -58,4 +59,13 @@ public class DistrictDiagramViewer extends DiagramViewer { ctx.add(new MapRulerPainter()); ctx.add(new BackgroundPainter()); } + + protected void addViewManipulationParticipants(CanvasContext ctx) { + ctx.add(new DistrictPanZoomRotateHandler()); + //ctx.add(new MousePanZoomInteractor()); + //ctx.add(new MultitouchPanZoomRotateInteractor()); + // ctx.add( new OrientationRestorer() ); + ctx.add(new ZoomToAreaHandler()); + } + } diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictPanZoomRotateHandler.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictPanZoomRotateHandler.java new file mode 100644 index 00000000..1a4f83d8 --- /dev/null +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictPanZoomRotateHandler.java @@ -0,0 +1,53 @@ +package org.simantics.district.network.ui; + +import org.simantics.g2d.participant.PanZoomRotateHandler; +import org.simantics.scenegraph.g2d.events.MouseEvent.MouseWheelMovedEvent; +import org.simantics.scenegraph.g2d.nodes.NavigationNode; + +public class DistrictPanZoomRotateHandler extends PanZoomRotateHandler { + + public DistrictPanZoomRotateHandler() { + } + + @Override + protected Class getNavigationNodeClass() { + return DistrictNavigationNode.class; + } + + public static class DistrictNavigationNode extends NavigationNode { + + private static final long serialVersionUID = 5452897272925816875L; + + @Override + public Double getZoomInLimit() { + return super.getZoomInLimit(); + } + + @Override + public Double getZoomOutLimit() { + return super.getZoomOutLimit(); + } + + @Override + public boolean mouseWheelMoved(MouseWheelMovedEvent me) { + if (navigationEnabled && zoomEnabled) { + double scroll = Math.min(0.9, -me.wheelRotation / 20.0); + double z = 1 - scroll; + double dx = (me.controlPosition.getX() - transform.getTranslateX()) / transform.getScaleX(); + double dy = (me.controlPosition.getY() - transform.getTranslateY()) / transform.getScaleY(); + dx = dx * (1 - z); + dy = dy * (1 - z); + double limitedScale = limitScaleFactor(z); + if (limitedScale != 1.0) { + translate(dx, dy); + scale(z, z); + transformChanged(); + dropQuality(); + repaint(); + } + } + return false; + } + + } +} diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkEdgeElementFactory.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkEdgeElementFactory.java index 36d57308..1003a9b2 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkEdgeElementFactory.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkEdgeElementFactory.java @@ -49,7 +49,9 @@ public class DistrictNetworkEdgeElementFactory extends SyncElementFactory { @Override public void load(ReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource edgeResource, IElement element) throws DatabaseException { - + if (!graph.hasStatement(edgeResource)) + return; // already deleted + Resource startVertex = graph.getSingleObject(edgeResource, DN.HasStartVertex); Resource endVertex = graph.getSingleObject(edgeResource, DN.HasEndVertex); diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkVertexElementFactory.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkVertexElementFactory.java index 431beb52..1fc38bf6 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkVertexElementFactory.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkVertexElementFactory.java @@ -45,7 +45,9 @@ public class DistrictNetworkVertexElementFactory extends SyncElementFactory { @Override public void load(ReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource vertexResource, IElement element) throws DatabaseException { - + if (!graph.hasStatement(vertexResource)) + return; // already deleted + double[] coords = graph.getRelatedValue(vertexResource, DIA.HasLocation); DistrictNetworkVertex vertex = new DistrictNetworkVertex(coords); diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java index 745f2a80..03080275 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java @@ -31,6 +31,8 @@ public class DistrictNetworkEdgeNode extends G2DNode { private Color color; + private Double stroke; + @Override public void init() { } @@ -61,7 +63,12 @@ public class DistrictNetworkEdgeNode extends G2DNode { g2d.setColor(color); if (STROKE != null) { if (scaleStroke && STROKE instanceof BasicStroke) { - BasicStroke bs = GeometryUtils.scaleStroke(STROKE, (float) (1.0 / GeometryUtils.getScale(g2d.getTransform()))); + double str; + if (stroke != null) + str = stroke; + else + str = 1.0; + BasicStroke bs = GeometryUtils.scaleStroke(STROKE, (float) (str / GeometryUtils.getScale(g2d.getTransform()))); g2d.setStroke(bs); } else { g2d.setStroke(STROKE); @@ -82,9 +89,9 @@ public class DistrictNetworkEdgeNode extends G2DNode { public static Path2D calculatePath(DistrictNetworkEdge edge) { // Convert to screen coordinates double startX = ModelledCRS.longitudeToX(edge.getStartPoint().getX()); - double startY = ModelledCRS.latitudeToY(edge.getStartPoint().getY()); + double startY = ModelledCRS.latitudeToY(-edge.getStartPoint().getY()); // Invert for Simantics double endX = ModelledCRS.longitudeToX(edge.getEndPoint().getX()); - double endY = ModelledCRS.latitudeToY(edge.getEndPoint().getY()); + double endY = ModelledCRS.latitudeToY(-edge.getEndPoint().getY());// Invert for Simantics // render Path2D path = new Path2D.Double(); @@ -126,4 +133,9 @@ public class DistrictNetworkEdgeNode extends G2DNode { return color; } + @PropertySetter(value = "stroke") + public void setStroke(Double stroke) { + this.stroke = stroke / 100; + } + } diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java index c566981e..99eb3cc1 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java @@ -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; + } } 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 1ccde2c7..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 @@ -166,10 +166,10 @@ public class NetworkDrawingNode extends G2DNode { double scaleY = getTransform().getScaleY(); double scaleX = getTransform().getScaleX(); - double startLat = ModelledCRS.yToLatitude(start.getY() / scaleY); + double startLat = ModelledCRS.yToLatitude(-start.getY() / scaleY); double startLon = ModelledCRS.xToLongitude(start.getX() / scaleX); - double endLat = ModelledCRS.yToLatitude(end.getY() / scaleY); + double endLat = ModelledCRS.yToLatitude(-end.getY() / scaleY); double endLon = ModelledCRS.xToLongitude(end.getX() / scaleX); double[] startCoords = new double[] { startLon, startLat }; diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/participants/DNTranslateMode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/participants/DNTranslateMode.java index fda0fc71..fdc333b2 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/participants/DNTranslateMode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/participants/DNTranslateMode.java @@ -5,8 +5,6 @@ import java.awt.geom.Point2D; import java.util.ArrayList; import java.util.Collection; -import javax.xml.bind.DataBindingException; - import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -55,7 +53,7 @@ public class DNTranslateMode extends TranslateMode { AffineTransform at = ElementUtils.getLocalTransform(e, new AffineTransform()); if (graph.isInstanceOf(res, DN.Vertex)) { - double lat = ModelledCRS.yToLatitude(y + (dy / at.getScaleY())); + double lat = ModelledCRS.yToLatitude(y + (-dy / at.getScaleY())); double lon = ModelledCRS.xToLongitude(x + (dx / at.getScaleX())); // write to db @@ -75,7 +73,7 @@ public class DNTranslateMode extends TranslateMode { CommentMetadata cm = graph.getMetadata(CommentMetadata.class); graph.addMetadata(cm.add("Translated " + transformed.size() + " " + (transformed.size() == 1 ? "element" : "elements") - + " by (" + dx + "," + dy + ") mm.")); + + " by (" + dx + "," + -dy + ") mm.")); } } }); diff --git a/org.simantics.district.network/META-INF/MANIFEST.MF b/org.simantics.district.network/META-INF/MANIFEST.MF index 47d74d8e..2d1fe771 100644 --- a/org.simantics.district.network/META-INF/MANIFEST.MF +++ b/org.simantics.district.network/META-INF/MANIFEST.MF @@ -12,5 +12,6 @@ Require-Bundle: org.simantics.db, org.simantics.db.layer0, org.simantics.district.maps, org.simantics.district.geotools;bundle-version="1.0.0", - org.simantics.diagram + org.simantics.diagram, + org.simantics.scenegraph.profile;bundle-version="1.0.0" Export-Package: org.simantics.district.network diff --git a/org.simantics.district.network/adapters.xml b/org.simantics.district.network/adapters.xml index 590741aa..adb325ce 100644 --- a/org.simantics.district.network/adapters.xml +++ b/org.simantics.district.network/adapters.xml @@ -8,4 +8,15 @@ + + + + + + + + + \ No newline at end of file diff --git a/org.simantics.district.network/scl/Simantics/District.scl b/org.simantics.district.network/scl/Simantics/District.scl index c92cc4cc..6318d755 100644 --- a/org.simantics.district.network/scl/Simantics/District.scl +++ b/org.simantics.district.network/scl/Simantics/District.scl @@ -78,3 +78,8 @@ translateElement elem = do () else () () + +importJava "org.simantics.district.network.DistrictNetworkUtil" where + createVertex :: Resource -> Vector Double -> Resource -> Resource + createEdge :: Resource -> Resource -> Resource + diff --git a/org.simantics.district.network/src/org/simantics/district/network/DistrictNetworkUtil.java b/org.simantics.district.network/src/org/simantics/district/network/DistrictNetworkUtil.java index 165e6e96..40e8fc1d 100644 --- a/org.simantics.district.network/src/org/simantics/district/network/DistrictNetworkUtil.java +++ b/org.simantics.district.network/src/org/simantics/district/network/DistrictNetworkUtil.java @@ -22,7 +22,7 @@ public class DistrictNetworkUtil { public static Resource createEdge(WriteGraph graph, Resource composite) throws DatabaseException { return createEdge(graph, composite, graph.getPossibleObject(composite, DistrictNetworkResource.getInstance(graph).EdgeDefaultMapping)); } - + public static Resource createEdge(WriteGraph graph, Resource composite, Resource mapping) throws DatabaseException { Layer0 L0 = Layer0.getInstance(graph); DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); @@ -39,14 +39,25 @@ public class DistrictNetworkUtil { graph.claim(composite, L0.ConsistsOf, L0.PartOf, edge); claimFreshElementName(graph, composite, edge); + + // We need to put GraphLayer to newLayers so... + for (Resource layer : graph.getObjects(composite, DiagramResource.getInstance(graph).HasLayer)) { + IGraphLayerUtil layerUtil = graph.adapt(graph.getSingleObject(layer, Layer0.getInstance(graph).InstanceOf), IGraphLayerUtil.class); + + GraphLayer gl = layerUtil.loadLayer(graph, layer); + gl.forEachTag(tag -> { + DiagramGraphUtil.tag(graph, edge, tag, true); + }); + } + return edge; } - + public static Resource createVertex(WriteGraph graph, Resource composite, double[] coords) throws DatabaseException { Resource defaultVertexMapping = graph.getPossibleObject(composite, DistrictNetworkResource.getInstance(graph).VertexDefaultMapping); return createVertex(graph, composite, coords, defaultVertexMapping); } - + public static Resource createVertex(WriteGraph graph, Resource composite, double[] coords, Resource mapping) throws DatabaseException { Layer0 L0 = Layer0.getInstance(graph); DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); -- 2.47.1