From 231b9da5dfd8129e24cb5a9d2ec87ff9afa7afd9 Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Thu, 29 Jun 2017 08:00:52 +0300 Subject: [PATCH] Updates to Simantics district CSV import refs #6958 Change-Id: I7310b62f2b456d36c11d01b8c604b4e3e60b8b2a --- .../META-INF/MANIFEST.MF | 3 +- .../icons/database_table.png | Bin 0 -> 726 bytes org.simantics.district.imports.ui/plugin.xml | 31 +- .../district/imports/ui/CSVImportModel.java | 80 ++++- .../district/imports/ui/CSVImportWizard.java | 277 ++++++++++++------ .../imports/ui/CSVImportWizardPage.java | 186 +++++++++--- .../district/imports/DistrictImportUtils.java | 4 +- .../graph.tg | Bin 12436 -> 13823 bytes .../graph/DistrictNetwork.pgraph | 20 ++ .../ontology/DistrictNetworkResource.java | 42 +++ .../network/ui/DistrictDiagramViewer.java | 2 +- 11 files changed, 480 insertions(+), 165 deletions(-) create mode 100644 org.simantics.district.imports.ui/icons/database_table.png diff --git a/org.simantics.district.imports.ui/META-INF/MANIFEST.MF b/org.simantics.district.imports.ui/META-INF/MANIFEST.MF index b7d0aa63..dc0819b8 100644 --- a/org.simantics.district.imports.ui/META-INF/MANIFEST.MF +++ b/org.simantics.district.imports.ui/META-INF/MANIFEST.MF @@ -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 index 0000000000000000000000000000000000000000..693709cbc1b156839a754e53cbaf409edec69567 GIT binary patch literal 726 zcmV;{0xA88P)T&uF!>{(iS?1OX-eX zKw9bunxR5FrF6QaYs~9>A4#zW^dwIvCpq(+cfR?U`T6-{9LHUqo16RKcDwUVr?cX4 zIN~hJDs48~aRAJ}U_2g=KAB9SP$;0;Y@*$6Ly{z<(`i^NmbL#1W@l#$wOS3;YPBOE zJ;7`?L*?Ga6XzC292wl75}>gDz`(>h?is$JPxm#0jGnotoK|nAVM5$DQ z!C*kO-aeF@+Ejy?nVHEp8V&F~k7BWicsx!aH9kHLRpcQ?L&JFBAB4i&kAaVUxVvzh z3a-EY0%m%8nhI7|SE(QpiBL#sG#VUMM9}*(0mg2(Q$Zq;z|PJNd_Euiem@;jtJN@i za|c2MmsL?PR;yKNwOUA}QuO=7;V@#c7!{~gs?J7hAlsE7U#g?$aRkhSTqLq6iuCu9 z10_j_=;?Dc?4cZ386qH0HkgHTDT|HmGR`W4V2noNQJqfLJEot)q{V_UtsW+m31cP~ zDwWEi3HYBSoF4M;T?VaIdqinn1HZ9}32qs-PdwPbCf+WI6n9jl0-8cjV3%1FB%B&r z+`mzSliyLSH0dxYE}rk&=!uCa*V>()2znj`_XYjtbt>@4FLHnJE|G`xv)Ba@oLBny z1%3K7c4fiB^4{k6E8Pif0kNy62}b@9+ - - - - - - Imports CSV data to Simantics District network - - - - + + + + + + + Imports CSV data to Simantics District network + + + + 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 53de5cfe..2f13692b 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 @@ -20,9 +20,9 @@ public class CSVImportModel { // Second page fills these private char delimiter; - private boolean read; + private boolean readFirstAsHeader = true; private Map 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 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> 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 getHeader() throws IOException { Map 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> 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; + } + } 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 58fd168c..703ade17 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 @@ -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 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 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; } - } 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 9d1d08c4..e1b81e0f 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 @@ -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 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 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() { 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 100c307e..f123855d 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 @@ -44,8 +44,8 @@ public class DistrictImportUtils { public static Map getSupportedCSVDelimiterFormats() { Map delimiters = new HashMap<>(); - delimiters.put("COMMA", ','); - delimiters.put("SEMICOMMA", ';'); + delimiters.put("Comma", ','); + delimiters.put("Semicolon", ';'); return delimiters; } diff --git a/org.simantics.district.network.ontology/graph.tg b/org.simantics.district.network.ontology/graph.tg index e6067186e4cfb139dea3895d189160900103c90a..697cf7dd24abb53608cd3a6ba6504bfc0c77a480 100644 GIT binary patch literal 13823 zcmeHOhkumS(%yvh9ug3c5+hh?2_=Lg1QK9{6q8UCDVyv|*s$3RyPJgAKvb~86}TWE zii(PYaHXTUDu@LeC?F`JD1rha0#+3H=9%|Qa`M7=?>}(g-*2+#nR#Z;oc=C*2rctD zDks@&wjdH)IR2<7G}dSMy;Z(aW01GX69|Sn%9t83JbstgQt0&t8u^8I92ExF5fZ4aG)oaVl!DLWa5rLx zRXTiBKgVzIipZ}-EhaZK!tQDC42|*!908+(oXmvTHLTjsF3HDI^2 zgmm1Si8VDfo&Bx~2X#!Tzq8j@MvO?9f|801w^54ZM!Jle5%x}LozqDF0F05%ivkXh z)8TU#_`H>d4}Ch&;WxK^xjk zv{t9BFy9qRQ6{>|s(cP4Lz*eK z9Jyp06CG9VKpqVnss4uk(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Phqum8VgsC$BUWE$L) zY&PwDrnFo#$FpNt5+zm1 zxww(s;NqIxM@n{FT$6h$A~Y_pHIgPZyx$~u1scg;LiP7K;={)q zu7>97D;AGj@(jg!M3OgEoJT5os^V#irzqY;@g&8Q!5ae!iqn^`p=!Yzf5G!<#eU_A zGRgRVYp^Jo{dJ;CsQZ7czi{Kf>^wUL-t$Gpzjdu(2P4@1wp@1VPNMbeZfBwUbkGP85(Yg4);GMqli%x>K4(Hz#E((-~t8vjd zCf5@vwK~YHj6z(UshPRQ!nesrTU|I(E^Zya#^grj#&?%c&Wqm zHzwS5@#xxVrMnj|=$kXW_ST=G3+L^4^~x`Eo26g+AJdoTWnIzi^7~@Tir=`mc4O^| zw9RW)?%Uk6-Rs@k4mkVP%EP}Le(J^+vGeg2AZh;mjjLXrcjmvBo;`K$)Cc(!pJgRatS*YcWc?#fxvFXr6uYYz2XeCEvOU;g|_;Dw2wZJJOq>&>;-t?m1*H$QFW zrp|kUm$gW0Gq^|Frk(d3-Sx}6)1L12&vR3r-`@XUAFm(b`SQ^EcUsg;zu7b7+1%6v zXI?DYpL*`Sg=Yqqoj6!|;@UZzkEARewXOH7|LVH+^1b5^_FG+=7tM{SnLOgb_p5sK zn*98Avlsl=;y(_J+mQA9`0HJx78gHu#n%UmV{+TZtl2lXI_L0|$q9S6wLkpN&)2`) zf9jc2Q-0dFd)RO3-+#2?VEy0V~TYt40A zu01y_>)f8HXYc)Wd!@T~^8*$C|!wm3P}KEBfD7lXbY{+f#qk9Di-n%JB~-?!R=_&o8Z*HD||% zo1+_YM`a8dx__hVoz3f(ym?^D=`RMpu=l=o-P_&Rc2w=$U!R!w>zP(tRzI??{OS2G zce!@lxQ~yXef0iujgod=R{QSFNgZnY{Whdm^RAoo?jO-- DN.Mapping.ComponentType --> STR.ComponentType -- DN.Mapping.VertexMapping.ElevationAttribute --> L0.String -- DN.Mapping.VertexMapping.TemperatureAttribute --> L0.String -- DN.Mapping.VertexMapping.PressureAttribute --> L0.String -- DN.Mapping.Terminals --> DN.Mapping.TerminalPair -- DN.Mapping.ComponentType >-- DN.Mapping.EdgeMapping.LengthAttribute --> L0.String -- DN.Mapping.EdgeMapping.DiameterAttribute --> L0.String -- DN.Mapping.EdgeMapping.OuterDiameterAttribute --> L0.String -- DN.Mapping.EdgeMapping.NominalMassFlowAttribute --> L0.String -- DN.Mapping.Terminals diff --git a/org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java b/org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java index f75f51d1..4adb19d3 100644 --- a/org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java +++ b/org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java @@ -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) { diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java index c150654c..8187002b 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java @@ -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 -- 2.45.1