]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Add support for setting pipeType from CSV import 17/3917/2
authorjsimomaa <jani.simomaa@gmail.com>
Wed, 4 Mar 2020 08:20:23 +0000 (10:20 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 5 Mar 2020 08:51:03 +0000 (08:51 +0000)
gitlab #80

Change-Id: I4a98493466629697dd535814749d35a708a24a95
(cherry picked from commit 190aac50ce7ebdc0114140bd9d5928d228bd498c)

org.simantics.district.imports/src/org/simantics/district/imports/CSVImportModel.java
org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java
org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph

index 1acae8dec90326ce209476499afdb149e072d753..ffcf5ae9263b18f32a0e979e0064b51275d63ccf 100644 (file)
@@ -75,6 +75,7 @@ public class CSVImportModel {
     private int detailedGeometryIndex = -1;
     private int peakPowerIndex = -1;
     private int regionIndex = -1;
+    private int pipeTypeIndex = -1;
     
     // Third page
 
@@ -515,16 +516,24 @@ public class CSVImportModel {
     public void setPeakPowerIndex(int parseInt) {
         this.peakPowerIndex = parseInt;
     }
-    
+
     public int getPeakPowerIndex() {
         return peakPowerIndex;
     }
-    
+
     public int getRegionIndex() {
         return regionIndex;
     }
-    
+
     public void setRegionIndex(int regionIndex) {
         this.regionIndex = regionIndex;
     }
+
+    public int getPipeTypeIndex() {
+        return pipeTypeIndex;
+    }
+
+    public void setPipeTypeIndex(int pipeTypeIndex) {
+        this.pipeTypeIndex = pipeTypeIndex;
+    }
 }
index cad063fd5094fa9d73ad4da5012d65f093c35153..d4acbda8fe7000474ed30582d29a3342f4f95dce 100644 (file)
@@ -379,6 +379,7 @@ public class DistrictImportUtils {
         int lengthIndex = model.getLengthIndex();
         int detailedGeometryIndex = model.getDetailedGeometryIndex();
         int regionIndex = model.getRegionIndex();
+        int pipeTypeIndex = model.getPipeTypeIndex();
         
         int mappingColumn = model.getComponentMappingIndex();
         int idColumn = model.getIdIndex();
@@ -472,6 +473,7 @@ public class DistrictImportUtils {
                                     writeValue(graph, row, edgeFlowAreaIndex, edge, DN.Edge_HasFlowArea);
                                     writeValue(graph, row, lengthIndex, edge, DN.Edge_HasLength);
                                     writeStringValue(graph, row, regionIndex, edge, DN.HasRegion);
+                                    writeStringValue(graph, row, pipeTypeIndex, edge, DN.Edge_HasType);
                                     writeDoubleArrayFromString(graph, row, detailedGeometryIndex, edge, DN.Edge_HasGeometry, actualTransform);
                                 }
                             }
index 4c1e3382778b124e8270f02d1518373d560b114f..06c6b0485a34201c5d1ff4dbb43d018960eb61f4 100644 (file)
@@ -149,6 +149,8 @@ DN.Edge <T DN.Element
         @defProperty "K Supply" L0.Double
     >-- DN.Edge.HasTGround
         @defProperty "T Ground" L0.Double
+    >-- DN.Edge.HasType
+        @defProperty "Pipe Type" L0.String
     @L0.assert DN.Edge.HasDiameter 100.0
     @L0.assert DN.Edge.HasOuterDiameter 125.0
 
@@ -457,6 +459,7 @@ DN.Mapping.EdgeMapping <T DN.Mapping.Base
     >-- DN.Mapping.EdgeMapping.KSupplyAttribute --> L0.String <R L0.HasProperty
     >-- DN.Mapping.EdgeMapping.TGroundAttribute --> L0.String <R L0.HasProperty
     >-- DN.Mapping.EdgeMapping.ElevationAttribute --> L0.String <R L0.HasProperty
+    >-- DN.Mapping.EdgeMapping.PipeTypeAttribute --> L0.String <R L0.HasProperty
 
 // Allowed connection types
 DN.SupplyConnectionType <T STR.ConnectionType