From 190aac50ce7ebdc0114140bd9d5928d228bd498c Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Wed, 4 Mar 2020 10:20:23 +0200 Subject: [PATCH] Add support for setting pipeType from CSV import gitlab #80 Change-Id: I4a98493466629697dd535814749d35a708a24a95 --- .../district/imports/CSVImportModel.java | 15 ++++++++++++--- .../district/imports/DistrictImportUtils.java | 6 ++---- .../graph/DistrictNetwork.pgraph | 3 +++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/org.simantics.district.imports/src/org/simantics/district/imports/CSVImportModel.java b/org.simantics.district.imports/src/org/simantics/district/imports/CSVImportModel.java index 1acae8de..ffcf5ae9 100644 --- a/org.simantics.district.imports/src/org/simantics/district/imports/CSVImportModel.java +++ b/org.simantics.district.imports/src/org/simantics/district/imports/CSVImportModel.java @@ -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; + } } diff --git a/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java b/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java index c3ce3dad..836ebd02 100644 --- a/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java +++ b/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java @@ -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(); @@ -456,10 +457,6 @@ public class DistrictImportUtils { // Switch to (longitude, latitude) flipAxes(startCoords); flipAxes(endCoords); - - if ("6993003.00000".equals(idValue)) { - System.err.println("ghere we are!!"); - } Optional oedge = DNEdgeBuilder.create(graph, existingVertices, model.getParentDiagram(), model.getComponentMappings().get(mappingValue), startCoords, startZCoord, endCoords, endZCoord, new double[0], padding, true); if (oedge.isPresent()) { @@ -476,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); } } diff --git a/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph b/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph index 4c1e3382..06c6b048 100644 --- a/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph +++ b/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph @@ -149,6 +149,8 @@ DN.Edge -- 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 -- DN.Mapping.EdgeMapping.KSupplyAttribute --> L0.String -- DN.Mapping.EdgeMapping.TGroundAttribute --> L0.String -- DN.Mapping.EdgeMapping.ElevationAttribute --> L0.String -- DN.Mapping.EdgeMapping.PipeTypeAttribute --> L0.String