From: jsimomaa Date: Fri, 6 Oct 2017 05:17:52 +0000 (+0300) Subject: Additions to district features X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F70%2F1870%2F1;p=simantics%2Fdistrict.git Additions to district features Change-Id: I3362da74bce33736a730345c1b03833703696dfb Pushing some (very) old changes to remote.. should have done long ago gitlab #1 Change-Id: I3ec1b6b460d82851f9c16188d3e6d80386f90770 Added LICENSE Modifying for Simantics 1.32.0.1 platform for building Map UI feature gitlab #1 Change-Id: Ie83066e2fb1cc5bbfa865f59b1f4dcfdf8cf8c80 --- diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..3260e4f2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,204 @@ +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC +LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM +CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation + distributed under this Agreement, and +b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are + distributed by that particular Contributor. A Contribution 'originates' + from a Contributor if it was added to the Program by such Contributor + itself or anyone acting on such Contributor's behalf. Contributions do not + include additions to the Program which: (i) are separate modules of + software distributed in conjunction with the Program under their own + license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which are +necessarily infringed by the use or sale of its Contribution alone or when +combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, +including all Contributors. + +2. GRANT OF RIGHTS + a) Subject to the terms of this Agreement, each Contributor hereby grants + Recipient a non-exclusive, worldwide, royalty-free copyright license to + reproduce, prepare derivative works of, publicly display, publicly + perform, distribute and sublicense the Contribution of such Contributor, + if any, and such derivative works, in source code and object code form. + b) Subject to the terms of this Agreement, each Contributor hereby grants + Recipient a non-exclusive, worldwide, royalty-free patent license under + Licensed Patents to make, use, sell, offer to sell, import and otherwise + transfer the Contribution of such Contributor, if any, in source code and + object code form. This patent license shall apply to the combination of + the Contribution and the Program if, at the time the Contribution is + added by the Contributor, such addition of the Contribution causes such + combination to be covered by the Licensed Patents. The patent license + shall not apply to any other combinations which include the Contribution. + No hardware per se is licensed hereunder. + c) Recipient understands that although each Contributor grants the licenses + to its Contributions set forth herein, no assurances are provided by any + Contributor that the Program does not infringe the patent or other + intellectual property rights of any other entity. Each Contributor + disclaims any liability to Recipient for claims brought by any other + entity based on infringement of intellectual property rights or + otherwise. As a condition to exercising the rights and licenses granted + hereunder, each Recipient hereby assumes sole responsibility to secure + any other intellectual property rights needed, if any. For example, if a + third party patent license is required to allow Recipient to distribute + the Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + d) Each Contributor represents that to its knowledge it has sufficient + copyright rights in its Contribution, if any, to grant the copyright + license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under +its own license agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + b) its license agreement: + i) effectively disclaims on behalf of all Contributors all warranties + and conditions, express and implied, including warranties or + conditions of title and non-infringement, and implied warranties or + conditions of merchantability and fitness for a particular purpose; + ii) effectively excludes on behalf of all Contributors all liability for + damages, including direct, indirect, special, incidental and + consequential damages, such as lost profits; + iii) states that any provisions which differ from this Agreement are + offered by that Contributor alone and not by any other party; and + iv) states that source code for the Program is available from such + Contributor, and informs licensees how to obtain it in a reasonable + manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + b) a copy of this Agreement must be included with each copy of the Program. + Contributors may not remove or alter any copyright notices contained + within the Program. + +Each Contributor must identify itself as the originator of its Contribution, +if +any, in a manner that reasonably allows subsequent Recipients to identify the +originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with +respect to end users, business partners and the like. While this license is +intended to facilitate the commercial use of the Program, the Contributor who +includes the Program in a commercial product offering should do so in a manner +which does not create potential liability for other Contributors. Therefore, +if a Contributor includes the Program in a commercial product offering, such +Contributor ("Commercial Contributor") hereby agrees to defend and indemnify +every other Contributor ("Indemnified Contributor") against any losses, +damages and costs (collectively "Losses") arising from claims, lawsuits and +other legal actions brought by a third party against the Indemnified +Contributor to the extent caused by the acts or omissions of such Commercial +Contributor in connection with its distribution of the Program in a commercial +product offering. The obligations in this section do not apply to any claims +or Losses relating to any actual or alleged intellectual property +infringement. In order to qualify, an Indemnified Contributor must: +a) promptly notify the Commercial Contributor in writing of such claim, and +b) allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such claim at +its own expense. + +For example, a Contributor might include the Program in a commercial product +offering, Product X. That Contributor is then a Commercial Contributor. If +that Commercial Contributor then makes performance claims, or offers +warranties related to Product X, those performance claims and warranties are +such Commercial Contributor's responsibility alone. Under this section, the +Commercial Contributor would have to defend claims against the other +Contributors related to those performance claims and warranties, and if a +court requires any other Contributor to pay any damages as a result, the +Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, +NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each +Recipient is solely responsible for determining the appropriateness of using +and distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to the +risks and costs of program errors, compliance with applicable laws, damage to +or loss of data, programs or equipment, and unavailability or interruption of +operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY +CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION +LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY +OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of the +remainder of the terms of this Agreement, and without further action by the +parties hereto, such provision shall be reformed to the minimum extent +necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Program itself +(excluding combinations of the Program with other software or hardware) +infringes such Recipient's patent(s), then such Recipient's rights granted +under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to +comply with any of the material terms or conditions of this Agreement and does +not cure such failure in a reasonable period of time after becoming aware of +such noncompliance. If all Recipient's rights under this Agreement terminate, +Recipient agrees to cease use and distribution of the Program as soon as +reasonably practicable. However, Recipient's obligations under this Agreement +and any licenses granted by Recipient relating to the Program shall continue +and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in +order to avoid inconsistency the Agreement is copyrighted and may only be +modified in the following manner. The Agreement Steward reserves the right to +publish new versions (including revisions) of this Agreement from time to +time. No one other than the Agreement Steward has the right to modify this +Agreement. The Eclipse Foundation is the initial Agreement Steward. The +Eclipse Foundation may assign the responsibility to serve as the Agreement +Steward to a suitable separate entity. Each new version of the Agreement will +be given a distinguishing version number. The Program (including +Contributions) may always be distributed subject to the version of the +Agreement under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the Program +(including its Contributions) under the new version. Except as expressly +stated in Sections 2(a) and 2(b) above, Recipient receives no rights or +licenses to the intellectual property of any Contributor under this Agreement, +whether expressly, by implication, estoppel or otherwise. All rights in the +Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the +intellectual property laws of the United States of America. No party to this +Agreement will bring a legal action under this Agreement more than one year +after the cause of action arose. Each party waives its rights to a jury trial in +any resulting litigation. + diff --git a/org.simantics.district.feature/feature.xml b/org.simantics.district.feature/feature.xml index f60a2fc0..47cc1761 100644 --- a/org.simantics.district.feature/feature.xml +++ b/org.simantics.district.feature/feature.xml @@ -1,47 +1,73 @@ - - - - - [Enter Feature Description here.] - - - - [Enter Copyright Description here.] - - - - [Enter License Description here.] - - - - - - - - - - - + + + + + [Enter Feature Description here.] + + + + [Enter Copyright Description here.] + + + + [Enter License Description here.] + + + + + + + + + + + + + + + + + + + diff --git a/org.simantics.district.geotools/build.properties b/org.simantics.district.geotools/build.properties index 7a0700c2..efaa0a7f 100644 --- a/org.simantics.district.geotools/build.properties +++ b/org.simantics.district.geotools/build.properties @@ -2,15 +2,4 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - lib/commons-pool-1.5.4.jar,\ - lib/core-0.26.jar,\ - lib/GeographicLib-Java-1.44.jar,\ - lib/gt-metadata-16.0.jar,\ - lib/gt-opengis-16.0.jar,\ - lib/gt-referencing-16.0.jar,\ - lib/jai_core-1.1.3.jar,\ - lib/jgridshift-1.0.jar,\ - lib/jsr-275-1.0-beta-2.jar,\ - lib/jts-1.13.jar,\ - lib/gt-epsg-hsql-16.0.jar,\ - lib/hsqldb-2.3.4.jar + lib/ diff --git a/org.simantics.district.imports.ui/build.properties b/org.simantics.district.imports.ui/build.properties index 6f20375d..6c480f39 100644 --- a/org.simantics.district.imports.ui/build.properties +++ b/org.simantics.district.imports.ui/build.properties @@ -1,5 +1,6 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + icons/ 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 2f13692b..e2a6b7ee 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 @@ -42,11 +42,33 @@ public class CSVImportModel { 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; + private int supplytempIndex = -1; + private int supplypressureIndex= -1; + private int diameterIndex = -1; + private int outerDiamterIndex = -1; + private int nominalMassFlowIndex = -1; + private int returnTempIndex = -1; + private int returnPressureIndex = -1; + private int deltaPressureIndex = -1; + private int deltaTemperatureIndex = -1; + private int heatPowerIndex = -1; + private int nominalHeadMIndex = -1; + private int nominalHeadBIndex = -1; + private int nominalFlowIndex = -1; + private int maximumHeadMIndex = -1; + private int heatLoadDsIndex = -1; + private int massFlowIndex = -1; + private int volFlowIndex = -1; + private int velocityIndex = -1; + private int flowAreaIndex = -1; + private int nominalPressureLossIndex = -1; + private int edgeFlowAreaIndex = -1; + private int kReturnIndex = -1; + private int kSupplyIndex = -1; + private int tGroundIndex = -1; + private int idIndex = -1; + private double edgePadding = 0.0001; // default + private int valvePositionIndx = -1; // Third page @@ -236,20 +258,36 @@ public class CSVImportModel { return sourceCRS; } - public void setTempIndex(int tempIndex) { - this.tempIndex = tempIndex; + public void setSupplyTempIndex(int supplyTempIndex) { + this.supplytempIndex = supplyTempIndex; } - public int getTempIndex() { - return tempIndex; + public int getSupplyTempIndex() { + return supplytempIndex; } - public void setPressureIndex(int pressureIndex) { - this.pressureIndex = pressureIndex; + public void setSupplyPressureIndex(int supplyPressureIndex) { + this.supplypressureIndex = supplyPressureIndex; } - public int getPressureIndex() { - return pressureIndex; + public int getSupplyPressureIndex() { + return supplypressureIndex; + } + + public void setReturnTempIndex(int returnTempIndex) { + this.returnTempIndex = returnTempIndex; + } + + public int getReturnTempIndex() { + return returnTempIndex; + } + + public void setReturnPressureIndex(int returnPressureIndex) { + this.returnPressureIndex = returnPressureIndex; + } + + public int getReturnPressureIndex() { + return returnPressureIndex; } public void setDiameterIndex(int parseInt) { @@ -276,4 +314,163 @@ public class CSVImportModel { return nominalMassFlowIndex; } + public void setDeltaPressureIndex(int parseInt) { + this.deltaPressureIndex = parseInt; + } + + public int getDeltaPressureIndex() { + return deltaPressureIndex; + } + + public void setDeltaTemperatureIndex(int parseInt) { + this.deltaTemperatureIndex = parseInt; + } + + public int getDeltaTemperatureIndex() { + return deltaTemperatureIndex; + } + + public void setHeatPowerIndex(int parseInt) { + this.heatPowerIndex = parseInt; + } + + public int getHeatPowerIndex() { + return heatPowerIndex; + } + + public void setNominalHeadMIndex(int parseInt) { + this.nominalHeadMIndex = parseInt; + } + + public int getNominalHeadMIndex() { + return nominalHeadMIndex; + } + + public void setNominalHeadBIndex(int parseInt) { + this.nominalHeadBIndex = parseInt; + } + + public int getNominalHeadBIndex() { + return nominalHeadBIndex; + } + + public void setNominalFlowIndex(int parseInt) { + this.nominalFlowIndex = parseInt; + } + + public int getNominalFlowIndex() { + return nominalFlowIndex; + } + + public void setMaximumHeadMIndex(int parseInt) { + this.maximumHeadMIndex = parseInt; + } + + public int getMaximumHeadMIndex() { + return maximumHeadMIndex; + } + + public void setHeatLoadDsIndex(int parseInt) { + this.heatLoadDsIndex = parseInt; + } + + public int getHeatLoadDsIndex() { + return heatLoadDsIndex; + } + + public void setMassFlowIndex(int parseInt) { + this.massFlowIndex = parseInt; + } + + public int getMassFlowIndex() { + return massFlowIndex; + } + + public void setVolFlowIndex(int parseInt) { + this.volFlowIndex = parseInt; + } + + public int getVolFlowIndex() { + return volFlowIndex; + } + + public void setVelocityIndex(int parseInt) { + this.velocityIndex = parseInt; + } + + public int getVelocityIndex() { + return velocityIndex; + } + + public void setFlowAreaIndex(int parseInt) { + this.flowAreaIndex = parseInt; + } + + public int getFlowAreaIndex() { + return flowAreaIndex; + } + + public void setNominalPressureLossIndex(int parseInt) { + this.nominalPressureLossIndex = parseInt; + } + + public int getNominalPressureLossIndex() { + return nominalPressureLossIndex; + } + + public void setEdgeFlowAreaIndex(int parseInt) { + this.edgeFlowAreaIndex = parseInt; + } + + public int getEdgeFlowAreaIndex() { + return edgeFlowAreaIndex; + } + + public void setKReturnIndex(int parseInt) { + this.kReturnIndex = parseInt; + } + + public int getkReturnIndex() { + return kReturnIndex; + } + + public void setKSupplyIndex(int parseInt) { + this.kSupplyIndex = parseInt; + } + + public int getkSupplyIndex() { + return kSupplyIndex; + } + + public void setTGroundIndex(int parseInt) { + this.tGroundIndex = parseInt; + } + + public int gettGroundIndex() { + return tGroundIndex; + } + + public int getIdIndex() { + return idIndex; + } + + public void setIdIndex(int idIndex) { + this.idIndex = idIndex; + } + + public void setEdgePapping(double edgePadding) { + this.edgePadding = edgePadding; + } + + public double getEdgePadding() { + return edgePadding; + } + + public void setValvePositionIndex(int valvePositionIndx) { + this.valvePositionIndx = valvePositionIndx; + } + + public int getValvePositionIndx() { + return valvePositionIndx; + } } 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 703ade17..80bf1447 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 @@ -56,6 +56,7 @@ public class CSVImportWizard extends Wizard implements IImportWizard { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask("Importing CSV", 1000); try { Path csvFile = model.getSource(); char delim = model.getDelimiter(); @@ -67,8 +68,24 @@ public class CSVImportWizard extends Wizard implements IImportWizard { int xCoordColumnIndex = model.getXCoordIndex(); int yCoordColumnIndex = model.getYCoordIndex(); int zCoordColumnIndex = model.getZCoordIndex(); - int tempColumnIndex = model.getTempIndex(); - int pressureColumnIndex = model.getPressureIndex(); + int supplyTempColumnIndex = model.getSupplyTempIndex(); + int returnTempColumnIndex = model.getReturnTempIndex(); + int supplyPressureColumnIndex = model.getSupplyPressureIndex(); + int returnPressureColumnIndex = model.getReturnPressureIndex(); + int dpIndex = model.getDeltaPressureIndex(); + int dtIndex = model.getDeltaTemperatureIndex(); + int heatPowerIndex = model.getHeatPowerIndex(); + int valvePositionIndex = model.getValvePositionIndx(); + int nominalHeadMIndex = model.getNominalHeadMIndex(); + int nominalHeadBIndex = model.getNominalHeadBIndex(); + int nominalFlowIndex = model.getNominalFlowIndex(); + int maximumHeadMIndex = model.getMaximumHeadMIndex(); + int heatLoadDsIndex = model.getHeatLoadDsIndex(); + int massFlowIndex = model.getMassFlowIndex(); + int volFlowIndex = model.getVolFlowIndex(); + int velocityIndex = model.getVelocityIndex(); + int flowAreaIndex = model.getFlowAreaIndex(); + int nominalPressureLossIndex = model.getNominalPressureLossIndex(); int startXCoordColumnIndex = model.getStartXCoordIndex(); int startYCoordColumnIndex = model.getStartYCoordIndex(); @@ -79,8 +96,15 @@ public class CSVImportWizard extends Wizard implements IImportWizard { int diameterColumnIndex= model.getDiameterIndex(); int outerDiameterColumnIndex = model.getOuterDiamterIndex(); int nominalMassFlowIndex = model.getNominalMassFlowIndex(); + int tGroundIndex = model.gettGroundIndex(); + int edgeFlowAreaIndex = model.getEdgeFlowAreaIndex(); + int kReturnIndex = model.getkReturnIndex(); + int kSupplyIndex = model.getkSupplyIndex(); int mappingColumn = model.getComponentMappingIndex(); + int idColumn = model.getIdIndex(); + + double padding = model.getEdgePadding(); String sourceEPSGCRS = model.getSourceCRS(); @@ -99,6 +123,7 @@ public class CSVImportWizard extends Wizard implements IImportWizard { @Override public void perform(WriteGraph graph) throws DatabaseException { + graph.markUndoPoint(); DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); @@ -111,16 +136,19 @@ public class CSVImportWizard extends Wizard implements IImportWizard { if (model.isVertexImport()) { String xCoords = row.get(xCoordColumnIndex); String yCoords = row.get(yCoordColumnIndex); - double xCoord = Double.parseDouble(xCoords); + double xCoord = - Double.parseDouble(xCoords); // make negative for now 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); + if (zCoordColumnIndex != -1) { + String zs = row.get(zCoordColumnIndex); + + if (!zs.isEmpty()) { + try { + z = Double.parseDouble(zs); + } catch (NumberFormatException e) { + throw new DatabaseException(e); + } } } @@ -135,26 +163,28 @@ public class CSVImportWizard extends Wizard implements IImportWizard { } Resource vertex = DistrictNetworkUtil.createVertex(graph, model.getParentDiagram(), new double[] { coords[1], -coords[0]}, model.getComponentMappings().get(mappingValue)); + writeStringValue(graph, row, idColumn, vertex, DN.HasId); + 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); - } - } + writeValue(graph, row, supplyTempColumnIndex, vertex, DN.Vertex_HasSupplyTemperature); + writeValue(graph, row, returnTempColumnIndex, vertex, DN.Vertex_HasReturnTemperature); + writeValue(graph, row, supplyPressureColumnIndex, vertex, DN.Vertex_HasSupplyPressure); + writeValue(graph, row, returnPressureColumnIndex, vertex, DN.Vertex_HasReturnPressure); + writeValue(graph, row, dpIndex, vertex, DN.Vertex_HasDeltaPressure); + writeValue(graph, row, dtIndex, vertex, DN.Vertex_HasDeltaTemperature); + writeValue(graph, row, heatPowerIndex, vertex, DN.Vertex_HasHeatPower); + writeValue(graph, row, valvePositionIndex, vertex, DN.Vertex_HasValvePosition); + writeValue(graph, row, nominalHeadMIndex, vertex, DN.Vertex_HasNominalHeadM); + writeValue(graph, row, nominalHeadBIndex, vertex, DN.Vertex_HasNominalHeadB); + writeValue(graph, row, nominalFlowIndex, vertex, DN.Vertex_HasNominalFlow); + writeValue(graph, row, maximumHeadMIndex, vertex, DN.Vertex_HasMaximumHeadM); + writeValue(graph, row, heatLoadDsIndex, vertex, DN.Vertex_HasHeatLoadDs); + writeValue(graph, row, massFlowIndex, vertex, DN.Vertex_HasMassFlow); + writeValue(graph, row, volFlowIndex, vertex, DN.Vertex_HasVolFlow); + writeValue(graph, row, velocityIndex, vertex, DN.Vertex_HasVelocity); + writeValue(graph, row, flowAreaIndex, vertex, DN.Vertex_HasFlowArea); + writeValue(graph, row, nominalPressureLossIndex, vertex, DN.Vertex_HasNominalPressureLoss); } else { String startXCoords = row.get(startXCoordColumnIndex); @@ -162,10 +192,10 @@ public class CSVImportWizard extends Wizard implements IImportWizard { String endXCoords = row.get(endXCoordColumnIndex); String endYCoords = row.get(endYCoordColumnIndex); - double startXCoord = Double.parseDouble(startXCoords); + double startXCoord = - Double.parseDouble(startXCoords); // make negative double startYCoord = Double.parseDouble(startYCoords); - double endXCoord = Double.parseDouble(endXCoords); + double endXCoord = - Double.parseDouble(endXCoords); // make negative double endYCoord = Double.parseDouble(endYCoords); double[] startCoords; @@ -184,37 +214,17 @@ public class CSVImportWizard extends Wizard implements IImportWizard { 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(), model.getComponentMappings().get(mappingValue), new double[] { startCoords[1], -startCoords[0]}, new double[] { endCoords[1], -endCoords[0]}, padding); + writeStringValue(graph, row, idColumn, edge, DN.HasId); - 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); - } - } + writeValue(graph, row, diameterColumnIndex, edge, DN.Edge_HasDiameter); + writeValue(graph, row, outerDiameterColumnIndex, edge, DN.Edge_HasOuterDiameter); + writeValue(graph, row, nominalMassFlowIndex, edge, DN.Edge_HasNominalMassFlow); + writeValue(graph, row, tGroundIndex, edge, DN.Edge_HasTGround); + writeValue(graph, row, kReturnIndex, edge, DN.Edge_HasKReturn); + writeValue(graph, row, kSupplyIndex, edge, DN.Edge_HasKSupply); + writeValue(graph, row, edgeFlowAreaIndex, edge, DN.Edge_HasFlowArea); } } catch (MismatchedDimensionException | TransformException | DatabaseException e) { throw new DatabaseException(e); @@ -239,4 +249,30 @@ public class CSVImportWizard extends Wizard implements IImportWizard { return false; } } + + private static void writeValue(WriteGraph graph, CSVRecord row, int index, Resource subject, Resource relation) throws DatabaseException { + if (index != -1) { + String stringValue = row.get(index); + if (!stringValue.isEmpty()) { + try { + graph.claimLiteral(subject, relation, Double.parseDouble(stringValue), Bindings.DOUBLE); + } catch (NumberFormatException e) { + throw new DatabaseException(e); + } + } + } + } + + private static void writeStringValue(WriteGraph graph, CSVRecord row, int index, Resource subject, Resource relation) throws DatabaseException { + if (index != -1) { + String stringValue = row.get(index); + if (!stringValue.isEmpty()) { + try { + graph.claimLiteral(subject, relation, stringValue, Bindings.STRING); + } catch (NumberFormatException e) { + throw new DatabaseException(e); + } + } + } + } } diff --git a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardFirstPage.java b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardFirstPage.java index 830b1264..9ba7e2da 100644 --- a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardFirstPage.java +++ b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardFirstPage.java @@ -100,6 +100,11 @@ public class CSVImportWizardFirstPage extends WizardPage implements FileSelectio } }); diagramCombo.setItems(diagrams.keySet().toArray(new String[diagrams.size()])); + if (diagrams.size() > 0) { + diagramCombo.select(0); + model.setParentDiagram(diagrams.get(diagramCombo.getItem(0))); + diagramCombo.getDisplay().asyncExec(() -> validateComplete()); + } } catch (DatabaseException e) { e.printStackTrace(); } 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 e1b81e0f..0035f6b7 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 @@ -12,11 +12,14 @@ import org.eclipse.jface.dialogs.IPageChangeProvider; import org.eclipse.jface.dialogs.IPageChangedListener; import org.eclipse.jface.dialogs.PageChangedEvent; import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.jface.layout.TableColumnLayout; 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.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; @@ -29,6 +32,7 @@ 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.eclipse.swt.widgets.Text; import org.geotools.referencing.CRS; import org.simantics.district.imports.ui.controls.DynamicComboFieldEditor; @@ -48,6 +52,7 @@ public class CSVImportWizardPage extends WizardPage { // Common for vertex and edge private DynamicComboFieldEditor componentMappingSelector; + private DynamicComboFieldEditor idSelector; private DynamicComboFieldEditor labelSelector; // For vertex import @@ -55,6 +60,25 @@ public class CSVImportWizardPage extends WizardPage { private DynamicComboFieldEditor yCoordSelector; private DynamicComboFieldEditor zValueSelector; + private DynamicComboFieldEditor supplyTempValueSelector; + private DynamicComboFieldEditor returnTempValueSelector; + private DynamicComboFieldEditor supplyPressureValueSelector; + private DynamicComboFieldEditor returnPressureValueSelector; + private DynamicComboFieldEditor dpSelector; + private DynamicComboFieldEditor dtSelector; + private DynamicComboFieldEditor heatPowerSelector; + private DynamicComboFieldEditor nominalHeadMSelector; + private DynamicComboFieldEditor nominalHeadBSelector; + private DynamicComboFieldEditor nominalFlowSelector; + private DynamicComboFieldEditor maximumHeadMSelector; + private DynamicComboFieldEditor heatLoadDsSelector; + private DynamicComboFieldEditor massFlowSelector; + private DynamicComboFieldEditor volFlowSelector; + private DynamicComboFieldEditor velocitySelector; + private DynamicComboFieldEditor flowAreaSelector; + private DynamicComboFieldEditor nominalPressureLossSelector; + private DynamicComboFieldEditor valvePositionSelector; + // For edge import private DynamicComboFieldEditor startXCoordSelector; private DynamicComboFieldEditor startYCoordSelector; @@ -62,8 +86,8 @@ public class CSVImportWizardPage extends WizardPage { private DynamicComboFieldEditor endXCoordSelector; private DynamicComboFieldEditor endYCoordSelector; private DynamicComboFieldEditor endZValueSelector; - private DynamicComboFieldEditor tempValueSelector; - private DynamicComboFieldEditor pressureValueSelector; + + private Text edgeConnectionPadding; private DynamicComboFieldEditor outerDiameterSelector; private DynamicComboFieldEditor diameterSelector; @@ -76,6 +100,14 @@ public class CSVImportWizardPage extends WizardPage { private Button isVertexImport; private Combo sourceCRSCombo; + + private DynamicComboFieldEditor edgeFlowAreaSelector; + + private DynamicComboFieldEditor kReturnSelector; + + private DynamicComboFieldEditor kSupplySelector; + + private DynamicComboFieldEditor tGroundSelector; protected CSVImportWizardPage(CSVImportModel model) { super("Import CSV Data"); @@ -94,7 +126,10 @@ public class CSVImportWizardPage extends WizardPage { 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()); + String[] formats = model.getDelimiterFormats(); + delimiterCombo.setItems(formats); + if (formats.length > 0) + delimiterCombo.select(0); delimiterCombo.addSelectionListener(new SelectionListener() { @Override @@ -148,6 +183,31 @@ public class CSVImportWizardPage extends WizardPage { } }); + sourceCRSCombo.addModifyListener(new ModifyListener() { + + @Override + public void modifyText(ModifyEvent e) { + String currentText = sourceCRSCombo.getText(); + if (codes.contains(currentText)) { + // Select this + String[] items = sourceCRSCombo.getItems(); + int i; + for (i = 0; i < items.length; i++) { + String item = items[i]; + if (currentText.equals(item)) { + break; + } + } + if (i != 0) { + sourceCRSCombo.select(i); + model.setSourceCRS("EPSG:" + currentText); + } else { + System.err.println("this should not happen"); + } + } + } + }); + // wktFileSelection = new FileSelectionWidget(composite, "WKT file", SWT.OPEN); // wktFileSelection.addListener(new FileSelectionListener() { // @@ -225,6 +285,27 @@ public class CSVImportWizardPage extends WizardPage { createEdgeIndexMappingField(indexMappingGroup); createCommonIndexMappingField(indexMappingGroup); + + if (!model.isVertexImport()) { + Label label = new Label(indexMappingGroup, SWT.NONE); + label.setText("Connection point padding"); + GridDataFactory.fillDefaults().applyTo(label); + edgeConnectionPadding = new Text(indexMappingGroup, SWT.BORDER); + GridDataFactory.fillDefaults().applyTo(edgeConnectionPadding); + edgeConnectionPadding.setText("0.0001"); // default + edgeConnectionPadding.addModifyListener(new ModifyListener() { + + @Override + public void modifyText(ModifyEvent e) { + try { + double padding = Double.parseDouble(""); + model.setEdgePapping(padding); + } catch (NumberFormatException ee) { + // ignore + } + } + }); + } } private void createCommonIndexMappingField(Group parent) { @@ -244,6 +325,21 @@ public class CSVImportWizardPage extends WizardPage { } }); + idSelector = new DynamicComboFieldEditor("id", "ID", parent); + idSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setIdIndex(Integer.parseInt(idSelector.getValue())); + validatePageComplete(); + } + }); + } private void createVertexIndexMappingField(Group parent) { @@ -290,8 +386,50 @@ public class CSVImportWizardPage extends WizardPage { validatePageComplete(); } }); - tempValueSelector = new DynamicComboFieldEditor("tempValue", "Temperature value", parent); - tempValueSelector.addComboListener(new SelectionListener() { + supplyTempValueSelector = new DynamicComboFieldEditor("tempValue", "Supply Temperature value", parent); + supplyTempValueSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setSupplyTempIndex(Integer.parseInt(supplyTempValueSelector.getValue())); + validatePageComplete(); + } + }); + returnTempValueSelector = new DynamicComboFieldEditor("returnTempValue", "Return Temperature value", parent); + returnTempValueSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setReturnTempIndex(Integer.parseInt(returnTempValueSelector.getValue())); + validatePageComplete(); + } + }); + supplyPressureValueSelector = new DynamicComboFieldEditor("pressureValue", "Supply Pressure value", parent); + supplyPressureValueSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setSupplyPressureIndex(Integer.parseInt(supplyPressureValueSelector.getValue())); + validatePageComplete(); + } + }); + returnPressureValueSelector = new DynamicComboFieldEditor("returnPressureValue", "Return Pressure value", parent); + returnPressureValueSelector.addComboListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { @@ -300,12 +438,12 @@ public class CSVImportWizardPage extends WizardPage { @Override public void widgetDefaultSelected(SelectionEvent e) { - model.setTempIndex(Integer.parseInt(tempValueSelector.getValue())); + model.setReturnPressureIndex(Integer.parseInt(returnPressureValueSelector.getValue())); validatePageComplete(); } }); - pressureValueSelector = new DynamicComboFieldEditor("pressureValue", "Pressure value", parent); - pressureValueSelector.addComboListener(new SelectionListener() { + dpSelector = new DynamicComboFieldEditor("dpValue", "Delta pressure ", parent); + dpSelector.addComboListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { @@ -314,13 +452,200 @@ public class CSVImportWizardPage extends WizardPage { @Override public void widgetDefaultSelected(SelectionEvent e) { - model.setPressureIndex(Integer.parseInt(pressureValueSelector.getValue())); + model.setDeltaPressureIndex(Integer.parseInt(dpSelector.getValue())); + validatePageComplete(); + } + }); + dtSelector = new DynamicComboFieldEditor("dtValue", "Delta temperature ", parent); + dtSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setDeltaTemperatureIndex(Integer.parseInt(dtSelector.getValue())); + validatePageComplete(); + } + }); + heatPowerSelector = new DynamicComboFieldEditor("heatPowerValue", "Heat Power", parent); + heatPowerSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setHeatPowerIndex(Integer.parseInt(heatPowerSelector.getValue())); + validatePageComplete(); + } + }); + nominalHeadMSelector = new DynamicComboFieldEditor("nominalHeadMValue", "nominalHeadM", parent); + nominalHeadMSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setNominalHeadMIndex(Integer.parseInt(nominalHeadMSelector.getValue())); + validatePageComplete(); + } + }); + nominalHeadBSelector = new DynamicComboFieldEditor("nominalHeadBValue", "nominalHeadB", parent); + nominalHeadBSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setNominalHeadBIndex(Integer.parseInt(nominalHeadBSelector.getValue())); + validatePageComplete(); + } + }); + nominalFlowSelector = new DynamicComboFieldEditor("nominalFlowValue", "nominalFlow", parent); + nominalFlowSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setNominalFlowIndex(Integer.parseInt(nominalFlowSelector.getValue())); + validatePageComplete(); + } + }); + + maximumHeadMSelector = new DynamicComboFieldEditor("maximumHeadMValue", "maximumHeadM", parent); + maximumHeadMSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setMaximumHeadMIndex(Integer.parseInt(maximumHeadMSelector.getValue())); + validatePageComplete(); + } + }); + heatLoadDsSelector = new DynamicComboFieldEditor("heatLoadDsValue", "heatLoadDs", parent); + heatLoadDsSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setHeatLoadDsIndex(Integer.parseInt(heatLoadDsSelector.getValue())); + validatePageComplete(); + } + }); + massFlowSelector = new DynamicComboFieldEditor("massFlowValue", "massFlow", parent); + massFlowSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setMassFlowIndex(Integer.parseInt(massFlowSelector.getValue())); + validatePageComplete(); + } + }); + volFlowSelector = new DynamicComboFieldEditor("volFlowValue", "volFlow", parent); + volFlowSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setVolFlowIndex(Integer.parseInt(volFlowSelector.getValue())); + validatePageComplete(); + } + }); + velocitySelector = new DynamicComboFieldEditor("velocityValue", "velocity", parent); + velocitySelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setVelocityIndex(Integer.parseInt(velocitySelector.getValue())); + validatePageComplete(); + } + }); + flowAreaSelector = new DynamicComboFieldEditor("flowAreaValue", "flowArea", parent); + flowAreaSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setFlowAreaIndex(Integer.parseInt(flowAreaSelector.getValue())); + validatePageComplete(); + } + }); + nominalPressureLossSelector = new DynamicComboFieldEditor("nominalPressureLossValue", "nominalPressureLoss", parent); + nominalPressureLossSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setNominalPressureLossIndex(Integer.parseInt(nominalPressureLossSelector.getValue())); + validatePageComplete(); + } + }); + valvePositionSelector = new DynamicComboFieldEditor("valvePositionSelectorValue", "valvePositionSelector", parent); + valvePositionSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setValvePositionIndex(Integer.parseInt(valvePositionSelector.getValue())); validatePageComplete(); } }); } private void createEdgeIndexMappingField(Group parent) { + +// Composite paddingComposite = new Composite(parent, SWT.NONE); +// GridLayoutFactory.fillDefaults().numColumns(2).applyTo(paddingComposite); + startXCoordSelector = new DynamicComboFieldEditor("startxCoord", "Start X Coordinate", parent); startXCoordSelector.addComboListener(new SelectionListener() { @@ -450,12 +775,69 @@ public class CSVImportWizardPage extends WizardPage { validatePageComplete(); } }); + edgeFlowAreaSelector = new DynamicComboFieldEditor("edgeFlowAreaValue", "Flow Area", parent); + edgeFlowAreaSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setEdgeFlowAreaIndex(Integer.parseInt(edgeFlowAreaSelector.getValue())); + validatePageComplete(); + } + }); + kReturnSelector = new DynamicComboFieldEditor("kReturnValue", "K Return", parent); + kReturnSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setKReturnIndex(Integer.parseInt(kReturnSelector.getValue())); + validatePageComplete(); + } + }); + kSupplySelector = new DynamicComboFieldEditor("kSupplyValue", "K Supply", parent); + kSupplySelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setKSupplyIndex(Integer.parseInt(kSupplySelector.getValue())); + validatePageComplete(); + } + }); + tGroundSelector = new DynamicComboFieldEditor("tGroundValue", "Temperature Ground", parent); + tGroundSelector.addComboListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + model.setTGroundIndex(Integer.parseInt(tGroundSelector.getValue())); + validatePageComplete(); + } + }); } private void updateCombos() { - String[][] namesAndValues = new String[headerIndexAndValues.size()][]; + String[][] namesAndValues = new String[headerIndexAndValues.size() + 1][]; - int i = 0; + namesAndValues[0] = new String[] {"", "-1"}; + int i = 1; for (Entry entry : headerIndexAndValues.entrySet()) { int key = entry.getKey(); String value = entry.getValue(); @@ -472,6 +854,7 @@ public class CSVImportWizardPage extends WizardPage { updateEdgeCombos(namesAndValues); componentMappingSelector.updateCombo(namesAndValues); + idSelector.updateCombo(namesAndValues); } private void updateEdgeCombos(String[][] namesAndValues) { @@ -484,15 +867,37 @@ public class CSVImportWizardPage extends WizardPage { diameterSelector.updateCombo(namesAndValues); outerDiameterSelector.updateCombo(namesAndValues); nominalMassFlowSelector.updateCombo(namesAndValues); + edgeFlowAreaSelector.updateCombo(namesAndValues); + kReturnSelector.updateCombo(namesAndValues); + kSupplySelector.updateCombo(namesAndValues); + tGroundSelector.updateCombo(namesAndValues); } private void updateVertexCombos(String[][] namesAndValues) { xCoordSelector.updateCombo(namesAndValues); yCoordSelector.updateCombo(namesAndValues); zValueSelector.updateCombo(namesAndValues); - pressureValueSelector.updateCombo(namesAndValues); - tempValueSelector.updateCombo(namesAndValues); + supplyTempValueSelector.updateCombo(namesAndValues); + returnTempValueSelector.updateCombo(namesAndValues); + supplyPressureValueSelector.updateCombo(namesAndValues); + returnPressureValueSelector.updateCombo(namesAndValues); + dpSelector.updateCombo(namesAndValues); + dtSelector.updateCombo(namesAndValues); + heatPowerSelector.updateCombo(namesAndValues); + valvePositionSelector.updateCombo(namesAndValues); + nominalHeadMSelector.updateCombo(namesAndValues); + nominalHeadBSelector.updateCombo(namesAndValues); + nominalFlowSelector.updateCombo(namesAndValues); + maximumHeadMSelector.updateCombo(namesAndValues); + heatLoadDsSelector.updateCombo(namesAndValues); + massFlowSelector.updateCombo(namesAndValues); + volFlowSelector.updateCombo(namesAndValues); + velocitySelector.updateCombo(namesAndValues); + flowAreaSelector.updateCombo(namesAndValues); + nominalPressureLossSelector.updateCombo(namesAndValues); } + + private void updateHeaders() { if (headerTable != null) 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 f123855d..6b22746c 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 @@ -46,6 +46,7 @@ public class DistrictImportUtils { Map delimiters = new HashMap<>(); delimiters.put("Comma", ','); delimiters.put("Semicolon", ';'); + delimiters.put("Tabulator", '\t'); return delimiters; } diff --git a/org.simantics.district.maps/build.properties b/org.simantics.district.maps/build.properties index 651748ee..e9863e28 100644 --- a/org.simantics.district.maps/build.properties +++ b/org.simantics.district.maps/build.properties @@ -1,4 +1,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ + .,\ plugin.xml diff --git a/org.simantics.district.maps/build.xml b/org.simantics.district.maps/build.xml deleted file mode 100644 index 5692f0cf..00000000 --- a/org.simantics.district.maps/build.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.simantics.district.maps/src/org/simantics/maps/MapScalingTransform.java b/org.simantics.district.maps/src/org/simantics/maps/MapScalingTransform.java index e208be71..f64a99f4 100644 --- a/org.simantics.district.maps/src/org/simantics/maps/MapScalingTransform.java +++ b/org.simantics.district.maps/src/org/simantics/maps/MapScalingTransform.java @@ -7,7 +7,7 @@ public class MapScalingTransform { private MapScalingTransform() { } - public static final AffineTransform INSTANCE = new AffineTransform(100000, 0, 0, 100000, 0, 0); + public static final AffineTransform INSTANCE = new AffineTransform(10000, 0, 0, 10000, 0, 0); public static double getScaleX() { return INSTANCE.getScaleX(); diff --git a/org.simantics.district.maps/src/org/simantics/maps/prefs/MapsClientPreferences.java b/org.simantics.district.maps/src/org/simantics/maps/prefs/MapsClientPreferences.java index 75ad19d6..fbc8b9e0 100644 --- a/org.simantics.district.maps/src/org/simantics/maps/prefs/MapsClientPreferences.java +++ b/org.simantics.district.maps/src/org/simantics/maps/prefs/MapsClientPreferences.java @@ -34,8 +34,8 @@ public class MapsClientPreferences { } public static String possibleBuiltinServerURL() { - int port = getServerPreferences().getInt(P_DEFAULT_PORT, -1); - String style = getServerPreferences().get(P_CURRENT_TM2STYLE, null); + int port = getServerPreferences().getInt(P_DEFAULT_PORT, 8585); + String style = getServerPreferences().get(P_CURRENT_TM2STYLE, "mapbox-studio-osm-bright.tm2"); if (port != -1 && style != null) { try { return new URL("http", "localhost", port, "/" + style).toString(); diff --git a/org.simantics.district.network.ontology/META-INF/MANIFEST.MF b/org.simantics.district.network.ontology/META-INF/MANIFEST.MF index 6ac026c7..16df5e15 100644 --- a/org.simantics.district.network.ontology/META-INF/MANIFEST.MF +++ b/org.simantics.district.network.ontology/META-INF/MANIFEST.MF @@ -10,6 +10,7 @@ Require-Bundle: org.simantics.layer0, org.simantics.viewpoint.ontology;bundle-version="1.2.0", org.simantics.image2.ontology;bundle-version="1.2.0", org.simantics.selectionview.ontology;bundle-version="1.2.0", - org.simantics.selectionview.ui.ontology;bundle-version="1.1.0" + org.simantics.selectionview.ui.ontology;bundle-version="1.1.0", + org.simantics.g2d.ontology;bundle-version="1.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.simantics.district.network.ontology diff --git a/org.simantics.district.network.ontology/graph.tg b/org.simantics.district.network.ontology/graph.tg index 9755fbfd..e7fb284f 100644 Binary files a/org.simantics.district.network.ontology/graph.tg and b/org.simantics.district.network.ontology/graph.tg differ diff --git a/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph b/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph index e819f445..e5089ee6 100644 --- a/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph +++ b/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph @@ -6,6 +6,7 @@ VP = IMAGE = SEL = SEL_UI = +G2D = DN = : L0.Ontology @L0.new @@ -50,6 +51,106 @@ DN.MappingParameterType -- DN.Mapping.OutputTerminal --> DN.Mapping.Terminal -- DN.Mapping.Id --> L0.String -- 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.VertexMapping.SupplyTemperatureAttribute --> L0.String -- DN.Mapping.VertexMapping.ReturnTemperatureAttribute --> L0.String -- DN.Mapping.VertexMapping.SupplyPressureAttribute --> L0.String -- DN.Mapping.VertexMapping.ReturnPressureAttribute --> L0.String -- DN.Mapping.VertexMapping.DeltaPressureAttribute --> L0.String -- DN.Mapping.VertexMapping.DeltaTemperatureAttribute --> L0.String -- DN.Mapping.Terminals --> DN.Mapping.TerminalPair -- DN.Mapping.VertexMapping.dpAttribute --> L0.String -- DN.Mapping.VertexMapping.dtAttribute --> L0.String -- DN.Mapping.VertexMapping.HeatPowerAttribute --> L0.String -- DN.Mapping.VertexMapping.NominalHeadMAttribute --> L0.String -- DN.Mapping.VertexMapping.NominalHeadBAttribute --> L0.String -- DN.Mapping.VertexMapping.NominalFlowAttribute --> L0.String -- DN.Mapping.VertexMapping.MaximumHeadMAttribute --> L0.String -- DN.Mapping.VertexMapping.HeatLoadDsAttribute --> L0.String -- DN.Mapping.VertexMapping.MassFlowAttribute --> L0.String -- DN.Mapping.VertexMapping.VolFlowAttribute --> L0.String -- DN.Mapping.VertexMapping.VelocityAttribute --> L0.String -- DN.Mapping.VertexMapping.FlowAreaAttribute --> L0.String -- DN.Mapping.VertexMapping.ValvePositionAttribute --> L0.String -- DN.Mapping.VertexMapping.NominalPressureLossAttribute --> L0.String -- DN.Mapping.VertexMapping.NominalMassFlowAttribute --> L0.String -- DN.Mapping.Id >-- 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.EdgeMapping.FlowAreaAttribute --> L0.String -- DN.Mapping.EdgeMapping.KReturnAttribute --> L0.String -- DN.Mapping.EdgeMapping.KSupplyAttribute --> L0.String -- DN.Mapping.EdgeMapping.TGroundAttribute --> L0.String -- DN.Mapping.Terminals + +DN.SCLMain : L0.SCLModule + L0.SCLModule.definition + """ + include "Simantics/District/SCLMain" + """ diff --git a/org.simantics.district.network.ontology/scl/Simantics/District/SCLMain.scl b/org.simantics.district.network.ontology/scl/Simantics/District/SCLMain.scl new file mode 100644 index 00000000..2d46af92 --- /dev/null +++ b/org.simantics.district.network.ontology/scl/Simantics/District/SCLMain.scl @@ -0,0 +1,13 @@ +import "Simantics/DB" +import "Simantics/Variables" + +districtNetworkProfileStyle :: String -> Resource -> (String, String, String) +districtNetworkProfileStyle relation element = do + rel = possibleResource relation + result = match rel with + Just rel -> do + match possibleRelatedValue element rel with + Just res -> res + Nothing -> "" + Nothing -> "" + ("", result, "") \ No newline at end of file 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 4adb19d3..452bb1c2 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 @@ -27,12 +27,20 @@ public class DistrictNetworkResource { public final Resource EdgeMappingParameterType; public final Resource Edge_HasDiameter; public final Resource Edge_HasDiameter_Inverse; + public final Resource Edge_HasFlowArea; + public final Resource Edge_HasFlowArea_Inverse; + public final Resource Edge_HasKReturn; + public final Resource Edge_HasKReturn_Inverse; + public final Resource Edge_HasKSupply; + public final Resource Edge_HasKSupply_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 Edge_HasTGround; + public final Resource Edge_HasTGround_Inverse; public final Resource Functions; public final Resource Functions_compositeInstantiator; public final Resource Functions_convertToValue; @@ -42,6 +50,8 @@ public class DistrictNetworkResource { public final Resource Functions_mappingModifier; public final Resource HasEndVertex; public final Resource HasEndVertex_Inverse; + public final Resource HasId; + public final Resource HasId_Inverse; public final Resource HasInLayerTag; public final Resource HasInLayerTag_Inverse; public final Resource HasMapping; @@ -67,12 +77,22 @@ public class DistrictNetworkResource { public final Resource Mapping_EdgeMapping; public final Resource Mapping_EdgeMapping_DiameterAttribute; public final Resource Mapping_EdgeMapping_DiameterAttribute_Inverse; + public final Resource Mapping_EdgeMapping_FlowAreaAttribute; + public final Resource Mapping_EdgeMapping_FlowAreaAttribute_Inverse; + public final Resource Mapping_EdgeMapping_KReturnAttribute; + public final Resource Mapping_EdgeMapping_KReturnAttribute_Inverse; + public final Resource Mapping_EdgeMapping_KSupplyAttribute; + public final Resource Mapping_EdgeMapping_KSupplyAttribute_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_EdgeMapping_TGroundAttribute; + public final Resource Mapping_EdgeMapping_TGroundAttribute_Inverse; + public final Resource Mapping_Id; + public final Resource Mapping_Id_Inverse; public final Resource Mapping_InputTerminal; public final Resource Mapping_InputTerminal_Inverse; public final Resource Mapping_OutputTerminal; @@ -82,23 +102,94 @@ public class DistrictNetworkResource { public final Resource Mapping_Terminals; public final Resource Mapping_Terminals_Inverse; public final Resource Mapping_VertexMapping; + public final Resource Mapping_VertexMapping_DeltaPressureAttribute; + public final Resource Mapping_VertexMapping_DeltaPressureAttribute_Inverse; + public final Resource Mapping_VertexMapping_DeltaTemperatureAttribute; + public final Resource Mapping_VertexMapping_DeltaTemperatureAttribute_Inverse; 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 Mapping_VertexMapping_FlowAreaAttribute; + public final Resource Mapping_VertexMapping_FlowAreaAttribute_Inverse; + public final Resource Mapping_VertexMapping_HeatLoadDsAttribute; + public final Resource Mapping_VertexMapping_HeatLoadDsAttribute_Inverse; + public final Resource Mapping_VertexMapping_HeatPowerAttribute; + public final Resource Mapping_VertexMapping_HeatPowerAttribute_Inverse; + public final Resource Mapping_VertexMapping_MassFlowAttribute; + public final Resource Mapping_VertexMapping_MassFlowAttribute_Inverse; + public final Resource Mapping_VertexMapping_MaximumHeadMAttribute; + public final Resource Mapping_VertexMapping_MaximumHeadMAttribute_Inverse; + public final Resource Mapping_VertexMapping_NominalFlowAttribute; + public final Resource Mapping_VertexMapping_NominalFlowAttribute_Inverse; + public final Resource Mapping_VertexMapping_NominalHeadBAttribute; + public final Resource Mapping_VertexMapping_NominalHeadBAttribute_Inverse; + public final Resource Mapping_VertexMapping_NominalHeadMAttribute; + public final Resource Mapping_VertexMapping_NominalHeadMAttribute_Inverse; + public final Resource Mapping_VertexMapping_NominalMassFlowAttribute; + public final Resource Mapping_VertexMapping_NominalMassFlowAttribute_Inverse; + public final Resource Mapping_VertexMapping_NominalPressureLossAttribute; + public final Resource Mapping_VertexMapping_NominalPressureLossAttribute_Inverse; + public final Resource Mapping_VertexMapping_ReturnPressureAttribute; + public final Resource Mapping_VertexMapping_ReturnPressureAttribute_Inverse; + public final Resource Mapping_VertexMapping_ReturnTemperatureAttribute; + public final Resource Mapping_VertexMapping_ReturnTemperatureAttribute_Inverse; + public final Resource Mapping_VertexMapping_SupplyPressureAttribute; + public final Resource Mapping_VertexMapping_SupplyPressureAttribute_Inverse; + public final Resource Mapping_VertexMapping_SupplyTemperatureAttribute; + public final Resource Mapping_VertexMapping_SupplyTemperatureAttribute_Inverse; + public final Resource Mapping_VertexMapping_ValvePositionAttribute; + public final Resource Mapping_VertexMapping_ValvePositionAttribute_Inverse; + public final Resource Mapping_VertexMapping_VelocityAttribute; + public final Resource Mapping_VertexMapping_VelocityAttribute_Inverse; + public final Resource Mapping_VertexMapping_VolFlowAttribute; + public final Resource Mapping_VertexMapping_VolFlowAttribute_Inverse; + public final Resource Mapping_VertexMapping_dpAttribute; + public final Resource Mapping_VertexMapping_dpAttribute_Inverse; + public final Resource Mapping_VertexMapping_dtAttribute; + public final Resource Mapping_VertexMapping_dtAttribute_Inverse; + public final Resource SCLMain; public final Resource SpatialRefSystem; public final Resource Vertex; public final Resource VertexDefaultMapping; public final Resource VertexDefaultMapping_Inverse; public final Resource VertexMappingParameterType; + public final Resource Vertex_HasDeltaPressure; + public final Resource Vertex_HasDeltaPressure_Inverse; + public final Resource Vertex_HasDeltaTemperature; + public final Resource Vertex_HasDeltaTemperature_Inverse; 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 final Resource Vertex_HasFlowArea; + public final Resource Vertex_HasFlowArea_Inverse; + public final Resource Vertex_HasHeatLoadDs; + public final Resource Vertex_HasHeatLoadDs_Inverse; + public final Resource Vertex_HasHeatPower; + public final Resource Vertex_HasHeatPower_Inverse; + public final Resource Vertex_HasMassFlow; + public final Resource Vertex_HasMassFlow_Inverse; + public final Resource Vertex_HasMaximumHeadM; + public final Resource Vertex_HasMaximumHeadM_Inverse; + public final Resource Vertex_HasNominalFlow; + public final Resource Vertex_HasNominalFlow_Inverse; + public final Resource Vertex_HasNominalHeadB; + public final Resource Vertex_HasNominalHeadB_Inverse; + public final Resource Vertex_HasNominalHeadM; + public final Resource Vertex_HasNominalHeadM_Inverse; + public final Resource Vertex_HasNominalPressureLoss; + public final Resource Vertex_HasNominalPressureLoss_Inverse; + public final Resource Vertex_HasReturnPressure; + public final Resource Vertex_HasReturnPressure_Inverse; + public final Resource Vertex_HasReturnTemperature; + public final Resource Vertex_HasReturnTemperature_Inverse; + public final Resource Vertex_HasSupplyPressure; + public final Resource Vertex_HasSupplyPressure_Inverse; + public final Resource Vertex_HasSupplyTemperature; + public final Resource Vertex_HasSupplyTemperature_Inverse; + public final Resource Vertex_HasValvePosition; + public final Resource Vertex_HasValvePosition_Inverse; + public final Resource Vertex_HasVelocity; + public final Resource Vertex_HasVelocity_Inverse; + public final Resource Vertex_HasVolFlow; + public final Resource Vertex_HasVolFlow_Inverse; public static class URIs { public static final String ActionContext = "http://www.simantics.org/DistrictNetwork-1.0/ActionContext"; @@ -118,12 +209,20 @@ public class DistrictNetworkResource { public static final String EdgeMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/EdgeMappingParameterType"; public static final String Edge_HasDiameter = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasDiameter"; public static final String Edge_HasDiameter_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasDiameter/Inverse"; + public static final String Edge_HasFlowArea = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasFlowArea"; + public static final String Edge_HasFlowArea_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasFlowArea/Inverse"; + public static final String Edge_HasKReturn = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasKReturn"; + public static final String Edge_HasKReturn_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasKReturn/Inverse"; + public static final String Edge_HasKSupply = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasKSupply"; + public static final String Edge_HasKSupply_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasKSupply/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 Edge_HasTGround = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasTGround"; + public static final String Edge_HasTGround_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasTGround/Inverse"; public static final String Functions = "http://www.simantics.org/DistrictNetwork-1.0/Functions"; public static final String Functions_compositeInstantiator = "http://www.simantics.org/DistrictNetwork-1.0/Functions/compositeInstantiator"; public static final String Functions_convertToValue = "http://www.simantics.org/DistrictNetwork-1.0/Functions/convertToValue"; @@ -133,6 +232,8 @@ public class DistrictNetworkResource { public static final String Functions_mappingModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/mappingModifier"; public static final String HasEndVertex = "http://www.simantics.org/DistrictNetwork-1.0/HasEndVertex"; public static final String HasEndVertex_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/HasEndVertex_Inverse"; + public static final String HasId = "http://www.simantics.org/DistrictNetwork-1.0/HasId"; + public static final String HasId_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/HasId/Inverse"; public static final String HasInLayerTag = "http://www.simantics.org/DistrictNetwork-1.0/HasInLayerTag"; public static final String HasInLayerTag_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/HasInLayerTag/Inverse"; public static final String HasMapping = "http://www.simantics.org/DistrictNetwork-1.0/HasMapping"; @@ -158,12 +259,22 @@ public class DistrictNetworkResource { public static final String Mapping_EdgeMapping = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping"; public static final String Mapping_EdgeMapping_DiameterAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/DiameterAttribute"; 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_FlowAreaAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/FlowAreaAttribute"; + public static final String Mapping_EdgeMapping_FlowAreaAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/FlowAreaAttribute/Inverse"; + public static final String Mapping_EdgeMapping_KReturnAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/KReturnAttribute"; + public static final String Mapping_EdgeMapping_KReturnAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/KReturnAttribute/Inverse"; + public static final String Mapping_EdgeMapping_KSupplyAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/KSupplyAttribute"; + public static final String Mapping_EdgeMapping_KSupplyAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/KSupplyAttribute/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_EdgeMapping_TGroundAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/TGroundAttribute"; + public static final String Mapping_EdgeMapping_TGroundAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/TGroundAttribute/Inverse"; + public static final String Mapping_Id = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Id"; + public static final String Mapping_Id_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Id/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"; @@ -173,23 +284,94 @@ public class DistrictNetworkResource { public static final String Mapping_Terminals = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Terminals"; public static final String Mapping_Terminals_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Terminals/Inverse"; public static final String Mapping_VertexMapping = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping"; + public static final String Mapping_VertexMapping_DeltaPressureAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/DeltaPressureAttribute"; + public static final String Mapping_VertexMapping_DeltaPressureAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/DeltaPressureAttribute/Inverse"; + public static final String Mapping_VertexMapping_DeltaTemperatureAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/DeltaTemperatureAttribute"; + public static final String Mapping_VertexMapping_DeltaTemperatureAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/DeltaTemperatureAttribute/Inverse"; 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 Mapping_VertexMapping_FlowAreaAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/FlowAreaAttribute"; + public static final String Mapping_VertexMapping_FlowAreaAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/FlowAreaAttribute/Inverse"; + public static final String Mapping_VertexMapping_HeatLoadDsAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/HeatLoadDsAttribute"; + public static final String Mapping_VertexMapping_HeatLoadDsAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/HeatLoadDsAttribute/Inverse"; + public static final String Mapping_VertexMapping_HeatPowerAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/HeatPowerAttribute"; + public static final String Mapping_VertexMapping_HeatPowerAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/HeatPowerAttribute/Inverse"; + public static final String Mapping_VertexMapping_MassFlowAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/MassFlowAttribute"; + public static final String Mapping_VertexMapping_MassFlowAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/MassFlowAttribute/Inverse"; + public static final String Mapping_VertexMapping_MaximumHeadMAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/MaximumHeadMAttribute"; + public static final String Mapping_VertexMapping_MaximumHeadMAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/MaximumHeadMAttribute/Inverse"; + public static final String Mapping_VertexMapping_NominalFlowAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/NominalFlowAttribute"; + public static final String Mapping_VertexMapping_NominalFlowAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/NominalFlowAttribute/Inverse"; + public static final String Mapping_VertexMapping_NominalHeadBAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/NominalHeadBAttribute"; + public static final String Mapping_VertexMapping_NominalHeadBAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/NominalHeadBAttribute/Inverse"; + public static final String Mapping_VertexMapping_NominalHeadMAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/NominalHeadMAttribute"; + public static final String Mapping_VertexMapping_NominalHeadMAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/NominalHeadMAttribute/Inverse"; + public static final String Mapping_VertexMapping_NominalMassFlowAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/NominalMassFlowAttribute"; + public static final String Mapping_VertexMapping_NominalMassFlowAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/NominalMassFlowAttribute/Inverse"; + public static final String Mapping_VertexMapping_NominalPressureLossAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/NominalPressureLossAttribute"; + public static final String Mapping_VertexMapping_NominalPressureLossAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/NominalPressureLossAttribute/Inverse"; + public static final String Mapping_VertexMapping_ReturnPressureAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/ReturnPressureAttribute"; + public static final String Mapping_VertexMapping_ReturnPressureAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/ReturnPressureAttribute/Inverse"; + public static final String Mapping_VertexMapping_ReturnTemperatureAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/ReturnTemperatureAttribute"; + public static final String Mapping_VertexMapping_ReturnTemperatureAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/ReturnTemperatureAttribute/Inverse"; + public static final String Mapping_VertexMapping_SupplyPressureAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/SupplyPressureAttribute"; + public static final String Mapping_VertexMapping_SupplyPressureAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/SupplyPressureAttribute/Inverse"; + public static final String Mapping_VertexMapping_SupplyTemperatureAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/SupplyTemperatureAttribute"; + public static final String Mapping_VertexMapping_SupplyTemperatureAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/SupplyTemperatureAttribute/Inverse"; + public static final String Mapping_VertexMapping_ValvePositionAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/ValvePositionAttribute"; + public static final String Mapping_VertexMapping_ValvePositionAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/ValvePositionAttribute/Inverse"; + public static final String Mapping_VertexMapping_VelocityAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/VelocityAttribute"; + public static final String Mapping_VertexMapping_VelocityAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/VelocityAttribute/Inverse"; + public static final String Mapping_VertexMapping_VolFlowAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/VolFlowAttribute"; + public static final String Mapping_VertexMapping_VolFlowAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/VolFlowAttribute/Inverse"; + public static final String Mapping_VertexMapping_dpAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/dpAttribute"; + public static final String Mapping_VertexMapping_dpAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/dpAttribute/Inverse"; + public static final String Mapping_VertexMapping_dtAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/dtAttribute"; + public static final String Mapping_VertexMapping_dtAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/dtAttribute/Inverse"; + public static final String SCLMain = "http://www.simantics.org/DistrictNetwork-1.0/SCLMain"; 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"; public static final String VertexDefaultMapping_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/VertexDefaultMapping/Inverse"; public static final String VertexMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/VertexMappingParameterType"; + public static final String Vertex_HasDeltaPressure = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasDeltaPressure"; + public static final String Vertex_HasDeltaPressure_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasDeltaPressure/Inverse"; + public static final String Vertex_HasDeltaTemperature = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasDeltaTemperature"; + public static final String Vertex_HasDeltaTemperature_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasDeltaTemperature/Inverse"; 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 final String Vertex_HasFlowArea = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasFlowArea"; + public static final String Vertex_HasFlowArea_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasFlowArea/Inverse"; + public static final String Vertex_HasHeatLoadDs = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasHeatLoadDs"; + public static final String Vertex_HasHeatLoadDs_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasHeatLoadDs/Inverse"; + public static final String Vertex_HasHeatPower = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasHeatPower"; + public static final String Vertex_HasHeatPower_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasHeatPower/Inverse"; + public static final String Vertex_HasMassFlow = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasMassFlow"; + public static final String Vertex_HasMassFlow_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasMassFlow/Inverse"; + public static final String Vertex_HasMaximumHeadM = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasMaximumHeadM"; + public static final String Vertex_HasMaximumHeadM_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasMaximumHeadM/Inverse"; + public static final String Vertex_HasNominalFlow = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasNominalFlow"; + public static final String Vertex_HasNominalFlow_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasNominalFlow/Inverse"; + public static final String Vertex_HasNominalHeadB = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasNominalHeadB"; + public static final String Vertex_HasNominalHeadB_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasNominalHeadB/Inverse"; + public static final String Vertex_HasNominalHeadM = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasNominalHeadM"; + public static final String Vertex_HasNominalHeadM_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasNominalHeadM/Inverse"; + public static final String Vertex_HasNominalPressureLoss = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasNominalPressureLoss"; + public static final String Vertex_HasNominalPressureLoss_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasNominalPressureLoss/Inverse"; + public static final String Vertex_HasReturnPressure = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasReturnPressure"; + public static final String Vertex_HasReturnPressure_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasReturnPressure/Inverse"; + public static final String Vertex_HasReturnTemperature = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasReturnTemperature"; + public static final String Vertex_HasReturnTemperature_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasReturnTemperature/Inverse"; + public static final String Vertex_HasSupplyPressure = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasSupplyPressure"; + public static final String Vertex_HasSupplyPressure_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasSupplyPressure/Inverse"; + public static final String Vertex_HasSupplyTemperature = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasSupplyTemperature"; + public static final String Vertex_HasSupplyTemperature_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasSupplyTemperature/Inverse"; + public static final String Vertex_HasValvePosition = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasValvePosition"; + public static final String Vertex_HasValvePosition_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasValvePosition/Inverse"; + public static final String Vertex_HasVelocity = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasVelocity"; + public static final String Vertex_HasVelocity_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasVelocity/Inverse"; + public static final String Vertex_HasVolFlow = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasVolFlow"; + public static final String Vertex_HasVolFlow_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasVolFlow/Inverse"; } public static Resource getResourceOrNull(ReadGraph graph, String uri) { @@ -219,12 +401,20 @@ public class DistrictNetworkResource { EdgeMappingParameterType = getResourceOrNull(graph, URIs.EdgeMappingParameterType); Edge_HasDiameter = getResourceOrNull(graph, URIs.Edge_HasDiameter); Edge_HasDiameter_Inverse = getResourceOrNull(graph, URIs.Edge_HasDiameter_Inverse); + Edge_HasFlowArea = getResourceOrNull(graph, URIs.Edge_HasFlowArea); + Edge_HasFlowArea_Inverse = getResourceOrNull(graph, URIs.Edge_HasFlowArea_Inverse); + Edge_HasKReturn = getResourceOrNull(graph, URIs.Edge_HasKReturn); + Edge_HasKReturn_Inverse = getResourceOrNull(graph, URIs.Edge_HasKReturn_Inverse); + Edge_HasKSupply = getResourceOrNull(graph, URIs.Edge_HasKSupply); + Edge_HasKSupply_Inverse = getResourceOrNull(graph, URIs.Edge_HasKSupply_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); + Edge_HasTGround = getResourceOrNull(graph, URIs.Edge_HasTGround); + Edge_HasTGround_Inverse = getResourceOrNull(graph, URIs.Edge_HasTGround_Inverse); Functions = getResourceOrNull(graph, URIs.Functions); Functions_compositeInstantiator = getResourceOrNull(graph, URIs.Functions_compositeInstantiator); Functions_convertToValue = getResourceOrNull(graph, URIs.Functions_convertToValue); @@ -234,6 +424,8 @@ public class DistrictNetworkResource { Functions_mappingModifier = getResourceOrNull(graph, URIs.Functions_mappingModifier); HasEndVertex = getResourceOrNull(graph, URIs.HasEndVertex); HasEndVertex_Inverse = getResourceOrNull(graph, URIs.HasEndVertex_Inverse); + HasId = getResourceOrNull(graph, URIs.HasId); + HasId_Inverse = getResourceOrNull(graph, URIs.HasId_Inverse); HasInLayerTag = getResourceOrNull(graph, URIs.HasInLayerTag); HasInLayerTag_Inverse = getResourceOrNull(graph, URIs.HasInLayerTag_Inverse); HasMapping = getResourceOrNull(graph, URIs.HasMapping); @@ -259,12 +451,22 @@ public class DistrictNetworkResource { Mapping_EdgeMapping = getResourceOrNull(graph, URIs.Mapping_EdgeMapping); Mapping_EdgeMapping_DiameterAttribute = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_DiameterAttribute); Mapping_EdgeMapping_DiameterAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_DiameterAttribute_Inverse); + Mapping_EdgeMapping_FlowAreaAttribute = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_FlowAreaAttribute); + Mapping_EdgeMapping_FlowAreaAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_FlowAreaAttribute_Inverse); + Mapping_EdgeMapping_KReturnAttribute = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_KReturnAttribute); + Mapping_EdgeMapping_KReturnAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_KReturnAttribute_Inverse); + Mapping_EdgeMapping_KSupplyAttribute = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_KSupplyAttribute); + Mapping_EdgeMapping_KSupplyAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_KSupplyAttribute_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_EdgeMapping_TGroundAttribute = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_TGroundAttribute); + Mapping_EdgeMapping_TGroundAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_TGroundAttribute_Inverse); + Mapping_Id = getResourceOrNull(graph, URIs.Mapping_Id); + Mapping_Id_Inverse = getResourceOrNull(graph, URIs.Mapping_Id_Inverse); Mapping_InputTerminal = getResourceOrNull(graph, URIs.Mapping_InputTerminal); Mapping_InputTerminal_Inverse = getResourceOrNull(graph, URIs.Mapping_InputTerminal_Inverse); Mapping_OutputTerminal = getResourceOrNull(graph, URIs.Mapping_OutputTerminal); @@ -274,23 +476,94 @@ public class DistrictNetworkResource { Mapping_Terminals = getResourceOrNull(graph, URIs.Mapping_Terminals); Mapping_Terminals_Inverse = getResourceOrNull(graph, URIs.Mapping_Terminals_Inverse); Mapping_VertexMapping = getResourceOrNull(graph, URIs.Mapping_VertexMapping); + Mapping_VertexMapping_DeltaPressureAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_DeltaPressureAttribute); + Mapping_VertexMapping_DeltaPressureAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_DeltaPressureAttribute_Inverse); + Mapping_VertexMapping_DeltaTemperatureAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_DeltaTemperatureAttribute); + Mapping_VertexMapping_DeltaTemperatureAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_DeltaTemperatureAttribute_Inverse); 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); + Mapping_VertexMapping_FlowAreaAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_FlowAreaAttribute); + Mapping_VertexMapping_FlowAreaAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_FlowAreaAttribute_Inverse); + Mapping_VertexMapping_HeatLoadDsAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_HeatLoadDsAttribute); + Mapping_VertexMapping_HeatLoadDsAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_HeatLoadDsAttribute_Inverse); + Mapping_VertexMapping_HeatPowerAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_HeatPowerAttribute); + Mapping_VertexMapping_HeatPowerAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_HeatPowerAttribute_Inverse); + Mapping_VertexMapping_MassFlowAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_MassFlowAttribute); + Mapping_VertexMapping_MassFlowAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_MassFlowAttribute_Inverse); + Mapping_VertexMapping_MaximumHeadMAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_MaximumHeadMAttribute); + Mapping_VertexMapping_MaximumHeadMAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_MaximumHeadMAttribute_Inverse); + Mapping_VertexMapping_NominalFlowAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_NominalFlowAttribute); + Mapping_VertexMapping_NominalFlowAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_NominalFlowAttribute_Inverse); + Mapping_VertexMapping_NominalHeadBAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_NominalHeadBAttribute); + Mapping_VertexMapping_NominalHeadBAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_NominalHeadBAttribute_Inverse); + Mapping_VertexMapping_NominalHeadMAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_NominalHeadMAttribute); + Mapping_VertexMapping_NominalHeadMAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_NominalHeadMAttribute_Inverse); + Mapping_VertexMapping_NominalMassFlowAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_NominalMassFlowAttribute); + Mapping_VertexMapping_NominalMassFlowAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_NominalMassFlowAttribute_Inverse); + Mapping_VertexMapping_NominalPressureLossAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_NominalPressureLossAttribute); + Mapping_VertexMapping_NominalPressureLossAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_NominalPressureLossAttribute_Inverse); + Mapping_VertexMapping_ReturnPressureAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_ReturnPressureAttribute); + Mapping_VertexMapping_ReturnPressureAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_ReturnPressureAttribute_Inverse); + Mapping_VertexMapping_ReturnTemperatureAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_ReturnTemperatureAttribute); + Mapping_VertexMapping_ReturnTemperatureAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_ReturnTemperatureAttribute_Inverse); + Mapping_VertexMapping_SupplyPressureAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_SupplyPressureAttribute); + Mapping_VertexMapping_SupplyPressureAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_SupplyPressureAttribute_Inverse); + Mapping_VertexMapping_SupplyTemperatureAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_SupplyTemperatureAttribute); + Mapping_VertexMapping_SupplyTemperatureAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_SupplyTemperatureAttribute_Inverse); + Mapping_VertexMapping_ValvePositionAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_ValvePositionAttribute); + Mapping_VertexMapping_ValvePositionAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_ValvePositionAttribute_Inverse); + Mapping_VertexMapping_VelocityAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_VelocityAttribute); + Mapping_VertexMapping_VelocityAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_VelocityAttribute_Inverse); + Mapping_VertexMapping_VolFlowAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_VolFlowAttribute); + Mapping_VertexMapping_VolFlowAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_VolFlowAttribute_Inverse); + Mapping_VertexMapping_dpAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_dpAttribute); + Mapping_VertexMapping_dpAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_dpAttribute_Inverse); + Mapping_VertexMapping_dtAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_dtAttribute); + Mapping_VertexMapping_dtAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_dtAttribute_Inverse); + SCLMain = getResourceOrNull(graph, URIs.SCLMain); SpatialRefSystem = getResourceOrNull(graph, URIs.SpatialRefSystem); Vertex = getResourceOrNull(graph, URIs.Vertex); VertexDefaultMapping = getResourceOrNull(graph, URIs.VertexDefaultMapping); VertexDefaultMapping_Inverse = getResourceOrNull(graph, URIs.VertexDefaultMapping_Inverse); VertexMappingParameterType = getResourceOrNull(graph, URIs.VertexMappingParameterType); + Vertex_HasDeltaPressure = getResourceOrNull(graph, URIs.Vertex_HasDeltaPressure); + Vertex_HasDeltaPressure_Inverse = getResourceOrNull(graph, URIs.Vertex_HasDeltaPressure_Inverse); + Vertex_HasDeltaTemperature = getResourceOrNull(graph, URIs.Vertex_HasDeltaTemperature); + Vertex_HasDeltaTemperature_Inverse = getResourceOrNull(graph, URIs.Vertex_HasDeltaTemperature_Inverse); 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); + Vertex_HasFlowArea = getResourceOrNull(graph, URIs.Vertex_HasFlowArea); + Vertex_HasFlowArea_Inverse = getResourceOrNull(graph, URIs.Vertex_HasFlowArea_Inverse); + Vertex_HasHeatLoadDs = getResourceOrNull(graph, URIs.Vertex_HasHeatLoadDs); + Vertex_HasHeatLoadDs_Inverse = getResourceOrNull(graph, URIs.Vertex_HasHeatLoadDs_Inverse); + Vertex_HasHeatPower = getResourceOrNull(graph, URIs.Vertex_HasHeatPower); + Vertex_HasHeatPower_Inverse = getResourceOrNull(graph, URIs.Vertex_HasHeatPower_Inverse); + Vertex_HasMassFlow = getResourceOrNull(graph, URIs.Vertex_HasMassFlow); + Vertex_HasMassFlow_Inverse = getResourceOrNull(graph, URIs.Vertex_HasMassFlow_Inverse); + Vertex_HasMaximumHeadM = getResourceOrNull(graph, URIs.Vertex_HasMaximumHeadM); + Vertex_HasMaximumHeadM_Inverse = getResourceOrNull(graph, URIs.Vertex_HasMaximumHeadM_Inverse); + Vertex_HasNominalFlow = getResourceOrNull(graph, URIs.Vertex_HasNominalFlow); + Vertex_HasNominalFlow_Inverse = getResourceOrNull(graph, URIs.Vertex_HasNominalFlow_Inverse); + Vertex_HasNominalHeadB = getResourceOrNull(graph, URIs.Vertex_HasNominalHeadB); + Vertex_HasNominalHeadB_Inverse = getResourceOrNull(graph, URIs.Vertex_HasNominalHeadB_Inverse); + Vertex_HasNominalHeadM = getResourceOrNull(graph, URIs.Vertex_HasNominalHeadM); + Vertex_HasNominalHeadM_Inverse = getResourceOrNull(graph, URIs.Vertex_HasNominalHeadM_Inverse); + Vertex_HasNominalPressureLoss = getResourceOrNull(graph, URIs.Vertex_HasNominalPressureLoss); + Vertex_HasNominalPressureLoss_Inverse = getResourceOrNull(graph, URIs.Vertex_HasNominalPressureLoss_Inverse); + Vertex_HasReturnPressure = getResourceOrNull(graph, URIs.Vertex_HasReturnPressure); + Vertex_HasReturnPressure_Inverse = getResourceOrNull(graph, URIs.Vertex_HasReturnPressure_Inverse); + Vertex_HasReturnTemperature = getResourceOrNull(graph, URIs.Vertex_HasReturnTemperature); + Vertex_HasReturnTemperature_Inverse = getResourceOrNull(graph, URIs.Vertex_HasReturnTemperature_Inverse); + Vertex_HasSupplyPressure = getResourceOrNull(graph, URIs.Vertex_HasSupplyPressure); + Vertex_HasSupplyPressure_Inverse = getResourceOrNull(graph, URIs.Vertex_HasSupplyPressure_Inverse); + Vertex_HasSupplyTemperature = getResourceOrNull(graph, URIs.Vertex_HasSupplyTemperature); + Vertex_HasSupplyTemperature_Inverse = getResourceOrNull(graph, URIs.Vertex_HasSupplyTemperature_Inverse); + Vertex_HasValvePosition = getResourceOrNull(graph, URIs.Vertex_HasValvePosition); + Vertex_HasValvePosition_Inverse = getResourceOrNull(graph, URIs.Vertex_HasValvePosition_Inverse); + Vertex_HasVelocity = getResourceOrNull(graph, URIs.Vertex_HasVelocity); + Vertex_HasVelocity_Inverse = getResourceOrNull(graph, URIs.Vertex_HasVelocity_Inverse); + Vertex_HasVolFlow = getResourceOrNull(graph, URIs.Vertex_HasVolFlow); + Vertex_HasVolFlow_Inverse = getResourceOrNull(graph, URIs.Vertex_HasVolFlow_Inverse); } public static DistrictNetworkResource getInstance(ReadGraph graph) { diff --git a/org.simantics.district.network.ui.ontology/graph.tg b/org.simantics.district.network.ui.ontology/graph.tg index 2815e2f3..bb507c21 100644 Binary files a/org.simantics.district.network.ui.ontology/graph.tg and b/org.simantics.district.network.ui.ontology/graph.tg differ diff --git a/org.simantics.district.network.ui/build.properties b/org.simantics.district.network.ui/build.properties index 1ab42f55..9046ecdf 100644 --- a/org.simantics.district.network.ui/build.properties +++ b/org.simantics.district.network.ui/build.properties @@ -1,7 +1,8 @@ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - fragment.e4xmi,\ - plugin.xml,\ - adapters.xml -source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + fragment.e4xmi,\ + plugin.xml,\ + adapters.xml,\ + icons/ +source.. = src/ diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java index eb081445..c2238d8e 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java @@ -37,11 +37,15 @@ public class DNEdgeBuilder { } public static Resource create(WriteGraph graph, Resource diagramResource, double[] start, double[] end, double padding) throws DatabaseException { + return create(graph, diagramResource, null, start, end, padding); + } + + public static Resource create(WriteGraph graph, Resource diagramResource, Resource mapping, double[] start, double[] end, double padding) throws DatabaseException { DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); // 1. Get diagram edge to construct - Resource edge = getOrCreateEdge(graph, diagramResource); + Resource edge = getOrCreateEdge(graph, diagramResource, mapping); // 2. Add vertices Collection vertices = graph.syncRequest(new ObjectsWithType(diagramResource, Layer0.getInstance(graph).ConsistsOf, DistrictNetworkResource.getInstance(graph).Vertex)); @@ -102,8 +106,8 @@ public class DNEdgeBuilder { return vertex; } - private static Resource getOrCreateEdge(WriteGraph graph, Resource diagramResource) throws DatabaseException { - return DistrictNetworkUtil.createEdge(graph, diagramResource); + private static Resource getOrCreateEdge(WriteGraph graph, Resource diagramResource, Resource mapping) throws DatabaseException { + return DistrictNetworkUtil.createEdge(graph, diagramResource, mapping); } } diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkAdditionalColor.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkAdditionalColor.java index ef3b10c9..dcf556ed 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkAdditionalColor.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkAdditionalColor.java @@ -17,12 +17,28 @@ public class DistrictNetworkAdditionalColor implements AdditionalColor { public static final Key KEY_DN_MAPPING_RESOURCE = new KeyOf(Resource.class, "DN_MAPPING_RESOURCE"); private static final long serialVersionUID = -6290147660355075322L; + + private static final org.simantics.utils.ui.color.Color lightBlue = new org.simantics.utils.ui.color.Color(34, 167, 240); + private static final org.simantics.utils.ui.color.Color lightRed = new org.simantics.utils.ui.color.Color(236, 100, 75); + private static final org.simantics.utils.ui.color.Color lightGreen = new org.simantics.utils.ui.color.Color(135, 211, 124); + private static final org.simantics.utils.ui.color.Color gray = new org.simantics.utils.ui.color.Color(108, 122, 137); + private static final org.simantics.utils.ui.color.Color orange = new org.simantics.utils.ui.color.Color(243, 156, 18); + private static final org.simantics.utils.ui.color.Color purple = new org.simantics.utils.ui.color.Color(190, 144, 212); public static final ElementHandler INSTANCE = new DistrictNetworkAdditionalColor(); private ColorPool colorPool = new ColorPool(); private List mappings = new ArrayList<>(); + public DistrictNetworkAdditionalColor() { + colorPool.add(lightBlue); + colorPool.add(lightRed); + colorPool.add(lightGreen); + colorPool.add(gray); + colorPool.add(orange); + colorPool.add(purple); + } + @Override public void setAdditionalColor(IElement e, Color c) { throw new UnsupportedOperationException("Not needed!"); diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java index b6132d20..d80082ec 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java @@ -35,7 +35,6 @@ import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.IndexRoot; -import org.simantics.db.common.request.IndexRoots; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.common.request.ReadRequest; import org.simantics.db.common.request.WriteRequest; @@ -123,7 +122,10 @@ public class Functions { mappings.forEach(mapping -> { try { String name = graph.getRelatedValue2(mapping, L0.HasName); - result.put(name, mapping); + Resource existing = result.put(name, mapping); + if (existing != null) { + LOGGER.warn("Duplicate mapping name! {} {} and existing is {}", name, mapping, existing); + } } catch (DatabaseException e) { e.printStackTrace(); } diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java index cd35b2f0..745f2a80 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java @@ -33,7 +33,6 @@ public class DistrictNetworkEdgeNode extends G2DNode { @Override public void init() { - } @Override diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java index 011d682e..c566981e 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java @@ -11,6 +11,7 @@ import java.awt.geom.Rectangle2D; import org.simantics.district.network.ModelledCRS; import org.simantics.district.network.ui.adapters.DistrictNetworkVertex; +import org.simantics.scenegraph.ParentNode; import org.simantics.scenegraph.g2d.G2DNode; import org.simantics.scenegraph.utils.GeometryUtils; import org.slf4j.Logger; @@ -116,6 +117,11 @@ public class DistrictNetworkVertexNode extends G2DNode { updateBounds(); } + @Override + public AffineTransform getTransform() { + return super.getTransform(); + } + private Rectangle2D calculateBounds(Rectangle2D rect) { Point2D calcPoint = calculatePoint2D(vertex); AffineTransform at = getTransform(); diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/participants/DNTranslateMode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/participants/DNTranslateMode.java index 9132fa2f..fda0fc71 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/participants/DNTranslateMode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/participants/DNTranslateMode.java @@ -5,6 +5,8 @@ import java.awt.geom.Point2D; import java.util.ArrayList; import java.util.Collection; +import javax.xml.bind.DataBindingException; + import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -40,7 +42,7 @@ public class DNTranslateMode extends TranslateMode { Object obj = ElementUtils.getObject(e); - if (obj instanceof Resource) { + if (obj instanceof Resource && graph.isInstanceOf((Resource) obj, DN.Vertex)) { Resource res = (Resource) obj; diff --git a/org.simantics.district.network/build.properties b/org.simantics.district.network/build.properties index d7586c21..21a6c989 100644 --- a/org.simantics.district.network/build.properties +++ b/org.simantics.district.network/build.properties @@ -1,5 +1,6 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - adapters.xml +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + adapters.xml,\ + scl/ diff --git a/org.simantics.district.network/scl/Simantics/District.scl b/org.simantics.district.network/scl/Simantics/District.scl index 8025c9ad..c92cc4cc 100644 --- a/org.simantics.district.network/scl/Simantics/District.scl +++ b/org.simantics.district.network/scl/Simantics/District.scl @@ -1,4 +1,8 @@ import "Simantics/DB" +import "Simantics/Ontologies" + +import "Map" as Map +import "MSet" as MSet importJava "org.simantics.district.network.DistrictNetworkUtil" where calculateDistance :: Resource -> Resource -> Double @@ -7,4 +11,70 @@ importJava "org.simantics.district.network.ModelledCRS" where xToLongitude :: Double -> Double yToLatitude :: Double -> Double longitudeToX :: Double -> Double - latitudeToY :: Double -> Double \ No newline at end of file + latitudeToY :: Double -> Double + +findBrokenConnections :: Resource -> () +findBrokenConnections diagram = do + elements = objectsWithType diagram L0.ConsistsOf DIA.DefinedElement + print $ "Found " + show (length elements) + " elements from diagram" + symbols = MMap.create () + iter (\el -> do + symbol = singleObject el L0.InstanceOf + print $ "Found symbol " + uriOf symbol + ccs = collectionToList $ objects_ symbol L0.ConsistsOf + connectionPointRelations = filter (\cc -> isSubrelationOf cc STR.IsConnectedTo) ccs + print $ "Found " + show (length connectionPointRelations) + " cprs" + iter (\cpr -> do + connectionPoints = objectsWithType el cpr DIA.Connector + print $ "Found " + show (length connectionPoints) + " cps" + if length connectionPoints > 1 /*|| length connectionPoints == 0*/ + then do + // get existing map + print $ "Found " + show (length connectionPoints) + " connections for element " + nameOf el + instances = match MMap.get symbols (uriOf symbol) with + Just m -> m + Nothing -> do + set = MSet.create () + MMap.put symbols (uriOf symbol) set + set + ignore $ MSet.add instances $ singleObject el MOD.ElementToComponent + else () + () + ) connectionPointRelations + ) elements + MMap.iter (\key val -> do + print key + MSet.iter (\v -> print (nameOf v)) val + () + ) symbols + () + +translateAllElements :: Resource -> () +translateAllElements diagram = do + print $ "Translating elements of diagram " + uriOf diagram + elements = objectsWithType diagram L0.ConsistsOf DIA.DefinedElement + print $ "Found " + show (length elements) + " elements from diagram" + iter (\el -> do + connectionPoints = objectsWithType el STR.IsConnectedTo DIA.Connector + print $ "Found " + show (length connectionPoints) + " connections for element " + nameOf el + ) elements + + +translateElement :: Resource -> () +translateElement elem = do + connectionPoints = objectsWithType elem STR.IsConnectedTo DIA.Connector + if length connectionPoints < 5 + then do //this we can handle + areConnected = MSet.create () + iter (\cp -> do + aconnector = singleObject cp DIA.AreConnected + //otherElem + () + ) [] + //if length areConnected == 2 + //then do // this we can handle - only two symbols + // () + //else () + () + else () + () diff --git a/org.simantics.district.network/src/org/simantics/district/network/DistrictNetworkUtil.java b/org.simantics.district.network/src/org/simantics/district/network/DistrictNetworkUtil.java index 9f6f46fa..165e6e96 100644 --- a/org.simantics.district.network/src/org/simantics/district/network/DistrictNetworkUtil.java +++ b/org.simantics.district.network/src/org/simantics/district/network/DistrictNetworkUtil.java @@ -20,16 +20,22 @@ import org.simantics.operation.Layer0X; public class DistrictNetworkUtil { public static Resource createEdge(WriteGraph graph, Resource composite) throws DatabaseException { + return createEdge(graph, composite, graph.getPossibleObject(composite, DistrictNetworkResource.getInstance(graph).EdgeDefaultMapping)); + } + + public static Resource createEdge(WriteGraph graph, Resource composite, Resource mapping) throws DatabaseException { Layer0 L0 = Layer0.getInstance(graph); DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); + if (mapping == null) { + mapping = graph.getSingleObject(composite, DN.EdgeDefaultMapping); + } Resource edge = graph.newResource(); graph.claim(edge, L0.InstanceOf, DN.Edge); - Resource defaultEdgeMapping = graph.getPossibleObject(composite, DN.EdgeDefaultMapping); - graph.claim(edge, DN.HasMapping, defaultEdgeMapping); + graph.claim(edge, DN.HasMapping, mapping); - OrderedSetUtils.add(graph, composite, edge); + OrderedSetUtils.addFirst(graph, composite, edge); graph.claim(composite, L0.ConsistsOf, L0.PartOf, edge); claimFreshElementName(graph, composite, edge); diff --git a/org.simantics.maps.server/build.properties b/org.simantics.maps.server/build.properties index c049e419..f581e84f 100644 --- a/org.simantics.maps.server/build.properties +++ b/org.simantics.maps.server/build.properties @@ -2,12 +2,7 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - lib/zt-exec-1.9.jar,\ - lib/commons-io-2.5.jar,\ - lib/slf4j-api-1.7.24.jar,\ - lib/logback-classic-1.2.1.jar,\ - lib/logback-core-1.2.1.jar,\ - lib/snakeyaml-1.18.jar,\ - lib/jna-4.3.0.jar,\ - lib/zt-process-killer-1.6.jar,\ - plugin.xml + plugin.xml,\ + node/,\ + server/,\ + lib/ diff --git a/org.simantics.maps.server/server/data/2017-03-20_v3.5_england_london.mbtiles b/org.simantics.maps.server/server/data/2017-03-20_v3.5_england_london.mbtiles new file mode 100644 index 00000000..79cf29ba Binary files /dev/null and b/org.simantics.maps.server/server/data/2017-03-20_v3.5_england_london.mbtiles differ diff --git a/org.simantics.maps.server/src/org/simantics/district/maps/server/prefs/MapsServerInitializer.java b/org.simantics.maps.server/src/org/simantics/district/maps/server/prefs/MapsServerInitializer.java index 365a9ee8..bd892b39 100644 --- a/org.simantics.maps.server/src/org/simantics/district/maps/server/prefs/MapsServerInitializer.java +++ b/org.simantics.maps.server/src/org/simantics/district/maps/server/prefs/MapsServerInitializer.java @@ -20,7 +20,7 @@ public class MapsServerInitializer extends AbstractPreferenceInitializer { node.putBoolean(MapsServerPreferences.P_START_AUTOMATICALLY, true); } if (!keyss.contains(MapsServerPreferences.P_DEFAULT_PORT)) { - node.putInt(MapsServerPreferences.P_DEFAULT_PORT, 8080); + node.putInt(MapsServerPreferences.P_DEFAULT_PORT, 8585); } } catch (BackingStoreException e) { e.printStackTrace(); diff --git a/org.simantics.maps.server/src/org/simantics/district/maps/server/prefs/MapsServerPreferences.java b/org.simantics.maps.server/src/org/simantics/district/maps/server/prefs/MapsServerPreferences.java index 85b1a453..816fdbb4 100644 --- a/org.simantics.maps.server/src/org/simantics/district/maps/server/prefs/MapsServerPreferences.java +++ b/org.simantics.maps.server/src/org/simantics/district/maps/server/prefs/MapsServerPreferences.java @@ -25,15 +25,15 @@ public class MapsServerPreferences { } public static int defaultPort() { - return getPreferences().getInt(P_DEFAULT_PORT, 8080); + return getPreferences().getInt(P_DEFAULT_PORT, 8585); } public static String currentMBTiles() { - return getPreferences().get(P_CURRENT_MBTILES, ""); + return getPreferences().get(P_CURRENT_MBTILES, "helsinki_finland.mbtiles"); } public static String currentTM2Style() { - return getPreferences().get(P_CURRENT_TM2STYLE, ""); + return getPreferences().get(P_CURRENT_TM2STYLE, "mapbox-studio-osm-bright.tm2"); } }