]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Added Edge.ThicknessProperty for generic edge-thickness styling 20/2120/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 5 Sep 2018 21:24:28 +0000 (00:24 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 5 Sep 2018 21:27:08 +0000 (21:27 +0000)
gitlab #2

Change-Id: I9ce4bb9274a184d3e4ae83669c2079e3720dd412
(cherry picked from commit a3b6137601545ac6e3484995d0ec6d39224bbf3f)

13 files changed:
org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph
org.simantics.district.network.ontology/graph/DistrictNetworkDiagramSettings.pgraph [new file with mode: 0644]
org.simantics.district.network.ontology/graph/DistrictNetworkProfiles.pgraph [new file with mode: 0644]
org.simantics.district.network.ontology/graph/DistrictNetworkViewpoint.pgraph [new file with mode: 0644]
org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java
org.simantics.district.network/adapters.xml
org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettings.java [new file with mode: 0644]
org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettingsRequest.java [new file with mode: 0644]
org.simantics.district.network/src/org/simantics/district/network/profile/EdgeNodeGroup.java [deleted file]
org.simantics.district.network/src/org/simantics/district/network/profile/EdgeStyle.java [new file with mode: 0644]
org.simantics.district.network/src/org/simantics/district/network/profile/VertexStyle.java [moved from org.simantics.district.network/src/org/simantics/district/network/profile/EdgeNodeStyle.java with 52% similarity]

index 435bd55d9813e30a19bb8ab66e0ae8c26342d26a..657ffc697edcb246eeb45d01da266764b14018f5 100644 (file)
@@ -13,16 +13,94 @@ DN = <http://www.simantics.org/DistrictNetwork-1.0> : L0.Ontology
     L0.Ontology.global true
     L0.HasResourceClass "org.simantics.district.network.ontology.DistrictNetworkResource"
 
-DN.Layer <T DIA.Layer
+// ----------------------------------------------------------------------------
+
+DN.SCLMain : L0.SCLModule
+    L0.SCLModule.definition
+        """
+        include "Simantics/District/SCLMain"
+        """
 
+// ----------------------------------------------------------------------------
+
+defProperty : L0.Template
+    @template %subject %label %range
+        %subject <R L0.HasProperty : SEL.GenericParameterType
+            L0.HasLabel %label : L0.String
+            L0.HasRange %range
+
+// ----------------------------------------------------------------------------
+
+DN.Diagram <T DIA.Diagram
+DN.Layer <T DIA.Layer
+DN.Connection <T DIA.Connection
 DN.Element <T DIA.Element : L0.Type
 
+DN.Vertex <T DN.Element
+    >-- DN.Vertex.HasElevation
+        @defProperty "Elevation" L0.Double
+    >-- DN.Vertex.HasAddress
+        @defProperty "Address" L0.String
+    >-- DN.Vertex.HasSupplyTemperature
+        @defProperty "Supply Temperature" L0.Double 
+    >-- DN.Vertex.HasReturnTemperature 
+        @defProperty "Return Temperature" L0.Double
+    >-- DN.Vertex.HasSupplyPressure
+        @defProperty "Supply Pressure" L0.Double 
+    >-- DN.Vertex.HasReturnPressure
+        @defProperty "Return Pressure" L0.Double 
+    >-- DN.Vertex.HasDeltaPressure
+        @defProperty "Delta pressure" L0.Double 
+    >-- DN.Vertex.HasDeltaTemperature
+        @defProperty "Delta temperature" L0.Double 
+    >-- DN.Vertex.HasHeatPower
+        @defProperty "Heat Power" L0.Double 
+    >-- DN.Vertex.HasNominalHeadM
+        @defProperty "NominalHeadM" L0.Double 
+    >-- DN.Vertex.HasNominalHeadB
+        @defProperty "NominalHeadB" L0.Double 
+    >-- DN.Vertex.HasNominalFlow
+        @defProperty "Nominal Flow" L0.Double 
+    >-- DN.Vertex.HasMaximumHeadM
+        @defProperty "Maximum head M" L0.Double 
+    >-- DN.Vertex.HasHeatLoadDs
+        @defProperty "Heat Load ds" L0.Double 
+    >-- DN.Vertex.HasMassFlow
+        @defProperty "Mass Flow" L0.Double 
+    >-- DN.Vertex.HasVolFlow
+        @defProperty "Vol Flow" L0.Double 
+    >-- DN.Vertex.HasVelocity
+        @defProperty "Velocity" L0.Double 
+    >-- DN.Vertex.HasFlowArea
+        @defProperty "Flow Area" L0.Double 
+    >-- DN.Vertex.HasValvePosition
+        @defProperty "Valve position" L0.Double 
+    >-- DN.Vertex.HasNominalPressureLoss
+        @defProperty "Nominal Pressure Loss" L0.Double 
+    @L0.assert DN.Vertex.HasElevation 0.0
+
 DN.Edge <T DN.Element
+    >-- DN.Edge.HasLength 
+        @defProperty "Length" L0.Double
+        L0.readOnly true
+    >-- DN.Edge.HasDiameter
+        @defProperty "Diameter" L0.Double
+    >-- DN.Edge.HasOuterDiameter
+        @defProperty "Outer Diameter" L0.Double
+    >-- DN.Edge.HasNominalMassFlow
+        @defProperty "Nominal Mass Flow" L0.Double
+    >-- DN.Edge.HasFlowArea
+        @defProperty "Flow Area" L0.Double
+    >-- DN.Edge.HasKReturn
+        @defProperty "K Return" L0.Double
+    >-- DN.Edge.HasKSupply
+        @defProperty "K Supply" L0.Double
+    >-- DN.Edge.HasTGround
+        @defProperty "T Ground" L0.Double
     @L0.assert DN.Edge.HasDiameter 0.1
     @L0.assert DN.Edge.HasOuterDiameter 0.11
 
-DN.Vertex <T DN.Element
-    @L0.assert DN.Vertex.HasElevation 0.0
+// ----------------------------------------------------------------------------
 
 DN.EdgeDefaultMapping <R L0.HasProperty : DN.EdgeMappingParameterType
     L0.HasLabel "Default Edge mapping"
@@ -30,6 +108,8 @@ DN.EdgeDefaultMapping <R L0.HasProperty : DN.EdgeMappingParameterType
 DN.VertexDefaultMapping <R L0.HasProperty : DN.VertexMappingParameterType
     L0.HasLabel "Default Vertex mapping"
 
+// ----------------------------------------------------------------------------
+
 DN.Functions : L0.Library
 
 DN.VertexMappingParameterType <T SEL.GenericParameterType
@@ -50,152 +130,13 @@ DN.MappingParameterType <T SEL.GenericParameterType
       SEL.HasEnumerationValues DN.Functions.enumerationValues
       SEL.HasCustomModifier DN.Functions.mappingModifier : L0.Function
 
+// ----------------------------------------------------------------------------
+
 DN.HasMapping <R L0.HasProperty : DN.MappingParameterType
     L0.HasLabel "Mapping"
 
-DN.HasId <R L0.HasProperty : SEL.GenericParameterType
+DN.HasId --> L0.String <R L0.HasProperty : SEL.GenericParameterType
     L0.HasLabel "Id"
-    L0.HasRange L0.String
-    L0.readOnly false
-
-DN.Vertex.HasElevation <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Elevation"
-    L0.HasRange L0.Double
-    L0.readOnly false
-    
-DN.Vertex.HasAddress <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Address"
-    L0.HasRange L0.String
-    L0.readOnly false
-
-DN.Vertex.HasSupplyTemperature <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Supply Temperature"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasReturnTemperature <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Return Temperature"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasSupplyPressure <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Supply Pressure"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasReturnPressure <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Return Pressure"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasDeltaPressure <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Delta pressure"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasDeltaTemperature <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Delta temperature"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasHeatPower <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Heat Power"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasNominalHeadM <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "NominalHeadM"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasNominalHeadB <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "NominalHeadB"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasNominalFlow <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Nominal Flow"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasMaximumHeadM <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Maximum head M"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasHeatLoadDs <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Heat Load ds"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasMassFlow <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Mass Flow"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasVolFlow <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Vol Flow"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasVelocity <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Velocity"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasFlowArea <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Flow Area"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasValvePosition <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Valve position"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Vertex.HasNominalPressureLoss <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Nominal Pressure Loss"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Edge.HasLength <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Length"
-    L0.HasRange L0.Double
-    L0.readOnly true
-
-DN.Edge.HasDiameter <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Diameter"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Edge.HasOuterDiameter <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Outer Diameter"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Edge.HasNominalMassFlow <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Nominal Mass Flow"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Edge.HasFlowArea <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "Flow Area"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Edge.HasKReturn <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "K Return"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Edge.HasKSupply <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "K Supply"
-    L0.HasRange L0.Double
-    L0.readOnly false
-
-DN.Edge.HasTGround <R L0.HasProperty : SEL.GenericParameterType
-    L0.HasLabel "T Ground"
-    L0.HasRange L0.Double
     L0.readOnly false
 
 DN.InLayer
@@ -205,16 +146,12 @@ DN.InLayer
 DN.HasInLayerTag <R L0.HasProperty
     L0.HasRange L0.Tag
 
-DN.Connection <T DIA.Connection
-
 // For associating typical diagram source and instance structures with each other
 DN.Diagram.MappedDiagram <R L0.IsWeaklyRelatedTo
     L0.InverseOf DN.Diagram.MappedFromDiagram <R L0.IsWeaklyRelatedTo
 DN.MappedComponent <R L0.IsWeaklyRelatedTo
     L0.InverseOf DN.MappedFromElement <R L0.IsWeaklyRelatedTo
 
-DN.Diagram <T DIA.Diagram
-
 DN.AddLayerToDNDiagramTemplate <T L0.Template
 
 DN.EPSG_4326 : DN.SpatialRefSystem
@@ -254,40 +191,7 @@ DN.HasEndVertex <R L0.DependsOn
     L0.HasRange DN.Vertex
     L0.InverseOf DN.HasEndVertex_Inverse <R L0.IsRelatedTo
 
-MBC = MOD.ModelingBrowseContext
-
-DNAC.newDiagramContribution : L0.Template
-    @template %actionContext %label %image %action
-        %actionContext
-            VP.BrowseContext.HasActionContribution _ : VP.ActionContribution
-                L0.HasLabel %label
-                VP.ActionContribution.HasImage %image
-                VP.ActionContribution.HasCategory VP.NewActionCategory
-                VP.ActionContribution.HasNodeType MBC.Configuration
-                VP.ActionContribution.HasAction %action
-
-DNAC = DN.ActionContext : VP.BrowseContext
-    VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext
-    @DNAC.newDiagramContribution "Network Diagram" IMAGES.MapImage ACTIONS.NewDNDiagram
-
-DNBC = DN.BrowseContext : VP.BrowseContext
-    VP.BrowseContext.IsIncludedIn MOD.ModelingBrowseContext
-    VP.BrowseContext.Includes SEL_UI.StandardPropertiesBase.BrowseContext
-    
-    @VP.customModifierRule    DN.Edge    VP.ResourceLabelModifierRule
-    @VP.constantImageRule     DN.Composite   IMAGES.MapImage
-
-
-ACTIONS = DN.Actions : L0.Library
-
-ACTIONS.NewDNDiagram : MOD.NewComposite
-    MOD.NewComposite.HasCompositeType DN.Composite
-    MOD.NewComposite.HasDefaultName "NewNetworkDiagram"
-
-IMAGES = DN.Images : L0.Library
-
-IMAGES.MapImage : IMAGE.PngImage
-    @L0.loadBytes "images/map.png"
+// ----------------------------------------------------------------------------
 
 // Component MAPPING
 DN.Mapping <T L0.Library
@@ -346,65 +250,3 @@ DN.Mapping.EdgeMapping <T DN.Mapping.Base
     >-- DN.Mapping.EdgeMapping.KSupplyAttribute --> L0.String <R L0.HasProperty
     >-- DN.Mapping.EdgeMapping.TGroundAttribute --> L0.String <R L0.HasProperty
     >-- DN.Mapping.Terminals
-
-DN.SCLMain : L0.SCLModule
-    L0.SCLModule.definition
-        """
-        include "Simantics/District/SCLMain"
-        """
-
-DN.DistrictProfile : DIA.Profile
-    L0.HasLabel "District Network Profile"
-    DIA.Profile.priority 0.0
-    DIA.HasEntries
-      _ : DIA.Profile
-        @L0.list
-          DN.DistrictProfile.entry
-            L0.HasLabel "Component names"
-            @DIA.groupStyleProfileEntry DN.ComponentNameStyle DN.Groups.ElementGroup
-          DN.DistrictProfile.entry1
-            L0.HasLabel "Id"
-            @DIA.groupStyleProfileEntry DN.ComponentIdStyle DN.Groups.ElementGroup
-          DN.DistrictProfile.entry2
-            L0.HasLabel "Edge Node Styling"
-            @DIA.groupStyleProfileEntry DN.EdgeNodeStyle DN.Groups.ElementGroup
-
-DN.Groups : L0.Library
-
-DN.Groups.ElementGroup : DIA.TypeGroup
-  DIA.TypeGroup.HasType DN.Element
-
-DN.ComponentNameStyle : DIA.ResourceSCLTextGridStyle
-    @MOD.scl DIA.ResourceSCLTextGridStyle.texts 
-        """
-        districtNetworkProfileStyle "http://www.simantics.org/Layer0-1.1/HasName"
-        """
-        "String -> Variable -> <ReadGraph> (String, String, String)"
-    @G2D.fontProperty DIA.TextElement.font "Arial" 30 G2D.FontStyle.normal_font_style
-
-DN.ComponentIdStyle : DIA.ResourceSCLTextGridStyle
-    @MOD.scl DIA.ResourceSCLTextGridStyle.texts 
-        """
-        districtNetworkProfileStyle "http://www.simantics.org/Layer0-1.1/HasName" 
-        """
-        "String -> Variable -> <ReadGraph> (String, String, String)"
-    @G2D.fontProperty DIA.TextElement.font "Arial" 30 G2D.FontStyle.normal_font_style
-
-//DN.EdgeNodeGroup : DIA.Group
-
-//DN.Profiles : L0.Library
-
-DN.EdgeNodeStyle : DIA.Style
-
-// Templates
-
-//groupStyleEntry : L0.Template
-//    @template %subject %style %group
-//        %subject : DIA.GroupStyleProfileEntry
-//            DIA.ProfileEntry.HasStyle %style
-//            DIA.ProfileEntry.HasGroup %group
-
-
-//DN.Profiles.EdgeNodeStyle
-//    L0.HasLabel "Edge Node Style"
-//    @groupStyleEntry DN.EdgeNodeStyle DN.EdgeNodeGroup
diff --git a/org.simantics.district.network.ontology/graph/DistrictNetworkDiagramSettings.pgraph b/org.simantics.district.network.ontology/graph/DistrictNetworkDiagramSettings.pgraph
new file mode 100644 (file)
index 0000000..686fb39
--- /dev/null
@@ -0,0 +1,63 @@
+L0 = <http://www.simantics.org/Layer0-1.1>
+DIA = <http://www.simantics.org/Diagram-2.2>
+STR = <http://www.simantics.org/Structural-1.2>
+MOD = <http://www.simantics.org/Modeling-1.2>
+VP = <http://www.simantics.org/Viewpoint-1.2>
+IMAGE = <http://www.simantics.org/Image2-1.2>
+SEL = <http://www.simantics.org/SelectionView-1.2>
+SEL_UI = <http://www.simantics.org/SelectionViewUI-1.1>
+G2D = <http://www.simantics.org/G2D-1.1>
+DN = <http://www.simantics.org/DistrictNetwork-1.0>
+
+// ----------------------------------------------------------------------------
+
+DN.EdgeThicknessPropertyParameterType <T SEL.GenericParameterType
+    @L0.assert SEL.HasDisplayValue
+        _ : SEL.DisplayValue
+            SEL.HasEnumerationValues DN.Functions.edgeThicknessPropertyEnumerationValues : L0.Function
+            SEL.HasCustomModifier DN.Functions.edgeThicknessPropertyModifier : L0.Function
+
+DN.Vertex.ScaleProperty <T L0.Value
+    >-- DN.Vertex.ScaleProperty.value --> L0.Relation <R L0.HasProperty : SEL.GenericParameterType
+        L0.readOnly true
+    >-- DN.Vertex.ScaleProperty.scale ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
+        L0.readOnly true
+
+DN.Edge.ThicknessProperty <T L0.Value
+    >-- DN.Edge.ThicknessProperty.scale --> L0.Double <R L0.HasProperty : SEL.GenericParameterType
+        L0.readOnly true
+    >-- DN.Edge.ThicknessProperty.value --> L0.Relation <R L0.HasProperty : SEL.GenericParameterType
+        L0.readOnly true
+
+DN.Diagram
+    //>-- DN.Diagram.nodeScale ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
+    //    L0.HasLabel "Node Scale"
+    //>-- DN.Diagram.nodeScalingProperty --> DN.Vertex.ScaleProperty <R L0.HasProperty : SEL.GenericParameterType
+    //   L0.HasLabel "Node Scaling Property"
+    >-- DN.Diagram.edgeThicknessScale ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
+        L0.HasLabel "Edge Thickness Scale"
+    >-- DN.Diagram.edgeThicknessProperty --> DN.Edge.ThicknessProperty <R L0.HasProperty : DN.EdgeThicknessPropertyParameterType
+        L0.HasLabel "Edge Thickness Property"
+    //@L0.assert DN.Diagram.nodeScale 1.0
+    //@L0.assert DN.Diagram.nodeScaleProperty DN.Vertex.ScaleProperty.SupplyPressure
+    @L0.assert DN.Diagram.edgeThicknessScale 1.0
+    @L0.assert DN.Diagram.edgeThicknessProperty DN.Edge.ThicknessProperty.Diameter
+
+// ----------------------------------------------------------------------------
+// Built-in enumerated ScaleProperty & ThicknessProperty instances
+
+DN.Vertex.ScaleProperty.SupplyPressure : DN.Vertex.ColorProperty
+    L0.HasLabel "Nominal Supply Pressure"
+    DN.Vertex.ScaleProperty.value DN.Vertex.HasSupplyPressure
+    DN.Vertex.ScaleProperty.scale 1.0
+
+DN.Edge.ThicknessProperty.Diameter : DN.Edge.ThicknessProperty
+    L0.HasLabel "Diameter"
+    DN.Edge.ThicknessProperty.value DN.Edge.HasDiameter
+    DN.Edge.ThicknessProperty.scale 0.001
+
+DN.Edge.ThicknessProperty.NominalMassFlow : DN.Edge.ThicknessProperty
+    L0.HasLabel "Nominal Mass Flow"
+    DN.Edge.ThicknessProperty.value DN.Edge.HasNominalMassFlow
+    DN.Edge.ThicknessProperty.scale 1.0
+
diff --git a/org.simantics.district.network.ontology/graph/DistrictNetworkProfiles.pgraph b/org.simantics.district.network.ontology/graph/DistrictNetworkProfiles.pgraph
new file mode 100644 (file)
index 0000000..d00bf42
--- /dev/null
@@ -0,0 +1,35 @@
+L0 = <http://www.simantics.org/Layer0-1.1>
+DIA = <http://www.simantics.org/Diagram-2.2>
+STR = <http://www.simantics.org/Structural-1.2>
+MOD = <http://www.simantics.org/Modeling-1.2>
+VP = <http://www.simantics.org/Viewpoint-1.2>
+IMAGE = <http://www.simantics.org/Image2-1.2>
+SEL = <http://www.simantics.org/SelectionView-1.2>
+SEL_UI = <http://www.simantics.org/SelectionViewUI-1.1>
+G2D = <http://www.simantics.org/G2D-1.1>
+DN = <http://www.simantics.org/DistrictNetwork-1.0>
+
+/*
+DN.DistrictProfile : DIA.Profile
+    L0.HasLabel "District Network Profile"
+    DIA.Profile.priority 0.0
+    DIA.HasEntries
+      _ : DIA.Profile
+        @L0.list
+          DN.DistrictProfile.entry1
+            L0.HasLabel "Node Coloring"
+            @DIA.groupStyleProfileEntry DN.VertexStyle DN.Groups.VertexGroup
+          DN.DistrictProfile.entry2
+            L0.HasLabel "Edge Styling"
+            @DIA.groupStyleProfileEntry DN.EdgeStyle DN.Groups.EdgeGroup
+*/
+
+DN.Groups : L0.Library
+
+DN.Groups.VertexGroup : DIA.TypeGroup
+  DIA.TypeGroup.HasType DN.Vertex
+DN.Groups.EdgeGroup : DIA.TypeGroup
+  DIA.TypeGroup.HasType DN.Edge
+
+DN.VertexStyle : DIA.Style
+DN.EdgeStyle : DIA.Style
diff --git a/org.simantics.district.network.ontology/graph/DistrictNetworkViewpoint.pgraph b/org.simantics.district.network.ontology/graph/DistrictNetworkViewpoint.pgraph
new file mode 100644 (file)
index 0000000..8fa53c9
--- /dev/null
@@ -0,0 +1,47 @@
+L0 = <http://www.simantics.org/Layer0-1.1>
+DIA = <http://www.simantics.org/Diagram-2.2>
+STR = <http://www.simantics.org/Structural-1.2>
+MOD = <http://www.simantics.org/Modeling-1.2>
+VP = <http://www.simantics.org/Viewpoint-1.2>
+IMAGE = <http://www.simantics.org/Image2-1.2>
+SEL = <http://www.simantics.org/SelectionView-1.2>
+SEL_UI = <http://www.simantics.org/SelectionViewUI-1.1>
+G2D = <http://www.simantics.org/G2D-1.1>
+DN = <http://www.simantics.org/DistrictNetwork-1.0>
+
+// ----------------------------------------------------------------------------
+
+MBC = MOD.ModelingBrowseContext
+
+DNAC.newDiagramContribution : L0.Template
+    @template %actionContext %label %image %action
+        %actionContext
+            VP.BrowseContext.HasActionContribution _ : VP.ActionContribution
+                L0.HasLabel %label
+                VP.ActionContribution.HasImage %image
+                VP.ActionContribution.HasCategory VP.NewActionCategory
+                VP.ActionContribution.HasNodeType MBC.Configuration
+                VP.ActionContribution.HasAction %action
+
+DNAC = DN.ActionContext : VP.BrowseContext
+    VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext
+    @DNAC.newDiagramContribution "Network Diagram" IMAGES.MapImage ACTIONS.NewDNDiagram
+
+DNBC = DN.BrowseContext : VP.BrowseContext
+    VP.BrowseContext.IsIncludedIn MOD.ModelingBrowseContext
+    VP.BrowseContext.Includes SEL_UI.StandardPropertiesBase.BrowseContext
+    
+    @VP.customModifierRule    DN.Edge    VP.ResourceLabelModifierRule
+    @VP.constantImageRule     DN.Composite   IMAGES.MapImage
+
+
+ACTIONS = DN.Actions : L0.Library
+
+ACTIONS.NewDNDiagram : MOD.NewComposite
+    MOD.NewComposite.HasCompositeType DN.Composite
+    MOD.NewComposite.HasDefaultName "NewNetworkDiagram"
+
+IMAGES = DN.Images : L0.Library
+
+IMAGES.MapImage : IMAGE.PngImage
+    @L0.loadBytes "images/map.png"
index 159af7ba9fdd92402907b8d886240ac3e0238315..e7e7bf6fae790fd266a38e217703be75e8edc0db 100644 (file)
@@ -16,23 +16,22 @@ public class DistrictNetworkResource {
     public final Resource Actions_NewDNDiagram;
     public final Resource AddLayerToDNDiagramTemplate;
     public final Resource BrowseContext;
-    public final Resource ComponentIdStyle;
-    public final Resource ComponentNameStyle;
     public final Resource Composite;
     public final Resource Connection;
     public final Resource Diagram;
     public final Resource Diagram_MappedDiagram;
     public final Resource Diagram_MappedFromDiagram;
-    public final Resource DistrictProfile;
-    public final Resource DistrictProfile_entry;
-    public final Resource DistrictProfile_entry1;
-    public final Resource DistrictProfile_entry2;
+    public final Resource Diagram_edgeThicknessProperty;
+    public final Resource Diagram_edgeThicknessProperty_Inverse;
+    public final Resource Diagram_edgeThicknessScale;
+    public final Resource Diagram_edgeThicknessScale_Inverse;
     public final Resource EPSG_4326;
     public final Resource Edge;
     public final Resource EdgeDefaultMapping;
     public final Resource EdgeDefaultMapping_Inverse;
     public final Resource EdgeMappingParameterType;
-    public final Resource EdgeNodeStyle;
+    public final Resource EdgeStyle;
+    public final Resource EdgeThicknessPropertyParameterType;
     public final Resource Edge_HasDiameter;
     public final Resource Edge_HasDiameter_Inverse;
     public final Resource Edge_HasFlowArea;
@@ -49,16 +48,26 @@ public class DistrictNetworkResource {
     public final Resource Edge_HasOuterDiameter_Inverse;
     public final Resource Edge_HasTGround;
     public final Resource Edge_HasTGround_Inverse;
+    public final Resource Edge_ThicknessProperty;
+    public final Resource Edge_ThicknessProperty_Diameter;
+    public final Resource Edge_ThicknessProperty_NominalMassFlow;
+    public final Resource Edge_ThicknessProperty_scale;
+    public final Resource Edge_ThicknessProperty_scale_Inverse;
+    public final Resource Edge_ThicknessProperty_value;
+    public final Resource Edge_ThicknessProperty_value_Inverse;
     public final Resource Element;
     public final Resource Functions;
     public final Resource Functions_compositeInstantiator;
     public final Resource Functions_convertToValue;
     public final Resource Functions_defaultEdgeMappingModifier;
     public final Resource Functions_defaultVertexMappingModifier;
+    public final Resource Functions_edgeThicknessPropertyEnumerationValues;
+    public final Resource Functions_edgeThicknessPropertyModifier;
     public final Resource Functions_enumerationValues;
     public final Resource Functions_mappingModifier;
     public final Resource Groups;
-    public final Resource Groups_ElementGroup;
+    public final Resource Groups_EdgeGroup;
+    public final Resource Groups_VertexGroup;
     public final Resource HasEndVertex;
     public final Resource HasEndVertex_Inverse;
     public final Resource HasId;
@@ -166,6 +175,8 @@ public class DistrictNetworkResource {
     public final Resource VertexDefaultMapping;
     public final Resource VertexDefaultMapping_Inverse;
     public final Resource VertexMappingParameterType;
+    public final Resource VertexStyle;
+    public final Resource Vertex_ColorProperty;
     public final Resource Vertex_HasAddress;
     public final Resource Vertex_HasAddress_Inverse;
     public final Resource Vertex_HasDeltaPressure;
@@ -206,6 +217,12 @@ public class DistrictNetworkResource {
     public final Resource Vertex_HasVelocity_Inverse;
     public final Resource Vertex_HasVolFlow;
     public final Resource Vertex_HasVolFlow_Inverse;
+    public final Resource Vertex_ScaleProperty;
+    public final Resource Vertex_ScaleProperty_SupplyPressure;
+    public final Resource Vertex_ScaleProperty_scale;
+    public final Resource Vertex_ScaleProperty_scale_Inverse;
+    public final Resource Vertex_ScaleProperty_value;
+    public final Resource Vertex_ScaleProperty_value_Inverse;
         
     public static class URIs {
         public static final String ActionContext = "http://www.simantics.org/DistrictNetwork-1.0/ActionContext";
@@ -214,23 +231,22 @@ public class DistrictNetworkResource {
         public static final String Actions_NewDNDiagram = "http://www.simantics.org/DistrictNetwork-1.0/Actions/NewDNDiagram";
         public static final String AddLayerToDNDiagramTemplate = "http://www.simantics.org/DistrictNetwork-1.0/AddLayerToDNDiagramTemplate";
         public static final String BrowseContext = "http://www.simantics.org/DistrictNetwork-1.0/BrowseContext";
-        public static final String ComponentIdStyle = "http://www.simantics.org/DistrictNetwork-1.0/ComponentIdStyle";
-        public static final String ComponentNameStyle = "http://www.simantics.org/DistrictNetwork-1.0/ComponentNameStyle";
         public static final String Composite = "http://www.simantics.org/DistrictNetwork-1.0/Composite";
         public static final String Connection = "http://www.simantics.org/DistrictNetwork-1.0/Connection";
         public static final String Diagram = "http://www.simantics.org/DistrictNetwork-1.0/Diagram";
         public static final String Diagram_MappedDiagram = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/MappedDiagram";
         public static final String Diagram_MappedFromDiagram = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/MappedFromDiagram";
-        public static final String DistrictProfile = "http://www.simantics.org/DistrictNetwork-1.0/DistrictProfile";
-        public static final String DistrictProfile_entry = "http://www.simantics.org/DistrictNetwork-1.0/DistrictProfile/entry";
-        public static final String DistrictProfile_entry1 = "http://www.simantics.org/DistrictNetwork-1.0/DistrictProfile/entry1";
-        public static final String DistrictProfile_entry2 = "http://www.simantics.org/DistrictNetwork-1.0/DistrictProfile/entry2";
+        public static final String Diagram_edgeThicknessProperty = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/edgeThicknessProperty";
+        public static final String Diagram_edgeThicknessProperty_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/edgeThicknessProperty/Inverse";
+        public static final String Diagram_edgeThicknessScale = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/edgeThicknessScale";
+        public static final String Diagram_edgeThicknessScale_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/edgeThicknessScale/Inverse";
         public static final String EPSG_4326 = "http://www.simantics.org/DistrictNetwork-1.0/EPSG_4326";
         public static final String Edge = "http://www.simantics.org/DistrictNetwork-1.0/Edge";
         public static final String EdgeDefaultMapping = "http://www.simantics.org/DistrictNetwork-1.0/EdgeDefaultMapping";
         public static final String EdgeDefaultMapping_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/EdgeDefaultMapping/Inverse";
         public static final String EdgeMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/EdgeMappingParameterType";
-        public static final String EdgeNodeStyle = "http://www.simantics.org/DistrictNetwork-1.0/EdgeNodeStyle";
+        public static final String EdgeStyle = "http://www.simantics.org/DistrictNetwork-1.0/EdgeStyle";
+        public static final String EdgeThicknessPropertyParameterType = "http://www.simantics.org/DistrictNetwork-1.0/EdgeThicknessPropertyParameterType";
         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";
@@ -247,16 +263,26 @@ public class DistrictNetworkResource {
         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 Edge_ThicknessProperty = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty";
+        public static final String Edge_ThicknessProperty_Diameter = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/Diameter";
+        public static final String Edge_ThicknessProperty_NominalMassFlow = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/NominalMassFlow";
+        public static final String Edge_ThicknessProperty_scale = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/scale";
+        public static final String Edge_ThicknessProperty_scale_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/scale/Inverse";
+        public static final String Edge_ThicknessProperty_value = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/value";
+        public static final String Edge_ThicknessProperty_value_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/value/Inverse";
         public static final String Element = "http://www.simantics.org/DistrictNetwork-1.0/Element";
         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";
         public static final String Functions_defaultEdgeMappingModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/defaultEdgeMappingModifier";
         public static final String Functions_defaultVertexMappingModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/defaultVertexMappingModifier";
+        public static final String Functions_edgeThicknessPropertyEnumerationValues = "http://www.simantics.org/DistrictNetwork-1.0/Functions/edgeThicknessPropertyEnumerationValues";
+        public static final String Functions_edgeThicknessPropertyModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/edgeThicknessPropertyModifier";
         public static final String Functions_enumerationValues = "http://www.simantics.org/DistrictNetwork-1.0/Functions/enumerationValues";
         public static final String Functions_mappingModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/mappingModifier";
         public static final String Groups = "http://www.simantics.org/DistrictNetwork-1.0/Groups";
-        public static final String Groups_ElementGroup = "http://www.simantics.org/DistrictNetwork-1.0/Groups/ElementGroup";
+        public static final String Groups_EdgeGroup = "http://www.simantics.org/DistrictNetwork-1.0/Groups/EdgeGroup";
+        public static final String Groups_VertexGroup = "http://www.simantics.org/DistrictNetwork-1.0/Groups/VertexGroup";
         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";
@@ -364,6 +390,8 @@ public class DistrictNetworkResource {
         public static final String VertexDefaultMapping = "http://www.simantics.org/DistrictNetwork-1.0/VertexDefaultMapping";
         public static final String VertexDefaultMapping_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/VertexDefaultMapping/Inverse";
         public static final String VertexMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/VertexMappingParameterType";
+        public static final String VertexStyle = "http://www.simantics.org/DistrictNetwork-1.0/VertexStyle";
+        public static final String Vertex_ColorProperty = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ColorProperty";
         public static final String Vertex_HasAddress = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasAddress";
         public static final String Vertex_HasAddress_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasAddress/Inverse";
         public static final String Vertex_HasDeltaPressure = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasDeltaPressure";
@@ -404,6 +432,12 @@ public class DistrictNetworkResource {
         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 final String Vertex_ScaleProperty = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty";
+        public static final String Vertex_ScaleProperty_SupplyPressure = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/SupplyPressure";
+        public static final String Vertex_ScaleProperty_scale = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/scale";
+        public static final String Vertex_ScaleProperty_scale_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/scale/Inverse";
+        public static final String Vertex_ScaleProperty_value = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/value";
+        public static final String Vertex_ScaleProperty_value_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/value/Inverse";
     }
     
     public static Resource getResourceOrNull(ReadGraph graph, String uri) {
@@ -422,23 +456,22 @@ public class DistrictNetworkResource {
         Actions_NewDNDiagram = getResourceOrNull(graph, URIs.Actions_NewDNDiagram);
         AddLayerToDNDiagramTemplate = getResourceOrNull(graph, URIs.AddLayerToDNDiagramTemplate);
         BrowseContext = getResourceOrNull(graph, URIs.BrowseContext);
-        ComponentIdStyle = getResourceOrNull(graph, URIs.ComponentIdStyle);
-        ComponentNameStyle = getResourceOrNull(graph, URIs.ComponentNameStyle);
         Composite = getResourceOrNull(graph, URIs.Composite);
         Connection = getResourceOrNull(graph, URIs.Connection);
         Diagram = getResourceOrNull(graph, URIs.Diagram);
         Diagram_MappedDiagram = getResourceOrNull(graph, URIs.Diagram_MappedDiagram);
         Diagram_MappedFromDiagram = getResourceOrNull(graph, URIs.Diagram_MappedFromDiagram);
-        DistrictProfile = getResourceOrNull(graph, URIs.DistrictProfile);
-        DistrictProfile_entry = getResourceOrNull(graph, URIs.DistrictProfile_entry);
-        DistrictProfile_entry1 = getResourceOrNull(graph, URIs.DistrictProfile_entry1);
-        DistrictProfile_entry2 = getResourceOrNull(graph, URIs.DistrictProfile_entry2);
+        Diagram_edgeThicknessProperty = getResourceOrNull(graph, URIs.Diagram_edgeThicknessProperty);
+        Diagram_edgeThicknessProperty_Inverse = getResourceOrNull(graph, URIs.Diagram_edgeThicknessProperty_Inverse);
+        Diagram_edgeThicknessScale = getResourceOrNull(graph, URIs.Diagram_edgeThicknessScale);
+        Diagram_edgeThicknessScale_Inverse = getResourceOrNull(graph, URIs.Diagram_edgeThicknessScale_Inverse);
         EPSG_4326 = getResourceOrNull(graph, URIs.EPSG_4326);
         Edge = getResourceOrNull(graph, URIs.Edge);
         EdgeDefaultMapping = getResourceOrNull(graph, URIs.EdgeDefaultMapping);
         EdgeDefaultMapping_Inverse = getResourceOrNull(graph, URIs.EdgeDefaultMapping_Inverse);
         EdgeMappingParameterType = getResourceOrNull(graph, URIs.EdgeMappingParameterType);
-        EdgeNodeStyle = getResourceOrNull(graph, URIs.EdgeNodeStyle);
+        EdgeStyle = getResourceOrNull(graph, URIs.EdgeStyle);
+        EdgeThicknessPropertyParameterType = getResourceOrNull(graph, URIs.EdgeThicknessPropertyParameterType);
         Edge_HasDiameter = getResourceOrNull(graph, URIs.Edge_HasDiameter);
         Edge_HasDiameter_Inverse = getResourceOrNull(graph, URIs.Edge_HasDiameter_Inverse);
         Edge_HasFlowArea = getResourceOrNull(graph, URIs.Edge_HasFlowArea);
@@ -455,16 +488,26 @@ public class DistrictNetworkResource {
         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);
+        Edge_ThicknessProperty = getResourceOrNull(graph, URIs.Edge_ThicknessProperty);
+        Edge_ThicknessProperty_Diameter = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_Diameter);
+        Edge_ThicknessProperty_NominalMassFlow = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_NominalMassFlow);
+        Edge_ThicknessProperty_scale = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_scale);
+        Edge_ThicknessProperty_scale_Inverse = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_scale_Inverse);
+        Edge_ThicknessProperty_value = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_value);
+        Edge_ThicknessProperty_value_Inverse = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_value_Inverse);
         Element = getResourceOrNull(graph, URIs.Element);
         Functions = getResourceOrNull(graph, URIs.Functions);
         Functions_compositeInstantiator = getResourceOrNull(graph, URIs.Functions_compositeInstantiator);
         Functions_convertToValue = getResourceOrNull(graph, URIs.Functions_convertToValue);
         Functions_defaultEdgeMappingModifier = getResourceOrNull(graph, URIs.Functions_defaultEdgeMappingModifier);
         Functions_defaultVertexMappingModifier = getResourceOrNull(graph, URIs.Functions_defaultVertexMappingModifier);
+        Functions_edgeThicknessPropertyEnumerationValues = getResourceOrNull(graph, URIs.Functions_edgeThicknessPropertyEnumerationValues);
+        Functions_edgeThicknessPropertyModifier = getResourceOrNull(graph, URIs.Functions_edgeThicknessPropertyModifier);
         Functions_enumerationValues = getResourceOrNull(graph, URIs.Functions_enumerationValues);
         Functions_mappingModifier = getResourceOrNull(graph, URIs.Functions_mappingModifier);
         Groups = getResourceOrNull(graph, URIs.Groups);
-        Groups_ElementGroup = getResourceOrNull(graph, URIs.Groups_ElementGroup);
+        Groups_EdgeGroup = getResourceOrNull(graph, URIs.Groups_EdgeGroup);
+        Groups_VertexGroup = getResourceOrNull(graph, URIs.Groups_VertexGroup);
         HasEndVertex = getResourceOrNull(graph, URIs.HasEndVertex);
         HasEndVertex_Inverse = getResourceOrNull(graph, URIs.HasEndVertex_Inverse);
         HasId = getResourceOrNull(graph, URIs.HasId);
@@ -572,6 +615,8 @@ public class DistrictNetworkResource {
         VertexDefaultMapping = getResourceOrNull(graph, URIs.VertexDefaultMapping);
         VertexDefaultMapping_Inverse = getResourceOrNull(graph, URIs.VertexDefaultMapping_Inverse);
         VertexMappingParameterType = getResourceOrNull(graph, URIs.VertexMappingParameterType);
+        VertexStyle = getResourceOrNull(graph, URIs.VertexStyle);
+        Vertex_ColorProperty = getResourceOrNull(graph, URIs.Vertex_ColorProperty);
         Vertex_HasAddress = getResourceOrNull(graph, URIs.Vertex_HasAddress);
         Vertex_HasAddress_Inverse = getResourceOrNull(graph, URIs.Vertex_HasAddress_Inverse);
         Vertex_HasDeltaPressure = getResourceOrNull(graph, URIs.Vertex_HasDeltaPressure);
@@ -612,6 +657,12 @@ public class DistrictNetworkResource {
         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);
+        Vertex_ScaleProperty = getResourceOrNull(graph, URIs.Vertex_ScaleProperty);
+        Vertex_ScaleProperty_SupplyPressure = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_SupplyPressure);
+        Vertex_ScaleProperty_scale = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_scale);
+        Vertex_ScaleProperty_scale_Inverse = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_scale_Inverse);
+        Vertex_ScaleProperty_value = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_value);
+        Vertex_ScaleProperty_value_Inverse = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_value_Inverse);
     }
     
     public static DistrictNetworkResource getInstance(ReadGraph graph) {
index d80082ec65279d8281c2f29590897fddf2a65e1b..9748f87c8fc4980f77a767e84dde9d157b6885d4 100644 (file)
@@ -467,4 +467,17 @@ public class Functions {
         }
         return results;
     }
