]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Add address information for district import 68/2068/1
authorjsimomaa <jani.simomaa@gmail.com>
Wed, 22 Aug 2018 20:51:41 +0000 (23:51 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 31 Aug 2018 12:23:53 +0000 (12:23 +0000)
gitlab #5

Change-Id: I0bb9bcefa9a7da2cf858e7ee5e3873f62d5cacc5
(cherry picked from commit 6d8edd63acbd9122ce1da5a39bf42528ec5b71e3)

org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportModel.java
org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizard.java
org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardPage.java
org.simantics.district.network.ontology/graph.tg
org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph
org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java
org.simantics.district.network/adapters.xml

index e2a6b7eef7a47e83579d011aa124024b2d9a9507..9d5bd715c316b8ef2d6de0fb34251b8f3aee8592 100644 (file)
@@ -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;
+    }
 }
index 76c30d98113adb381a39b1c38c47b80b479ab54b..ffed0c3a14e21da671ab207b7cab185e6b5587f9 100644 (file)
@@ -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);
index 0035f6b7b5d9d2761e09e5d6865793f49483ba3c..e5cb3a6afba8f8ed2df8cab2e53214124f80a759 100644 (file)
@@ -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);   
     }
     
     
index 534183308172fb8f9284eef9f9b3a99df10272e3..dcc422bf507a0062f0c1c4d99bf6df0f6e480e7a 100644 (file)
Binary files a/org.simantics.district.network.ontology/graph.tg and b/org.simantics.district.network.ontology/graph.tg differ
index 5c165085b208adb44946bab9d98043eb83db29b3..b7b5d04363a98ec220d847f4724db592971f86c7 100644 (file)
@@ -65,6 +65,11 @@ DN.Vertex.HasElevation <R L0.HasProperty : SEL.GenericParameterType
     L0.HasLabel "Elevation"
     L0.HasRange L0.Double
     L0.readOnly false
+    
+DN.Vertex.HasAddress <R L0.HasProperty : SEL.GenericParameterType
+    L0.HasLabel "Address"
+    L0.HasRange L0.String
+    L0.readOnly false
 
 DN.Vertex.HasSupplyTemperature <R L0.HasProperty : SEL.GenericParameterType
     L0.HasLabel "Supply Temperature"
@@ -320,6 +325,7 @@ DN.Mapping.VertexMapping <T DN.Mapping.Base
     >-- DN.Mapping.VertexMapping.MaximumHeadMAttribute --> L0.String <R L0.HasProperty
     // Consumers
     >-- DN.Mapping.VertexMapping.HeatLoadDsAttribute --> L0.String <R L0.HasProperty
+    >-- DN.Mapping.VertexMapping.AddressAttribute --> L0.String <R L0.HasProperty
     >-- DN.Mapping.VertexMapping.MassFlowAttribute --> L0.String <R L0.HasProperty
     >-- DN.Mapping.VertexMapping.VolFlowAttribute --> L0.String <R L0.HasProperty
     >-- DN.Mapping.VertexMapping.VelocityAttribute --> L0.String <R L0.HasProperty
