]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network/src/org/simantics/district/network/DistrictNetworkUtil.java
Add CSV table view for copy/pasting consumer information before creation
[simantics/district.git] / org.simantics.district.network / src / org / simantics / district / network / DistrictNetworkUtil.java
index 24a77575d6d6ed6ac9ba88485bb12c8763efa3f3..bac4707d87cc8fe627e0d24f2604503a2fc6d22d 100644 (file)
@@ -29,11 +29,11 @@ import org.simantics.operation.Layer0X;
 
 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, double[] detailedGeometryCoords) throws DatabaseException {
+        return createEdge(graph, composite, graph.getPossibleObject(composite, DistrictNetworkResource.getInstance(graph).EdgeDefaultMapping), detailedGeometryCoords);
     }
 
-    public static Resource createEdge(WriteGraph graph, Resource composite, Resource mapping) throws DatabaseException {
+    public static Resource createEdge(WriteGraph graph, Resource composite, Resource mapping, double[] detailedGeometryCoords) throws DatabaseException {
         Layer0 L0 = Layer0.getInstance(graph);
         DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
         if (mapping == null) {
@@ -60,21 +60,24 @@ public class DistrictNetworkUtil {
             });
         }
         
+        // add detailed geometry (if any)
+        graph.claimLiteral(edge, DN.Edge_HasGeometry, detailedGeometryCoords, Bindings.DOUBLE_ARRAY);
         return edge;
     }
 
-    public static Resource createVertex(WriteGraph graph, Resource composite, double[] coords) throws DatabaseException {
+    public static Resource createVertex(WriteGraph graph, Resource composite, double[] coords, double elevation) throws DatabaseException {
         Resource defaultVertexMapping = graph.getPossibleObject(composite, DistrictNetworkResource.getInstance(graph).VertexDefaultMapping);
-        return createVertex(graph, composite, coords, defaultVertexMapping);
+        return createVertex(graph, composite, coords, elevation, defaultVertexMapping);
     }
 
-    public static Resource createVertex(WriteGraph graph, Resource composite, double[] coords, Resource mapping) throws DatabaseException {
+    public static Resource createVertex(WriteGraph graph, Resource composite, double[] coords, double elevation, Resource mapping) throws DatabaseException {
         Layer0 L0 = Layer0.getInstance(graph);
         DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
         DiagramResource DIA = DiagramResource.getInstance(graph);
         Resource vertex = graph.newResource();
         graph.claim(vertex, L0.InstanceOf, DN.Vertex);
         graph.claimLiteral(vertex, DIA.HasLocation, coords);
+        graph.claimLiteral(vertex, DN.Vertex_HasElevation, elevation, Bindings.DOUBLE);
         
         graph.claim(vertex, DN.HasMapping, null, mapping);