+
+    @SCLValue(type = "ReadGraph -> Resource -> Variable -> b")
+    public static Object edgeThicknessPropertyEnumerationValues(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
+        return Collections.emptyList();
+    }
+
+    @SCLValue(type = "ReadGraph -> Resource -> Variable -> b")
+    public static Object edgeThicknessPropertyModifier(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
+        Resource diagram = resolveElement(graph, context);
+        DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+        return baseMappingModifier(graph, diagram, DN.Diagram_edgeThicknessProperty, DN.Edge_ThicknessProperty, context);
+    }
+
 }
index a088ca903810f7211c3b8d64d193b378b4a8f362..9229932400a8ff12b964621a3643c2102bb0b634 100644 (file)
@@ -7,7 +7,6 @@ import java.awt.RenderingHints;
 import java.awt.Stroke;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Path2D;
-import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 
 import org.simantics.district.network.ModelledCRS;
@@ -135,7 +134,7 @@ public class DistrictNetworkEdgeNode extends G2DNode {
 
     @PropertySetter(value = "stroke")
     public void setStroke(Double stroke) {
-        this.stroke = stroke / 100;
+        this.stroke = stroke;
     }
 
 }
index 03953cf79649ea96dcefda656449f625150e679a..a6463cd78eaaa288f065220af7c7cc9413726d88 100644 (file)
@@ -8,15 +8,12 @@
                        <this />
                </type>
        </target>