index accd2264b9513b016c4b4140541c882999cbd01d..d23f9d0ceaf1014f6cfe2809c7562e996aa452d8 100644 (file)
@@ -113,6 +113,8 @@ public class DistrictNetworkResource {
     public final Resource Mapping_Terminals;
     public final Resource Mapping_Terminals_Inverse;
     public final Resource Mapping_VertexMapping;
+    public final Resource Mapping_VertexMapping_AddressAttribute;
+    public final Resource Mapping_VertexMapping_AddressAttribute_Inverse;
     public final Resource Mapping_VertexMapping_DeltaPressureAttribute;
     public final Resource Mapping_VertexMapping_DeltaPressureAttribute_Inverse;
     public final Resource Mapping_VertexMapping_DeltaTemperatureAttribute;
@@ -163,6 +165,8 @@ public class DistrictNetworkResource {
     public final Resource VertexDefaultMapping;
     public final Resource VertexDefaultMapping_Inverse;
     public final Resource VertexMappingParameterType;
+    public final Resource Vertex_HasAddress;
+    public final Resource Vertex_HasAddress_Inverse;
     public final Resource Vertex_HasDeltaPressure;
     public final Resource Vertex_HasDeltaPressure_Inverse;
     public final Resource Vertex_HasDeltaTemperature;
@@ -306,6 +310,8 @@ public class DistrictNetworkResource {
         public static final String Mapping_Terminals = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Terminals";
         public static final String Mapping_Terminals_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Terminals/Inverse";
         public static final String Mapping_VertexMapping = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping";
+        public static final String Mapping_VertexMapping_AddressAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/AddressAttribute";
+        public static final String Mapping_VertexMapping_AddressAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/AddressAttribute/Inverse";
         public static final String Mapping_VertexMapping_DeltaPressureAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/DeltaPressureAttribute";
         public static final String Mapping_VertexMapping_DeltaPressureAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/DeltaPressureAttribute/Inverse";
         public static final String Mapping_VertexMapping_DeltaTemperatureAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/DeltaTemperatureAttribute";
@@ -356,6 +362,8 @@ public class DistrictNetworkResource {
         public static final String VertexDefaultMapping = "http://www.simantics.org/DistrictNetwork-1.0/VertexDefaultMapping";
         public static final String VertexDefaultMapping_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/VertexDefaultMapping/Inverse";
         public static final String VertexMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/VertexMappingParameterType";
+        public static final String Vertex_HasAddress = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasAddress";
+        public static final String Vertex_HasAddress_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasAddress/Inverse";
         public static final String Vertex_HasDeltaPressure = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasDeltaPressure";
         public static final String Vertex_HasDeltaPressure_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasDeltaPressure/Inverse";
         public static final String Vertex_HasDeltaTemperature = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasDeltaTemperature";
@@ -509,6 +517,8 @@ public class DistrictNetworkResource {
         Mapping_Terminals = getResourceOrNull(graph, URIs.Mapping_Terminals);
         Mapping_Terminals_Inverse = getResourceOrNull(graph, URIs.Mapping_Terminals_Inverse);
         Mapping_VertexMapping = getResourceOrNull(graph, URIs.Mapping_VertexMapping);
+        Mapping_VertexMapping_AddressAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_AddressAttribute);
+        Mapping_VertexMapping_AddressAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_AddressAttribute_Inverse);
         Mapping_VertexMapping_DeltaPressureAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_DeltaPressureAttribute);
         Mapping_VertexMapping_DeltaPressureAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_DeltaPressureAttribute_Inverse);
         Mapping_VertexMapping_DeltaTemperatureAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_DeltaTemperatureAttribute);
@@ -559,6 +569,8 @@ public class DistrictNetworkResource {
         VertexDefaultMapping = getResourceOrNull(graph, URIs.VertexDefaultMapping);
         VertexDefaultMapping_Inverse = getResourceOrNull(graph, URIs.VertexDefaultMapping_Inverse);
         VertexMappingParameterType = getResourceOrNull(graph, URIs.VertexMappingParameterType);
+        Vertex_HasAddress = getResourceOrNull(graph, URIs.Vertex_HasAddress);
+        Vertex_HasAddress_Inverse = getResourceOrNull(graph, URIs.Vertex_HasAddress_Inverse);
         Vertex_HasDeltaPressure = getResourceOrNull(graph, URIs.Vertex_HasDeltaPressure);
         Vertex_HasDeltaPressure_Inverse = getResourceOrNull(graph, URIs.Vertex_HasDeltaPressure_Inverse);
         Vertex_HasDeltaTemperature = getResourceOrNull(graph, URIs.Vertex_HasDeltaTemperature);
index adb325ce1824191055ea263ac1d54a3424a4dd91..03953cf79649ea96dcefda656449f625150e679a 100644 (file)
@@ -8,12 +8,12 @@
                        <this />
                </type>
        </target>
-       <target interface="org.simantics.scenegraph.profile.Group">
+       <!-- <target interface="org.simantics.scenegraph.profile.Group">
                <resource uri="http://www.simantics.org/DistrictNetwork-1.0/EdgeNodeGroup"
                        class="org.simantics.district.network.profile.EdgeNodeGroup">
             <graph/>
                </resource>
-    </target>
+    </target> -->
        <target interface="org.simantics.scenegraph.profile.Style">
                <resource uri="http://www.simantics.org/DistrictNetwork-1.0/EdgeNodeStyle"
                        class="org.simantics.district.network.profile.EdgeNodeStyle">