From: jsimomaa Date: Wed, 22 Aug 2018 20:51:41 +0000 (+0300) Subject: Add address information for district import X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=6d8edd63acbd9122ce1da5a39bf42528ec5b71e3;p=simantics%2Fdistrict.git Add address information for district import gitlab #5 Change-Id: I0bb9bcefa9a7da2cf858e7ee5e3873f62d5cacc5 --- diff --git a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportModel.java b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportModel.java index e2a6b7ee..9d5bd715 100644 --- a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportModel.java +++ b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportModel.java @@ -69,6 +69,7 @@ public class CSVImportModel { private int idIndex = -1; private double edgePadding = 0.0001; // default private int valvePositionIndx = -1; + private int addressIndex; // Third page @@ -473,4 +474,12 @@ public class CSVImportModel { public int getValvePositionIndx() { return valvePositionIndx; } + + public void setAddressIndex(int parseInt) { + this.addressIndex = parseInt; + } + + public int getAddressIndex() { + return addressIndex; + } } 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 76c30d98..ffed0c3a 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 @@ -92,6 +92,7 @@ public class CSVImportWizard extends Wizard implements IImportWizard { int velocityIndex = model.getVelocityIndex(); int flowAreaIndex = model.getFlowAreaIndex(); int nominalPressureLossIndex = model.getNominalPressureLossIndex(); + int addressIndex = model.getAddressIndex(); int startXCoordColumnIndex = model.getStartXCoordIndex(); int startYCoordColumnIndex = model.getStartYCoordIndex(); @@ -198,6 +199,7 @@ public class CSVImportWizard extends Wizard implements IImportWizard { writeValue(graph, row, velocityIndex, vertex, DN.Vertex_HasVelocity); writeValue(graph, row, flowAreaIndex, vertex, DN.Vertex_HasFlowArea); writeValue(graph, row, nominalPressureLossIndex, vertex, DN.Vertex_HasNominalPressureLoss); + writeStringValue(graph, row, addressIndex, vertex, DN.Vertex_HasAddress); } else { String startXCoords = row.get(startXCoordColumnIndex); diff --git a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardPage.java b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardPage.java index 0035f6b7..e5cb3a6a 100644 --- a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardPage.java +++ b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardPage.java @@ -78,6 +78,7 @@ public class CSVImportWizardPage extends WizardPage { private DynamicComboFieldEditor flowAreaSelector; private DynamicComboFieldEditor nominalPressureLossSelector; private DynamicComboFieldEditor valvePositionSelector; + private DynamicComboFieldEditor addressSelector; // For edge import private DynamicComboFieldEditor startXCoordSelector; @@ -639,6 +640,20 @@ public class CSVImportWizardPage extends WizardPage { validatePageComplete(); } }); + addressSelector = new DynamicComboFieldEditor("addressValue", "addressSelector", parent); + addressSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setAddressIndex(Integer.parseInt(addressSelector.getValue())); + validatePageComplete(); + } + }); } private void createEdgeIndexMappingField(Group parent) { @@ -895,6 +910,7 @@ public class CSVImportWizardPage extends WizardPage { velocitySelector.updateCombo(namesAndValues); flowAreaSelector.updateCombo(namesAndValues); nominalPressureLossSelector.updateCombo(namesAndValues); + addressSelector.updateCombo(namesAndValues); } diff --git a/org.simantics.district.network.ontology/graph.tg b/org.simantics.district.network.ontology/graph.tg index 53418330..dcc422bf 100644 Binary files a/org.simantics.district.network.ontology/graph.tg and b/org.simantics.district.network.ontology/graph.tg differ diff --git a/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph b/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph index 5c165085..b7b5d043 100644 --- a/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph +++ b/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph @@ -65,6 +65,11 @@ DN.Vertex.HasElevation -- DN.Mapping.VertexMapping.MaximumHeadMAttribute --> L0.String -- DN.Mapping.VertexMapping.HeatLoadDsAttribute --> L0.String -- DN.Mapping.VertexMapping.AddressAttribute --> L0.String -- DN.Mapping.VertexMapping.MassFlowAttribute --> L0.String -- DN.Mapping.VertexMapping.VolFlowAttribute --> L0.String -- DN.Mapping.VertexMapping.VelocityAttribute --> L0.String - +