-       <!-- <target interface="org.simantics.scenegraph.profile.Group">
-               <resource uri="http://www.simantics.org/DistrictNetwork-1.0/EdgeNodeGroup"
-                       class="org.simantics.district.network.profile.EdgeNodeGroup">
-            <graph/>
-               </resource>
-    </target> -->
        <target interface="org.simantics.scenegraph.profile.Style">
-               <resource uri="http://www.simantics.org/DistrictNetwork-1.0/EdgeNodeStyle"
-                       class="org.simantics.district.network.profile.EdgeNodeStyle">
+               <resource uri="http://www.simantics.org/DistrictNetwork-1.0/VertexStyle"
+                       class="org.simantics.district.network.profile.VertexStyle">
+               </resource>
+               <resource uri="http://www.simantics.org/DistrictNetwork-1.0/EdgeStyle"
+                       class="org.simantics.district.network.profile.EdgeStyle">
                </resource>
     </target>
 </adapters>
\ No newline at end of file
diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettings.java b/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettings.java
new file mode 100644 (file)
index 0000000..8136b19
--- /dev/null
@@ -0,0 +1,59 @@
+package org.simantics.district.network.profile;
+
+import java.util.Optional;
+
+import org.simantics.db.Resource;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class DiagramSettings {
+
+       public final Optional<Resource> vertexScalingProperty;
+       public final double vertexScalingScale;
+       public final Optional<Resource> edgeThicknessProperty;
+       public final double edgeThicknessScale;
+
+       public DiagramSettings(Resource vertexScalingProperty, double vertexScalingScale, Resource edgeThicknessProperty, double edgeThicknessScale) {
+               this.vertexScalingProperty = Optional.ofNullable(vertexScalingProperty);
+               this.vertexScalingScale = vertexScalingScale;
+               this.edgeThicknessProperty = Optional.ofNullable(edgeThicknessProperty);
+               this.edgeThicknessScale = edgeThicknessScale;
+       }
+
+       @Override
+       public int hashCode() {
+               final int prime = 31;
+               int result = 1;
+               result = prime * result + edgeThicknessProperty.hashCode();
+               long temp;
+               temp = Double.doubleToLongBits(edgeThicknessScale);
+               result = prime * result + (int) (temp ^ (temp >>> 32));
+//             result = prime * result + vertexScalingProperty.hashCode();
+               temp = Double.doubleToLongBits(vertexScalingScale);
+               result = prime * result + (int) (temp ^ (temp >>> 32));
+               return result;
+       }
+
+       @Override
+       public boolean equals(Object obj) {
+               if (this == obj)
+                       return true;
+               if (obj == null)
+                       return false;
+               if (getClass() != obj.getClass())
+                       return false;
+               DiagramSettings other = (DiagramSettings) obj;
+               if (!edgeThicknessProperty.equals(other.edgeThicknessProperty))
+                       return false;
+               if (Double.doubleToLongBits(edgeThicknessScale) != Double.doubleToLongBits(other.edgeThicknessScale))
+                       return false;
+               if (!vertexScalingProperty.equals(other.vertexScalingProperty))
+                       return false;
+               if (Double.doubleToLongBits(vertexScalingScale) != Double.doubleToLongBits(other.vertexScalingScale))
+                       return false;
+               return true;
+       }
+
+       
+}
diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettingsRequest.java b/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettingsRequest.java
new file mode 100644 (file)
index 0000000..726005e
--- /dev/null
@@ -0,0 +1,54 @@
+package org.simantics.district.network.profile;
+
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.ResourceRead;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.diagram.stubs.DiagramResource;
+import org.simantics.district.network.ontology.DistrictNetworkResource;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class DiagramSettingsRequest extends ResourceRead<DiagramSettings> {
+
+       protected DiagramSettingsRequest(Resource runtimeDiagram) {
+               super(runtimeDiagram);
+       }
+
+       @Override
+       public DiagramSettings perform(ReadGraph graph) throws DatabaseException {
+               DiagramResource DIA = DiagramResource.getInstance(graph);
+               DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+
+               Resource edgeThicknessProperty = null;
+               Resource nodeScalingProperty = null;
+               double edgeThicknessScale = 1;
+               double nodeScalingScale = 1;
+
+               Resource diagram = graph.getPossibleObject(resource, DIA.RuntimeDiagram_HasConfiguration);
+               if (diagram != null) {
+                       Resource etp = graph.getPossibleObject(diagram, DN.Diagram_edgeThicknessProperty);
+                       edgeThicknessProperty = graph.getPossibleObject(etp, DN.Edge_ThicknessProperty_value);
+//                     Resource nsp = graph.getPossibleObject(diagram, DN.Diagram_nodeScalingProperty);
+//                     nodeScalingProperty = graph.getPossibleObject(nsp, DN.Vertex_ScaleProperty_value);
+
+                       edgeThicknessScale =
+                                       safeDoubleProperty(graph, etp, DN.Edge_ThicknessProperty_scale, 1)
+                                       * safeDoubleProperty(graph, diagram, DN.Diagram_edgeThicknessScale, 1);
+
+//                     nodeScalingScale =
+//                                     safeDoubleProperty(graph, nsp, DN.Vertex_ScaleProperty_scale, 1)
+//                                     * safeDoubleProperty(graph, diagram, DN.Diagram_nodeScale, 1);
+               }
+
+               return new DiagramSettings(nodeScalingProperty, nodeScalingScale, edgeThicknessProperty, edgeThicknessScale);
+       }
+
+       private static double safeDoubleProperty(ReadGraph graph, Resource r, Resource property, double defaultValue) throws DatabaseException {
+               Double d = graph.getPossibleRelatedValue(r, property, Bindings.DOUBLE);
+               return d != null ? d : defaultValue;
+       }
+
+}
diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/EdgeNodeGroup.java b/org.simantics.district.network/src/org/simantics/district/network/profile/EdgeNodeGroup.java
deleted file mode 100644 (file)
index c66fc97..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.district.network.profile;
-
-import org.simantics.db.ReadGraph;
-import org.simantics.db.Resource;
-import org.simantics.db.exception.DatabaseException;
-import org.simantics.diagram.profile.DiagramElementGroup;
-import org.simantics.district.network.ontology.DistrictNetworkResource;
-
-public class EdgeNodeGroup extends DiagramElementGroup {
-
-    public EdgeNodeGroup(ReadGraph graph) {
-        super(graph);
-        System.out.println("EdgeNodeGroup init");
-    }
-
-    @Override
-    protected boolean test(ReadGraph graph, Resource element) throws DatabaseException {
-        DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
-        if (graph.isInstanceOf(element, DN.Edge)) {
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return "Edge Nodes";
-    }
-
-}
diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/EdgeStyle.java b/org.simantics.district.network/src/org/simantics/district/network/profile/EdgeStyle.java
new file mode 100644 (file)
index 0000000..4ee26ad
--- /dev/null
@@ -0,0 +1,59 @@
+package org.simantics.district.network.profile;
+
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.diagram.profile.StyleBase;
+import org.simantics.scenegraph.INode;
+import org.simantics.scenegraph.g2d.G2DSceneGraph;
+import org.simantics.scenegraph.g2d.nodes.ConnectionNode;
+import org.simantics.scenegraph.profile.EvaluationContext;
+import org.simantics.scenegraph.profile.common.ProfileVariables;
+
+public class EdgeStyle extends StyleBase<Double> {
+
+       private static final Double PENDING = Double.NaN;
+       private static final Double ONE = 1.0;
+
+       @Override
+       public Double calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
+               DiagramSettings ds = graph.syncRequest(new DiagramSettingsRequest(runtimeDiagram), TransientCacheAsyncListener.instance());
+               Double thickness = ONE;
+               if (ds.edgeThicknessProperty.isPresent()) {
+                       thickness = graph.getPossibleRelatedValue2(groupItem, ds.edgeThicknessProperty.get(), Bindings.DOUBLE);
+                       //System.out.println("read thickness: " + thickness + " : " + ds.edgeThicknessProperty);
+                       if (thickness == null) {
+                               thickness = ONE;
+                       } else {
+                               thickness = thickness * ds.edgeThicknessScale;
+                       }
+               }
+               return thickness;
+       }
+
+       @Override
+       public void applyStyleForNode(EvaluationContext observer, INode node, Double value) {
+               //System.out.println("apply: " + node + " : " + value);
+               ConnectionNode n = (ConnectionNode) node;
+               if (value == PENDING) {
+                       ((G2DSceneGraph)node.getRootNode()).setPending(node);
+               } else {
+                       ((G2DSceneGraph)node.getRootNode()).clearPending(node);
+               }
+               if (value == null)
+                       value = ONE;
+               for (INode nn : n.getNodes())
+                       ProfileVariables.claimNodeProperty(nn, "stroke", value, observer);
+       }
+
+       @Override
+       protected void cleanupStyleForNode(EvaluationContext evaluationContext, INode node) {
+               ((G2DSceneGraph)node.getRootNode()).clearPending(node);
+               ConnectionNode n = (ConnectionNode) node;
+               for (INode nn : n.getNodes())
+                       ProfileVariables.claimNodeProperty(nn, "stroke", ONE, evaluationContext);
+       }
+
+}
similarity index 52%
rename from org.simantics.district.network/src/org/simantics/district/network/profile/EdgeNodeStyle.java
rename to org.simantics.district.network/src/org/simantics/district/network/profile/VertexStyle.java
index 9d96f48c4146bf49a85ecb8746dce3812282382d..6fc5dfccf7a46c483d46e8d42a5a43611c404a7e 100644 (file)
@@ -10,30 +10,21 @@ import org.simantics.scenegraph.g2d.nodes.ConnectionNode;
 import org.simantics.scenegraph.profile.EvaluationContext;
 import org.simantics.scenegraph.profile.common.ProfileVariables;
 
-public class EdgeNodeStyle extends StyleBase<Double> {
+public class VertexStyle extends StyleBase<Double> {
 
-    public EdgeNodeStyle() {
-        System.out.println("EdgeNodeStyle init");
-    }
-    
     @Override
     public Double calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
-        DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
-        Double diameter = graph.getPossibleRelatedValue(groupItem, DN.Edge_HasDiameter);
-        if (diameter != null) {
-            return diameter;
-        }
-        return super.calculateStyle(graph, runtimeDiagram, entry, groupItem);
+        return 1.0;
     }
-    
+
     @Override
     public void applyStyleForNode(EvaluationContext observer, INode node, Double result) {
-        if (result != null) {
-            ConnectionNode n = (ConnectionNode) node;
-            for (INode nn : n.getNodes()) {
-                ProfileVariables.claimNodeProperty(nn, "stroke", result, observer);
-            }
-        }
+//        if (result != null) {
+//            ConnectionNode n = (ConnectionNode) node;
+//            for (INode nn : n.getNodes()) {
+//                ProfileVariables.claimNodeProperty(nn, "stroke", result, observer);
+//            }
+//        }
     }
     
 }