]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network/src/org/simantics/district/network/DistrictNetworkUtil.java
Stash for edge styling & import progress monitoring
[simantics/district.git] / org.simantics.district.network / src / org / simantics / district / network / DistrictNetworkUtil.java
index 165e6e96327dd1e655e09bb0997fa024fb2a4b9a..40e8fc1d7825e3f47c877030b64ac3dcd632c9fe 100644 (file)
@@ -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);