]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Updates to Simantics district CSV import 60/660/1
authorjsimomaa <jani.simomaa@gmail.com>
Thu, 29 Jun 2017 05:00:52 +0000 (08:00 +0300)
committerjsimomaa <jani.simomaa@gmail.com>
Thu, 29 Jun 2017 05:00:52 +0000 (08:00 +0300)
refs #6958

Change-Id: I7310b62f2b456d36c11d01b8c604b4e3e60b8b2a

org.simantics.district.imports.ui/META-INF/MANIFEST.MF
org.simantics.district.imports.ui/icons/database_table.png [new file with mode: 0644]
org.simantics.district.imports.ui/plugin.xml
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.imports/src/org/simantics/district/imports/DistrictImportUtils.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.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java

index b7d0aa63ca049a418af0ad51c96b214db13c73ab..dc0819b8e579afdef66c9ca7ce8352195245bb70 100644 (file)
@@ -16,5 +16,6 @@ Require-Bundle: org.eclipse.ui.ide,
  org.simantics.diagram.ontology,
  org.simantics.modeling.ontology,
  org.simantics.district.network,
- org.simantics.district.network.ontology
+ org.simantics.district.network.ontology,
+ org.simantics.district.maps
 Bundle-ActivationPolicy: lazy
diff --git a/org.simantics.district.imports.ui/icons/database_table.png b/org.simantics.district.imports.ui/icons/database_table.png
new file mode 100644 (file)
index 0000000..693709c
Binary files /dev/null and b/org.simantics.district.imports.ui/icons/database_table.png differ
index fe77b99637cffa49f375e85616ba7d1484c50dd6..338a79d9b8339a4553004f05c52fd60562840c6b 100644 (file)
@@ -1,15 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<?eclipse version="3.4"?>\r
-<plugin>\r
-   <extension\r
-         point="org.eclipse.ui.importWizards">\r
-      <wizard\r
-            class="org.simantics.district.imports.ui.CSVImportWizard"\r
-            id="org.simantics.district.imports.ui.csvimportwizard"\r
-            name="Import CSV data to Simantics District">\r
-         <description>\r
-            Imports CSV data to Simantics District network\r
-         </description>\r
-      </wizard>\r
-   </extension>\r
-</plugin>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.importWizards">
+      <wizard
+            class="org.simantics.district.imports.ui.CSVImportWizard"
+            id="org.simantics.district.imports.ui.csvimportwizard"
+            name="Import CSV data to Simantics District"
+            icon="icons/database_table.png">
+         <description>
+            Imports CSV data to Simantics District network
+         </description>
+      </wizard>
+   </extension>
+</plugin>
index 53de5cfe27714ad2be556b34b065a564174a7bfe..2f13692bd0af5f49dcc3f8289084c3bccc551a69 100644 (file)
@@ -20,9 +20,9 @@ public class CSVImportModel {
     
     // Second page fills these
     private char delimiter;
-    private boolean read;
+    private boolean readFirstAsHeader = true;
     private Map<String, Character> delimiters;
-    private Path wktFile;
+//    private Path wktFile;
     
     // Vertex import
     private int xCoordIndex = -1;
@@ -41,6 +41,12 @@ public class CSVImportModel {
     private int componentMappingIndex = -1;
     private Map<String, Resource> componentMappings = new HashMap<>();
     private boolean isVertexImport;
+    private String sourceCRS;
+    private int tempIndex;
+    private int pressureIndex;
+    private int diameterIndex;
+    private int outerDiamterIndex;
+    private int nominalMassFlowIndex;
     
     // Third page
 
@@ -57,7 +63,7 @@ public class CSVImportModel {
     }
 
     public void setReadFirstAsHeader(boolean read) {
-        this.read = read;
+        this.readFirstAsHeader = read;
     }
 
     public Path getSource() {
@@ -73,7 +79,7 @@ public class CSVImportModel {
     
     public Map<CSVHeader, List<String>> getHeaderAndRows(int amount) throws IOException {
         if (source != null)
-            return DistrictImportUtils.readCSVHeaderAndRows(source, delimiter, read, amount);
+            return DistrictImportUtils.readCSVHeaderAndRows(source, delimiter, readFirstAsHeader, amount);
         else
             return Collections.emptyMap();
     }
@@ -81,14 +87,14 @@ public class CSVImportModel {
     public Map<String, Integer> getHeader() throws IOException {
         Map<String, Integer> header = null;
         if (source != null)
-            header = DistrictImportUtils.readCSVHeader(source, delimiter, read);
+            header = DistrictImportUtils.readCSVHeader(source, delimiter, readFirstAsHeader);
         if (header == null)
             header = Collections.emptyMap();
         return header;
     }
 
     public boolean getReadFirstAsHeader() {
-        return read;
+        return readFirstAsHeader;
     }
 
     public String[] getDelimiterFormats() {
@@ -101,7 +107,7 @@ public class CSVImportModel {
 
     public List<Map<String, String>> readRows(int amount) throws IOException {
         if (source != null)
-            return DistrictImportUtils.readRows(source, delimiter, read, amount);
+            return DistrictImportUtils.readRows(source, delimiter, readFirstAsHeader, amount);
         else
             return Collections.emptyList();
     }
@@ -110,9 +116,9 @@ public class CSVImportModel {
         return delimiter;
     }
 
-    public Path getWKTFile() {
-        return wktFile;
-    }
+//    public Path getWKTFile() {
+//        return wktFile;
+//    }
 
     public int getXCoordIndex() {
         return xCoordIndex;
@@ -154,9 +160,9 @@ public class CSVImportModel {
         return targetDiagram;
     }
 
-    public void setWKTFile(Path wktFile) {
-        this.wktFile = wktFile;
-    }
+//    public void setWKTFile(Path wktFile) {
+//        this.wktFile = wktFile;
+//    }
 
     public void setComponentMappings(String value, Resource resource) {
         componentMappings.put(value, resource);
@@ -222,4 +228,52 @@ public class CSVImportModel {
         return endZCoordIndex;
     }
 
+    public void setSourceCRS(String crs) {
+        this.sourceCRS = crs;
+    }
+
+    public String getSourceCRS() {
+        return sourceCRS;
+    }
+
+    public void setTempIndex(int tempIndex) {
+        this.tempIndex = tempIndex;
+    }
+    
+    public int getTempIndex() {
+        return tempIndex;
+    }
+
+    public void setPressureIndex(int pressureIndex) {
+        this.pressureIndex = pressureIndex;
+    }
+
+    public int getPressureIndex() {
+        return pressureIndex;
+    }
+
+    public void setDiameterIndex(int parseInt) {
+        this.diameterIndex = parseInt;
+    }
+    
+    public int getDiameterIndex() {
+        return diameterIndex;
+    }
+
+    public void setOuterDiameterIndex(int parseInt) {
+        this.outerDiamterIndex = parseInt;
+    }
+    
+    public int getOuterDiamterIndex() {
+        return outerDiamterIndex;
+    }
+
+    public void setNominalMassFlowIndex(int parseInt) {
+        this.nominalMassFlowIndex = parseInt;
+    }
+    
+    public int getNominalMassFlowIndex() {
+        return nominalMassFlowIndex;
+    }
+
 }
index 58fd168c8db9f94517a8a2770e1b2f161ea560a7..703ade176923886f2691d9fe47d034d9f5ef33b7 100644 (file)
@@ -1,19 +1,21 @@
 package org.simantics.district.imports.ui;
 
-import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
 import java.nio.file.Path;
 import java.util.List;
 
 import org.apache.commons.csv.CSVRecord;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.ui.IImportWizard;
 import org.eclipse.ui.IWorkbench;
 import org.geotools.geometry.DirectPosition2D;
 import org.geotools.referencing.CRS;
 import org.opengis.geometry.DirectPosition;
 import org.opengis.geometry.MismatchedDimensionException;
-import org.opengis.referencing.FactoryException;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.TransformException;
@@ -27,6 +29,8 @@ import org.simantics.district.imports.DistrictImportUtils;
 import org.simantics.district.network.DistrictNetworkUtil;
 import org.simantics.district.network.ontology.DistrictNetworkResource;
 import org.simantics.district.network.ui.DNEdgeBuilder;
+import org.simantics.maps.MapScalingTransform;
+import org.simantics.utils.ui.ExceptionUtils;
 
 public class CSVImportWizard extends Wizard implements IImportWizard {
 
@@ -48,100 +52,191 @@ public class CSVImportWizard extends Wizard implements IImportWizard {
     @Override
     public boolean performFinish() {
         try {
-            
-            
-            Path csvFile = model.getSource();
-            char delim = model.getDelimiter();
-            
-            List<CSVRecord> rows = DistrictImportUtils.readRows(csvFile, delim, -1);
-            
-            Path wktFile = model.getWKTFile();
-            
-            int xCoordColumnIndex = model.getXCoordIndex();
-            int yCoordColumnIndex = model.getYCoordIndex();
-            int zCoordColumnIndex = model.getZCoordIndex();
-            
-            int startXCoordColumnIndex = model.getStartXCoordIndex();
-            int startYCoordColumnIndex = model.getStartYCoordIndex();
-            int startZValueColumnIndex = model.getStartZCoordIndex();
-            int endXCoordColumnIndex = model.getEndXCoordIndex();
-            int endYCoordColumnIndex = model.getEndYCoordIndex();
-            int endZValueColumnIndex = model.getEndZCoordIndex();
-            
-            int mappingColumn = model.getComponentMappingIndex();
-            
-            try {
-                CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:3879");
-                CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
-                MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS, true);
-                
-                Simantics.getSession().syncRequest(new Write() {
-                    
-                    @Override
-                    public void perform(WriteGraph graph) throws DatabaseException {
-                        for (int k = 1; k < rows.size(); k++) {
-                            CSVRecord row = rows.get(k);
-                            
-                            String mappingValue = row.get(mappingColumn);
+            getContainer().run(true, true, new IRunnableWithProgress() {
 
-                            try {
-                                if (model.isVertexImport()) {
-                                    String xCoords = row.get(xCoordColumnIndex);
-                                    String yCoords = row.get(yCoordColumnIndex);
-                                    double xCoord = Double.parseDouble(xCoords);
-                                    double yCoord = Double.parseDouble(yCoords);
-                                    
-                                    String zs = row.get(zCoordColumnIndex);
-                                    double z = Double.parseDouble(zs);
-                                    
-                                    DirectPosition2D targetPos = new DirectPosition2D();
-                                    DirectPosition2D sourcePos = new DirectPosition2D(xCoord, yCoord);
-                                    DirectPosition res = transform.transform(sourcePos, targetPos);
-                                    double[] coords = res.getCoordinate();
-                                    Resource vertex = DistrictNetworkUtil.createVertex(graph, model.getParentDiagram(), new double[] { coords[1], -coords[0]}, model.getComponentMappings().get(mappingValue));
-                                    graph.claimLiteral(vertex, DistrictNetworkResource.getInstance(graph).Vertex_HasElevation, z, Bindings.DOUBLE);
-                                } else {
-                                    String startXCoords = row.get(startXCoordColumnIndex);
-                                    String startYCoords = row.get(startYCoordColumnIndex);
-                                    String endXCoords = row.get(endXCoordColumnIndex);
-                                    String endYCoords = row.get(endYCoordColumnIndex);
-                                    
-                                    double startXCoord = Double.parseDouble(startXCoords);
-                                    double startYCoord = Double.parseDouble(startYCoords);
-                                    
-                                    double endXCoord = Double.parseDouble(endXCoords);
-                                    double endYCoord = Double.parseDouble(endYCoords);
-                                    
-                                    DirectPosition2D startTargetPos = new DirectPosition2D();
-                                    DirectPosition2D startSourcePos = new DirectPosition2D(startXCoord, startYCoord);
-                                    DirectPosition startRes = transform.transform(startSourcePos, startTargetPos);
-                                    double[] startCoords = startRes.getCoordinate();
-                                    
-                                    DirectPosition2D endTargetPos = new DirectPosition2D();
-                                    DirectPosition2D endSourcePos = new DirectPosition2D(endXCoord, endYCoord);
-                                    DirectPosition endRes = transform.transform(endSourcePos, endTargetPos);
-                                    double[] endCoords = endRes.getCoordinate();
+                @Override
+                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+                    try {
+                        Path csvFile = model.getSource();
+                        char delim = model.getDelimiter();
+                        
+                        List<CSVRecord> rows = DistrictImportUtils.readRows(csvFile, delim, -1);
+                        
+    //                    Path wktFile = model.getWKTFile();
+                        
+                        int xCoordColumnIndex = model.getXCoordIndex();
+                        int yCoordColumnIndex = model.getYCoordIndex();
+                        int zCoordColumnIndex = model.getZCoordIndex();
+                        int tempColumnIndex = model.getTempIndex();
+                        int pressureColumnIndex = model.getPressureIndex();
+                        
+                        int startXCoordColumnIndex = model.getStartXCoordIndex();
+                        int startYCoordColumnIndex = model.getStartYCoordIndex();
+                        int startZValueColumnIndex = model.getStartZCoordIndex();
+                        int endXCoordColumnIndex = model.getEndXCoordIndex();
+                        int endYCoordColumnIndex = model.getEndYCoordIndex();
+                        int endZValueColumnIndex = model.getEndZCoordIndex();
+                        int diameterColumnIndex= model.getDiameterIndex();
+                        int outerDiameterColumnIndex = model.getOuterDiamterIndex();
+                        int nominalMassFlowIndex = model.getNominalMassFlowIndex();
+                        
+                        int mappingColumn = model.getComponentMappingIndex();
+                        
+                        String sourceEPSGCRS = model.getSourceCRS();
+                        
+                        MathTransform transform = null;
+                        boolean doTransform = false;
+                        // if sourceEPSGCRS is empty || null then ignore transformation
+                        if (sourceEPSGCRS != null && !sourceEPSGCRS.isEmpty()) {
+                            CoordinateReferenceSystem sourceCRS = CRS.decode(sourceEPSGCRS);
+                            CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
+                            transform = CRS.findMathTransform(sourceCRS, targetCRS, true);
+                            doTransform = true;
+                        }
+                        final boolean actualDoTransform = doTransform;
+                        final MathTransform actualTransform = transform;
+                        Simantics.getSession().syncRequest(new Write() {
+                            
+                            @Override
+                            public void perform(WriteGraph graph) throws DatabaseException {
+                                
+                                DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+                                
+                                for (int k = 1; k < rows.size(); k++) {
+                                    CSVRecord row = rows.get(k);
                                     
-                                    Resource edge = DNEdgeBuilder.create(graph, model.getParentDiagram(), new double[] { startCoords[1], -startCoords[0]}, new double[] { endCoords[1], -endCoords[0]}, 0.0000001);
-                                    graph.claim(edge, DistrictNetworkResource.getInstance(graph).HasMapping, model.getComponentMappings().get(mappingValue));
-//                                    graph.claimLiteral(edge, DistrictNetworkResource.getInstance(graph).Edge_HasDiameter, value);
+                                    String mappingValue = row.get(mappingColumn);
+    
+                                    try {
+                                        if (model.isVertexImport()) {
+                                            String xCoords = row.get(xCoordColumnIndex);
+                                            String yCoords = row.get(yCoordColumnIndex);
+                                            double xCoord = Double.parseDouble(xCoords);
+                                            double yCoord = Double.parseDouble(yCoords);
+                                            
+                                            String zs = row.get(zCoordColumnIndex);
+                                            double z = 0;
+                                            if (!zs.isEmpty()) {
+                                                try {
+                                                    z = Double.parseDouble(zs);
+                                                } catch (NumberFormatException e) {
+                                                    throw new DatabaseException(e);
+                                                }
+                                            }
+
+                                            double[] coords;
+                                            if (actualDoTransform) {
+                                                DirectPosition2D targetPos = new DirectPosition2D();
+                                                DirectPosition2D sourcePos = new DirectPosition2D(xCoord, yCoord);
+                                                DirectPosition res = actualTransform.transform(sourcePos, targetPos);
+                                                coords = res.getCoordinate();
+                                            } else {
+                                                coords = new double[] { xCoord / MapScalingTransform.getScaleX(), yCoord / MapScalingTransform.getScaleY() };
+                                            }
+                                            Resource vertex = DistrictNetworkUtil.createVertex(graph, model.getParentDiagram(), new double[] { coords[1], -coords[0]}, model.getComponentMappings().get(mappingValue));
+                                            
+                                            graph.claimLiteral(vertex, DN.Vertex_HasElevation, z, Bindings.DOUBLE);
+                                            
+                                            String tempS = row.get(tempColumnIndex);
+                                            if (!tempS.isEmpty()) {
+                                                try {
+                                                    double temp = Double.parseDouble(tempS);
+                                                    graph.claimLiteral(vertex, DN.Vertex_HasTemperature, temp, Bindings.DOUBLE);
+                                                } catch (NumberFormatException e) {
+                                                    throw new DatabaseException(e);
+                                                }
+                                            }
+                                            String pressureS = row.get(pressureColumnIndex);
+                                            if (!pressureS.isEmpty()) {
+                                                try {
+                                                    double pressure = Double.parseDouble(pressureS);
+                                                    graph.claimLiteral(vertex, DN.Vertex_HasPressure, pressure, Bindings.DOUBLE);
+                                                } catch (NumberFormatException e) {
+                                                    throw new DatabaseException(e);
+                                                }
+                                            }
+
+                                        } else {
+                                            String startXCoords = row.get(startXCoordColumnIndex);
+                                            String startYCoords = row.get(startYCoordColumnIndex);
+                                            String endXCoords = row.get(endXCoordColumnIndex);
+                                            String endYCoords = row.get(endYCoordColumnIndex);
+                                            
+                                            double startXCoord = Double.parseDouble(startXCoords);
+                                            double startYCoord = Double.parseDouble(startYCoords);
+                                            
+                                            double endXCoord = Double.parseDouble(endXCoords);
+                                            double endYCoord = Double.parseDouble(endYCoords);
+                                            
+                                            double[] startCoords;
+                                            double[] endCoords;
+                                            if (actualDoTransform) {
+                                                DirectPosition2D startTargetPos = new DirectPosition2D();
+                                                DirectPosition2D startSourcePos = new DirectPosition2D(startXCoord, startYCoord);
+                                                DirectPosition startRes = actualTransform.transform(startSourcePos, startTargetPos);
+                                                startCoords = startRes.getCoordinate();
+                                                
+                                                DirectPosition2D endTargetPos = new DirectPosition2D();
+                                                DirectPosition2D endSourcePos = new DirectPosition2D(endXCoord, endYCoord);
+                                                DirectPosition endRes = actualTransform.transform(endSourcePos, endTargetPos);
+                                                endCoords = endRes.getCoordinate();
+                                            } else {
+                                                startCoords = new double[] { startXCoord / MapScalingTransform.getScaleX(), startYCoord / MapScalingTransform.getScaleY() };
+                                                endCoords = new double[] { endXCoord / MapScalingTransform.getScaleX(), endYCoord / MapScalingTransform.getScaleY() };
+                                            }
+                                            
+                                            Resource edge = DNEdgeBuilder.create(graph, model.getParentDiagram(), new double[] { startCoords[1], -startCoords[0]}, new double[] { endCoords[1], -endCoords[0]}, 0.0000001);
+                                            graph.claim(edge, DistrictNetworkResource.getInstance(graph).HasMapping, model.getComponentMappings().get(mappingValue));
+                                            
+                                            String diameterS = row.get(diameterColumnIndex);
+                                            if (!diameterS.isEmpty()) {
+                                                try {
+                                                    double diameter = Double.parseDouble(diameterS);
+                                                    graph.claimLiteral(edge, DN.Edge_HasDiameter, diameter);
+                                                } catch (NumberFormatException e) {
+                                                    throw new DatabaseException(e);
+                                                }
+                                            }
+                                            String outerDiameterS = row.get(outerDiameterColumnIndex);
+                                            if (!outerDiameterS.isEmpty()) {
+                                                try {
+                                                    double outerDiameter = Double.parseDouble(outerDiameterS);
+                                                    graph.claimLiteral(edge, DN.Edge_HasOuterDiameter, outerDiameter);
+                                                } catch (NumberFormatException e) {
+                                                    throw new DatabaseException(e);
+                                                }
+                                            }
+                                            String nominalMassFlowS = row.get(nominalMassFlowIndex);
+                                            if (!nominalMassFlowS.isEmpty()) {
+                                                try {
+                                                    double nominalMassFlow = Double.parseDouble(nominalMassFlowS);
+                                                    graph.claimLiteral(edge, DN.Edge_HasNominalMassFlow, nominalMassFlow);
+                                                } catch (NumberFormatException e) {
+                                                    throw new DatabaseException(e);
+                                                }
+                                            }
+                                        }
+                                    } catch (MismatchedDimensionException | TransformException | DatabaseException e) {
+                                        throw new DatabaseException(e);
+                                    }
                                 }
-                            } catch (MismatchedDimensionException | TransformException | DatabaseException e) {
-                                e.printStackTrace();
                             }
-                            
-                        }
+                        });
+                    } catch (Exception e) {
+                        throw new InvocationTargetException(e);
                     }
-                });
-                return true;
-            } catch (FactoryException | DatabaseException e) {
-                e.printStackTrace();
-            }
-            
-        } catch (IOException e) {
-            e.printStackTrace();
+                }
+            });
+            return true;
+        } catch (InvocationTargetException e) {
+            Throwable t = e.getTargetException();
+            WizardPage cp = (WizardPage) getContainer().getCurrentPage();
+            cp.setErrorMessage(t.getMessage());
+            ExceptionUtils.logAndShowError(t);
+            return false;
+        } catch (InterruptedException e) {
+            ExceptionUtils.logAndShowError(e);
+            return false;
         }
-        return false;
     }
-
 }
index 9d1d08c422c1627480beb0ae1a71ee4117509b68..e1b81e0f10df3b6fad4729d26e77754c0460dd06 100644 (file)
@@ -1,13 +1,11 @@
 package org.simantics.district.imports.ui;
 
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Set;
 
 import org.apache.commons.csv.CSVRecord;
 import org.eclipse.jface.dialogs.IPageChangeProvider;
@@ -19,6 +17,7 @@ import org.eclipse.jface.viewers.ColumnWeightData;
 import org.eclipse.jface.wizard.IWizardContainer;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.GridLayout;
@@ -26,13 +25,12 @@ import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
+import org.geotools.referencing.CRS;
 import org.simantics.district.imports.ui.controls.DynamicComboFieldEditor;
-import org.simantics.utils.ui.widgets.FileOrDirectorySelectionWidget;
-import org.simantics.utils.ui.widgets.FileSelectionListener;
-import org.simantics.utils.ui.widgets.FileSelectionWidget;
 
 public class CSVImportWizardPage extends WizardPage {
 
@@ -41,12 +39,12 @@ public class CSVImportWizardPage extends WizardPage {
     private Map<Integer, String> headerIndexAndValues = new HashMap<>();
 
     private Table headerTable;
-    private Button firstAsHeader;
+//    private Button firstAsHeader;
 
     private Combo delimiterCombo;
     private TableColumnLayout tableColumnLayout;
     private Composite tableComposite;
-    private FileSelectionWidget wktFileSelection;
+//    private FileSelectionWidget wktFileSelection;
 
     // Common for vertex and edge
     private DynamicComboFieldEditor componentMappingSelector;
@@ -64,17 +62,25 @@ public class CSVImportWizardPage extends WizardPage {
     private DynamicComboFieldEditor endXCoordSelector;
     private DynamicComboFieldEditor endYCoordSelector;
     private DynamicComboFieldEditor endZValueSelector;
+    private DynamicComboFieldEditor tempValueSelector;
+    private DynamicComboFieldEditor pressureValueSelector;
+    
+    private DynamicComboFieldEditor outerDiameterSelector;
+    private DynamicComboFieldEditor diameterSelector;
+    private DynamicComboFieldEditor nominalMassFlowSelector;
 
     private Group indexMappingGroup;
 
     private Composite composite;
 
     private Button isVertexImport;
+
+    private Combo sourceCRSCombo;
     
     protected CSVImportWizardPage(CSVImportModel model) {
         super("Import CSV Data");
         this.model = model;
-        setMessage("Select columng index mappings");
+        setMessage("Select column index mappings");
     }
 
     @Override
@@ -83,7 +89,11 @@ public class CSVImportWizardPage extends WizardPage {
         composite.setLayout(new GridLayout(1, false));
         GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(composite);
 
+        Label label = new Label(composite, SWT.NONE);
+        label.setText("Select delimiter");
+        
         delimiterCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
+        delimiterCombo.setToolTipText("Select the delimiter that is used to separate elements in the CSV file");
         delimiterCombo.setItems(model.getDelimiterFormats());
         delimiterCombo.addSelectionListener(new SelectionListener() {
 
@@ -100,48 +110,65 @@ public class CSVImportWizardPage extends WizardPage {
             }
         });
 
-        firstAsHeader = new Button(composite, SWT.CHECK);
-        firstAsHeader.setText("Read first row as header");
-        firstAsHeader.setSelection(model.getReadFirstAsHeader());
-        firstAsHeader.addSelectionListener(new SelectionListener() {
-
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                model.setReadFirstAsHeader(firstAsHeader.getSelection());
-                updateHeaders();
-                updateCombos();
-            }
-
-            @Override
-            public void widgetDefaultSelected(SelectionEvent e) {
-
-            }
-        });
+//        firstAsHeader = new Button(composite, SWT.CHECK);
+//        firstAsHeader.setText("Read first row as header");
+//        firstAsHeader.setSelection(model.getReadFirstAsHeader());
+//        firstAsHeader.addSelectionListener(new SelectionListener() {
+//
+//            @Override
+//            public void widgetSelected(SelectionEvent e) {
+//                model.setReadFirstAsHeader(firstAsHeader.getSelection());
+//                updateHeaders();
+//                updateCombos();
+//            }
+//
+//            @Override
+//            public void widgetDefaultSelected(SelectionEvent e) {
+//                widgetSelected(e);
+//            }
+//        });
 
         tableComposite = new Composite(composite, SWT.BORDER);
         tableColumnLayout = new TableColumnLayout();
         tableComposite.setLayout(tableColumnLayout);
 
-        wktFileSelection = new FileSelectionWidget(composite, "WKT file", SWT.OPEN);
-        wktFileSelection.addListener(new FileSelectionListener() {
-
+        label = new Label(composite, SWT.NONE);
+        label.setText("Select source Coordinate Reference System");
+        
+        sourceCRSCombo = new Combo(composite, SWT.NONE);
+        sourceCRSCombo.setToolTipText("Select the coordinate reference system that is used in the source material for possible transformation to target coordinate reference system (EPSG:4326)");
+        Set<String> codes = CRS.getSupportedCodes("EPSG");
+        sourceCRSCombo.setItems(codes.toArray(new String[codes.size()]));
+        sourceCRSCombo.addSelectionListener(new SelectionAdapter() {
+            
             @Override
-            public void fileSelected(FileOrDirectorySelectionWidget source, String[] filename) {
-                String[] selection = wktFileSelection.getFilename();
-                if (selection != null && selection.length > 0) {
-                    Path wktFile = Paths.get(selection[0]);
-                    if (!Files.exists(wktFile)) {
-                        setErrorMessage("File " + wktFile.toAbsolutePath() + " does not exist");
-                    } else {
-                        model.setWKTFile(wktFile);
-                        validatePageComplete();
-                    }
-                }
+            public void widgetSelected(SelectionEvent e) {
+                String current = sourceCRSCombo.getItem(sourceCRSCombo.getSelectionIndex());
+                model.setSourceCRS("EPSG:" + current);
             }
         });
+        
+//        wktFileSelection = new FileSelectionWidget(composite, "WKT file", SWT.OPEN);
+//        wktFileSelection.addListener(new FileSelectionListener() {
+//
+//            @Override
+//            public void fileSelected(FileOrDirectorySelectionWidget source, String[] filename) {
+//                String[] selection = wktFileSelection.getFilename();
+//                if (selection != null && selection.length > 0) {
+//                    Path wktFile = Paths.get(selection[0]);
+//                    if (!Files.exists(wktFile)) {
+//                        setErrorMessage("File " + wktFile.toAbsolutePath() + " does not exist");
+//                    } else {
+//                        model.setWKTFile(wktFile);
+//                        validatePageComplete();
+//                    }
+//                }
+//            }
+//        });
 
         isVertexImport = new Button(composite, SWT.CHECK);
         isVertexImport.setText("File contains vertices");
+        isVertexImport.setToolTipText("Enable this if the file contains vertices, i.e. points");
         isVertexImport.setSelection(model.isVertexImport());
         isVertexImport.addSelectionListener(new SelectionListener() {
 
@@ -263,6 +290,34 @@ public class CSVImportWizardPage extends WizardPage {
                 validatePageComplete();
             }
         });
+        tempValueSelector = new DynamicComboFieldEditor("tempValue", "Temperature value", parent);
+        tempValueSelector.addComboListener(new SelectionListener() {
+
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                widgetDefaultSelected(e);
+            }
+
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+                model.setTempIndex(Integer.parseInt(tempValueSelector.getValue()));
+                validatePageComplete();
+            }
+        });
+        pressureValueSelector = new DynamicComboFieldEditor("pressureValue", "Pressure value", parent);
+        pressureValueSelector.addComboListener(new SelectionListener() {
+
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                widgetDefaultSelected(e);
+            }
+
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+                model.setPressureIndex(Integer.parseInt(pressureValueSelector.getValue()));
+                validatePageComplete();
+            }
+        });
     }
 
     private void createEdgeIndexMappingField(Group parent) {
@@ -353,6 +408,48 @@ public class CSVImportWizardPage extends WizardPage {
                 validatePageComplete();
             }
         });
+        diameterSelector = new DynamicComboFieldEditor("diameterValue", "Diameter value", parent);
+        diameterSelector.addComboListener(new SelectionListener() {
+
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                widgetDefaultSelected(e);
+            }
+
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+                model.setDiameterIndex(Integer.parseInt(diameterSelector.getValue()));
+                validatePageComplete();
+            }
+        });
+        outerDiameterSelector = new DynamicComboFieldEditor("outerDiameterValue", "Outer Diameter value", parent);
+        outerDiameterSelector.addComboListener(new SelectionListener() {
+
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                widgetDefaultSelected(e);
+            }
+
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+                model.setOuterDiameterIndex(Integer.parseInt(outerDiameterSelector.getValue()));
+                validatePageComplete();
+            }
+        });
+        nominalMassFlowSelector = new DynamicComboFieldEditor("nominalMassFlowValue", "Nominal Mass Flow", parent);
+        nominalMassFlowSelector.addComboListener(new SelectionListener() {
+
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                widgetDefaultSelected(e);
+            }
+
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+                model.setNominalMassFlowIndex(Integer.parseInt(nominalMassFlowSelector.getValue()));
+                validatePageComplete();
+            }
+        });
     }
 
     private void updateCombos() {
@@ -370,7 +467,7 @@ public class CSVImportWizardPage extends WizardPage {
         }
 
         if (model.isVertexImport())
-            updateVertexcombos(namesAndValues);
+            updateVertexCombos(namesAndValues);
         else
             updateEdgeCombos(namesAndValues);
 
@@ -384,12 +481,17 @@ public class CSVImportWizardPage extends WizardPage {
         endYCoordSelector.updateCombo(namesAndValues);
         startZValueSelector.updateCombo(namesAndValues);
         endZValueSelector.updateCombo(namesAndValues);
+        diameterSelector.updateCombo(namesAndValues);
+        outerDiameterSelector.updateCombo(namesAndValues);
+        nominalMassFlowSelector.updateCombo(namesAndValues);
     }
 
-    private void updateVertexcombos(String[][] namesAndValues) {
+    private void updateVertexCombos(String[][] namesAndValues) {
         xCoordSelector.updateCombo(namesAndValues);
         yCoordSelector.updateCombo(namesAndValues);
         zValueSelector.updateCombo(namesAndValues);
+        pressureValueSelector.updateCombo(namesAndValues);
+        tempValueSelector.updateCombo(namesAndValues);
     }
 
     private void updateHeaders() {
index 100c307e35d67e46e5296038eb05b26a786b2e7f..f123855dfc47e32be31d2268a05e6d3401ca33f4 100644 (file)
@@ -44,8 +44,8 @@ public class DistrictImportUtils {
 
     public static Map<String, Character> getSupportedCSVDelimiterFormats() {
         Map<String, Character> delimiters = new HashMap<>();
-        delimiters.put("COMMA", ',');
-        delimiters.put("SEMICOMMA", ';');
+        delimiters.put("Comma", ',');
+        delimiters.put("Semicolon", ';');
         return delimiters;
     }
 
index e6067186e4cfb139dea3895d189160900103c90a..697cf7dd24abb53608cd3a6ba6504bfc0c77a480 100644 (file)
Binary files a/org.simantics.district.network.ontology/graph.tg and b/org.simantics.district.network.ontology/graph.tg differ
index 63c5f1cc0e771c0f66cf5f7415dc1f1941af6643..e819f445fb714a6e708e1dff5cb511bff56d62ec 100644 (file)
@@ -65,11 +65,27 @@ DN.Vertex.HasElevation <R L0.HasProperty : SEL.GenericParameterType
     L0.HasRange L0.Double
     L0.readOnly false
 
+DN.Vertex.HasTemperature <R L0.HasProperty : SEL.GenericParameterType
+    L0.HasLabel "Temperature"
+    L0.HasRange L0.Double
+    L0.readOnly false
+
+DN.Vertex.HasPressure <R L0.HasProperty : SEL.GenericParameterType
+    L0.HasLabel "Pressure"
+    L0.HasRange L0.Double
+    L0.readOnly false
+
 DN.Edge.HasOuterDiameter <R L0.HasProperty : SEL.GenericParameterType
     L0.HasLabel "Outer Diameter"
     L0.HasRange L0.Double
     L0.readOnly false
 
+DN.Edge.HasNominalMassFlow <R L0.HasProperty : SEL.GenericParameterType
+    L0.HasLabel "Nominal Mass Flow"
+    L0.HasRange L0.Double
+    L0.readOnly false
+
+
 DN.InLayer
     @L0.defTag 
     @L0.tag L0.Abstract
@@ -175,10 +191,14 @@ DN.Mapping.TerminalPair <T L0.Entity
 DN.Mapping.VertexMapping <T DN.Mapping.Base
     >-- DN.Mapping.ComponentType --> STR.ComponentType <R L0.DependsOn
     >-- DN.Mapping.VertexMapping.ElevationAttribute --> L0.String <R L0.HasProperty
+    >-- DN.Mapping.VertexMapping.TemperatureAttribute --> L0.String <R L0.HasProperty
+    >-- DN.Mapping.VertexMapping.PressureAttribute --> L0.String <R L0.HasProperty
     >-- DN.Mapping.Terminals --> DN.Mapping.TerminalPair <R L0.HasProperty
 
 DN.Mapping.EdgeMapping <T DN.Mapping.Base
     >-- DN.Mapping.ComponentType
     >-- DN.Mapping.EdgeMapping.LengthAttribute --> L0.String <R L0.HasProperty
     >-- DN.Mapping.EdgeMapping.DiameterAttribute --> L0.String <R L0.HasProperty
+    >-- DN.Mapping.EdgeMapping.OuterDiameterAttribute --> L0.String <R L0.HasProperty
+    >-- DN.Mapping.EdgeMapping.NominalMassFlowAttribute --> L0.String <R L0.HasProperty
     >-- DN.Mapping.Terminals
index f75f51d1820adbb78f921baa5a9fa689df87da02..4adb19d3ad36d874f4ae381e1dd046bd0dadb8e8 100644 (file)
@@ -29,6 +29,8 @@ public class DistrictNetworkResource {
     public final Resource Edge_HasDiameter_Inverse;
     public final Resource Edge_HasLength;
     public final Resource Edge_HasLength_Inverse;
+    public final Resource Edge_HasNominalMassFlow;
+    public final Resource Edge_HasNominalMassFlow_Inverse;
     public final Resource Edge_HasOuterDiameter;
     public final Resource Edge_HasOuterDiameter_Inverse;
     public final Resource Functions;
@@ -67,6 +69,10 @@ public class DistrictNetworkResource {
     public final Resource Mapping_EdgeMapping_DiameterAttribute_Inverse;
     public final Resource Mapping_EdgeMapping_LengthAttribute;
     public final Resource Mapping_EdgeMapping_LengthAttribute_Inverse;
+    public final Resource Mapping_EdgeMapping_NominalMassFlowAttribute;
+    public final Resource Mapping_EdgeMapping_NominalMassFlowAttribute_Inverse;
+    public final Resource Mapping_EdgeMapping_OuterDiameterAttribute;
+    public final Resource Mapping_EdgeMapping_OuterDiameterAttribute_Inverse;
     public final Resource Mapping_InputTerminal;
     public final Resource Mapping_InputTerminal_Inverse;
     public final Resource Mapping_OutputTerminal;
@@ -78,6 +84,10 @@ public class DistrictNetworkResource {
     public final Resource Mapping_VertexMapping;
     public final Resource Mapping_VertexMapping_ElevationAttribute;
     public final Resource Mapping_VertexMapping_ElevationAttribute_Inverse;
+    public final Resource Mapping_VertexMapping_PressureAttribute;
+    public final Resource Mapping_VertexMapping_PressureAttribute_Inverse;
+    public final Resource Mapping_VertexMapping_TemperatureAttribute;
+    public final Resource Mapping_VertexMapping_TemperatureAttribute_Inverse;
     public final Resource SpatialRefSystem;
     public final Resource Vertex;
     public final Resource VertexDefaultMapping;
@@ -85,6 +95,10 @@ public class DistrictNetworkResource {
     public final Resource VertexMappingParameterType;
     public final Resource Vertex_HasElevation;
     public final Resource Vertex_HasElevation_Inverse;
+    public final Resource Vertex_HasPressure;
+    public final Resource Vertex_HasPressure_Inverse;
+    public final Resource Vertex_HasTemperature;
+    public final Resource Vertex_HasTemperature_Inverse;
         
     public static class URIs {
         public static final String ActionContext = "http://www.simantics.org/DistrictNetwork-1.0/ActionContext";
@@ -106,6 +120,8 @@ public class DistrictNetworkResource {
         public static final String Edge_HasDiameter_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasDiameter/Inverse";
         public static final String Edge_HasLength = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasLength";
         public static final String Edge_HasLength_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasLength/Inverse";
+        public static final String Edge_HasNominalMassFlow = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasNominalMassFlow";
+        public static final String Edge_HasNominalMassFlow_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasNominalMassFlow/Inverse";
         public static final String Edge_HasOuterDiameter = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasOuterDiameter";
         public static final String Edge_HasOuterDiameter_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasOuterDiameter/Inverse";
         public static final String Functions = "http://www.simantics.org/DistrictNetwork-1.0/Functions";
@@ -144,6 +160,10 @@ public class DistrictNetworkResource {
         public static final String Mapping_EdgeMapping_DiameterAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/DiameterAttribute/Inverse";
         public static final String Mapping_EdgeMapping_LengthAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/LengthAttribute";
         public static final String Mapping_EdgeMapping_LengthAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/LengthAttribute/Inverse";
+        public static final String Mapping_EdgeMapping_NominalMassFlowAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/NominalMassFlowAttribute";
+        public static final String Mapping_EdgeMapping_NominalMassFlowAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/NominalMassFlowAttribute/Inverse";
+        public static final String Mapping_EdgeMapping_OuterDiameterAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/OuterDiameterAttribute";
+        public static final String Mapping_EdgeMapping_OuterDiameterAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/OuterDiameterAttribute/Inverse";
         public static final String Mapping_InputTerminal = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/InputTerminal";
         public static final String Mapping_InputTerminal_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/InputTerminal/Inverse";
         public static final String Mapping_OutputTerminal = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/OutputTerminal";
@@ -155,6 +175,10 @@ public class DistrictNetworkResource {
         public static final String Mapping_VertexMapping = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping";
         public static final String Mapping_VertexMapping_ElevationAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/ElevationAttribute";
         public static final String Mapping_VertexMapping_ElevationAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/ElevationAttribute/Inverse";
+        public static final String Mapping_VertexMapping_PressureAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/PressureAttribute";
+        public static final String Mapping_VertexMapping_PressureAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/PressureAttribute/Inverse";
+        public static final String Mapping_VertexMapping_TemperatureAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/TemperatureAttribute";
+        public static final String Mapping_VertexMapping_TemperatureAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/TemperatureAttribute/Inverse";
         public static final String SpatialRefSystem = "http://www.simantics.org/DistrictNetwork-1.0/SpatialRefSystem";
         public static final String Vertex = "http://www.simantics.org/DistrictNetwork-1.0/Vertex";
         public static final String VertexDefaultMapping = "http://www.simantics.org/DistrictNetwork-1.0/VertexDefaultMapping";
@@ -162,6 +186,10 @@ public class DistrictNetworkResource {
         public static final String VertexMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/VertexMappingParameterType";
         public static final String Vertex_HasElevation = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasElevation";
         public static final String Vertex_HasElevation_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasElevation/Inverse";
+        public static final String Vertex_HasPressure = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasPressure";
+        public static final String Vertex_HasPressure_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasPressure/Inverse";
+        public static final String Vertex_HasTemperature = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasTemperature";
+        public static final String Vertex_HasTemperature_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasTemperature/Inverse";
     }
     
     public static Resource getResourceOrNull(ReadGraph graph, String uri) {
@@ -193,6 +221,8 @@ public class DistrictNetworkResource {
         Edge_HasDiameter_Inverse = getResourceOrNull(graph, URIs.Edge_HasDiameter_Inverse);
         Edge_HasLength = getResourceOrNull(graph, URIs.Edge_HasLength);
         Edge_HasLength_Inverse = getResourceOrNull(graph, URIs.Edge_HasLength_Inverse);
+        Edge_HasNominalMassFlow = getResourceOrNull(graph, URIs.Edge_HasNominalMassFlow);
+        Edge_HasNominalMassFlow_Inverse = getResourceOrNull(graph, URIs.Edge_HasNominalMassFlow_Inverse);
         Edge_HasOuterDiameter = getResourceOrNull(graph, URIs.Edge_HasOuterDiameter);
         Edge_HasOuterDiameter_Inverse = getResourceOrNull(graph, URIs.Edge_HasOuterDiameter_Inverse);
         Functions = getResourceOrNull(graph, URIs.Functions);
@@ -231,6 +261,10 @@ public class DistrictNetworkResource {
         Mapping_EdgeMapping_DiameterAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_DiameterAttribute_Inverse);
         Mapping_EdgeMapping_LengthAttribute = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_LengthAttribute);
         Mapping_EdgeMapping_LengthAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_LengthAttribute_Inverse);
+        Mapping_EdgeMapping_NominalMassFlowAttribute = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_NominalMassFlowAttribute);
+        Mapping_EdgeMapping_NominalMassFlowAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_NominalMassFlowAttribute_Inverse);
+        Mapping_EdgeMapping_OuterDiameterAttribute = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_OuterDiameterAttribute);
+        Mapping_EdgeMapping_OuterDiameterAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_OuterDiameterAttribute_Inverse);
         Mapping_InputTerminal = getResourceOrNull(graph, URIs.Mapping_InputTerminal);
         Mapping_InputTerminal_Inverse = getResourceOrNull(graph, URIs.Mapping_InputTerminal_Inverse);
         Mapping_OutputTerminal = getResourceOrNull(graph, URIs.Mapping_OutputTerminal);
@@ -242,6 +276,10 @@ public class DistrictNetworkResource {
         Mapping_VertexMapping = getResourceOrNull(graph, URIs.Mapping_VertexMapping);
         Mapping_VertexMapping_ElevationAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_ElevationAttribute);
         Mapping_VertexMapping_ElevationAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_ElevationAttribute_Inverse);
+        Mapping_VertexMapping_PressureAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_PressureAttribute);
+        Mapping_VertexMapping_PressureAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_PressureAttribute_Inverse);
+        Mapping_VertexMapping_TemperatureAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_TemperatureAttribute);
+        Mapping_VertexMapping_TemperatureAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_TemperatureAttribute_Inverse);
         SpatialRefSystem = getResourceOrNull(graph, URIs.SpatialRefSystem);
         Vertex = getResourceOrNull(graph, URIs.Vertex);
         VertexDefaultMapping = getResourceOrNull(graph, URIs.VertexDefaultMapping);
@@ -249,6 +287,10 @@ public class DistrictNetworkResource {
         VertexMappingParameterType = getResourceOrNull(graph, URIs.VertexMappingParameterType);
         Vertex_HasElevation = getResourceOrNull(graph, URIs.Vertex_HasElevation);
         Vertex_HasElevation_Inverse = getResourceOrNull(graph, URIs.Vertex_HasElevation_Inverse);
+        Vertex_HasPressure = getResourceOrNull(graph, URIs.Vertex_HasPressure);
+        Vertex_HasPressure_Inverse = getResourceOrNull(graph, URIs.Vertex_HasPressure_Inverse);
+        Vertex_HasTemperature = getResourceOrNull(graph, URIs.Vertex_HasTemperature);
+        Vertex_HasTemperature_Inverse = getResourceOrNull(graph, URIs.Vertex_HasTemperature_Inverse);
     }
     
     public static DistrictNetworkResource getInstance(ReadGraph graph) {
index c150654c46039f090b76239cf4cdf0a911b6319e..8187002b9f3ea6703cf1b6d04b067e95f55a45d1 100644 (file)
@@ -43,7 +43,7 @@ public class DistrictDiagramViewer extends DiagramViewer {
         super.initializeCanvasContext(ctx);
         IHintContext h = ctx.getDefaultHintContext();
         h.setHint(PanZoomRotateHandler.KEY_ZOOM_IN_LIMIT, 1000000.0);
-        h.setHint(PanZoomRotateHandler.KEY_ZOOM_OUT_LIMIT, 0.01);
+        h.setHint(PanZoomRotateHandler.KEY_ZOOM_OUT_LIMIT, 0.003);
     }
 
     @Override