]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Add connected components to visualisation from profiles 46/3846/2
authorjsimomaa <jani.simomaa@gmail.com>
Wed, 19 Feb 2020 12:05:50 +0000 (14:05 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 19 Feb 2020 15:06:20 +0000 (15:06 +0000)
District profiles should all be implemented now with dynamic
visualisations

gitlab #59

Change-Id: Ie3747b37b9d5b68f8feb5182e3b3b0af4bd67d11
(cherry picked from commit 415a01dee406d277eabee9ab4a3780a4d056a719)

12 files changed:
org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph
org.simantics.district.network.ontology/graph/DistrictNetworkProfiles.pgraph
org.simantics.district.network.ui/adapters.xml
org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/ConnectionLineNode.java [new file with mode: 0644]
org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/styles/ConnectionLineStyle.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/visualisations/DynamicVisualisationsUI.java
org.simantics.district.network/META-INF/MANIFEST.MF
org.simantics.district.network/src/org/simantics/district/network/profile/ActiveDynamicVisualisationsRequest.java
org.simantics.district.network/src/org/simantics/district/network/visualisations/DynamicVisualisations.java
org.simantics.district.network/src/org/simantics/district/network/visualisations/model/DynamicVisualisation.java
org.simantics.district.network/src/org/simantics/district/network/visualisations/model/VisualisationComponent.java [new file with mode: 0644]

index 4405434e33f6707bdcfc9e7c88125114322b88f2..4c1e3382778b124e8270f02d1518373d560b114f 100644 (file)
@@ -283,6 +283,8 @@ DN.Diagram.Visualisations <T L0.Entity
         @defProperty "Show Elevation server bounding box" L0.Boolean
     >-- DN.Diagram.Visualisations.NotInSimulation
         @defProperty "Not in Simulation" L0.Boolean
+    >-- DN.Diagram.Visualisations.ShowConnectedComponents
+        @defProperty "Show Connected Components" L0.Boolean
 
 DN.Diagram.Visualisations.ColorContribution <T L0.Entity
 DN.Diagram.Visualisations.SizeContribution <T L0.Entity
index 0bac7530ad2783c2cac5b988d06a57536a7a3185..d9b5b015accf1cb2226822d6392b7a84fe17b69b 100644 (file)
@@ -28,7 +28,7 @@ DN.Groups.EdgeGroup : DIA.TypeGroup
 //DN.ArrowLengthStyle : DIA.Style
 //DN.HideStyle : DIA.Style
 //DN.VertexSymbolStyle : DIA.Style
-DN.ConnectionLineStyle : DIA.Style
+//DN.ConnectionLineStyle : DIA.Style
 //DN.ElevationRectangleStyle : DIA.Style
 
 // Style for user component-specified static info text for network branches
index 8702a82d5321813097e5b87e1df18892d52a622c..c9adfafbdad704b48713966b7730f489769305f5 100644 (file)
             <graph />
         </type>
     </target>
-    
-    <target interface="org.simantics.scenegraph.profile.Style">
-        <resource uri="http://www.simantics.org/DistrictNetwork-1.0/ConnectionLineStyle"
-            class="org.simantics.district.network.ui.styles.ConnectionLineStyle">
-        </resource>
-    </target>
-    
     <target interface="org.simantics.g2d.diagram.DiagramClass">
         <baseType uri="http://www.simantics.org/DistrictNetwork-1.0/Diagram" />
         <adapter uri="http://www.simantics.org/DistrictNetwork-1.0/Diagram"
diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/ConnectionLineNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/ConnectionLineNode.java
new file mode 100644 (file)
index 0000000..12be4f7
--- /dev/null
@@ -0,0 +1,75 @@
+package org.simantics.district.network.ui.nodes;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.geom.Line2D;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.List;
+
+import org.simantics.g2d.utils.GeometryUtils;
+import org.simantics.scenegraph.g2d.G2DNode;
+
+public class ConnectionLineNode extends G2DNode {
+    
+    public static final String NODE_NAME = "districtNetworkConnection";
+    
+       private static final BasicStroke STROKE = new BasicStroke(1.f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] {4.f, 2.f}, 0.f);
+       private static final Color[] colors = { Color.RED, Color.GREEN, Color.BLUE, Color.ORANGE, Color.CYAN, Color.PINK };
+       
+       private float strokeWidth;
+       private Line2D[] lines;
+
+       public ConnectionLineNode() {
+               super();
+       }
+       
+       private static final long serialVersionUID = 1L;
+
+       @Override
+       public Rectangle2D getBoundsInLocal() {
+               return null;
+       }
+
+       @Override
+       public Rectangle2D getBoundsInLocal(boolean b) {
+               return null;
+       }
+
+       @Override
+       public Rectangle2D getBounds() {
+               return null;
+       }
+       
+       public void setStrokeWidth(float w) {
+               strokeWidth = w;
+       }
+       
+       public void setPoints(List<Point2D> result) {
+               Point2D p0 = DistrictNetworkNodeUtils.calculatePoint2D(result.get(0), null);
+               lines = new Line2D[result.size() - 1];
+               for (int i = 1; i < result.size(); i++) 
+               {
+                       Point2D p = result.get(i);
+                       lines[i-1] = p != null ? new Line2D.Double(p0, DistrictNetworkNodeUtils.calculatePoint2D(p, null)) : null;
+               }
+       }
+       
+       @Override
+       public void render(Graphics2D g2d) {
+               if (lines == null || lines.length == 0)
+                       return;
+               
+               // Keep fixed line width on screen
+               float scaleRecip = (float) GeometryUtils.getScale(g2d.getTransform());
+               g2d.setStroke(GeometryUtils.scaleStroke(STROKE, strokeWidth / scaleRecip));
+               
+               for (int i = 0; i < lines.length; i++) {
+                       if (lines[i] != null) {
+                               g2d.setColor(colors[i % colors.length]);
+                               g2d.draw(lines[i]);
+                       }
+               }
+       }
+}
\ No newline at end of file
index b1bb1468dd63653ee1c423a9653fbc307088bc8e..4ea8bbf1ccc5d366c7e2ca83dc5338d7d047bc2c 100644 (file)
@@ -7,6 +7,7 @@ import java.awt.RenderingHints;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
+import java.util.List;
 import java.util.Optional;
 
 import org.simantics.district.network.ui.adapters.DistrictNetworkVertex;
@@ -257,7 +258,7 @@ public class DistrictNetworkVertexNode extends G2DParentNode implements ISelecti
             child.setInfo(null);
         }
     }
-    
+
     public void setInSimulation(Optional<Boolean> isInSimulation) {
         if (!isInSimulation.isPresent()) {
             removeNode(NotInSimulationNode.NODE_NAME);
@@ -267,4 +268,15 @@ public class DistrictNetworkVertexNode extends G2DParentNode implements ISelecti
             child.setIsInSimulation(isInSimulation.get());
         }
     }
+
+    public void setConnectionLinePoints(List<Point2D> points) {
+        if (points == null) {
+            removeNode(ConnectionLineNode.NODE_NAME);
+        } else {
+            ConnectionLineNode child = getOrCreateNode(ConnectionLineNode.NODE_NAME, ConnectionLineNode.class);
+            child.setZIndex(0);
+            child.setStrokeWidth(2.f);
+            child.setPoints(points);
+        }
+    }
 }
index b74cbba676411b33bb6142c55ab10952014de696..d8d2f11838e5ada7bb3302d5fa4aa4230b7f07a1 100644 (file)
@@ -1,11 +1,6 @@
 package org.simantics.district.network.ui.styles;
 
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Graphics2D;
-import java.awt.geom.Line2D;
 import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -21,137 +16,79 @@ import org.simantics.diagram.profile.StyleBase;
 import org.simantics.diagram.stubs.DiagramResource;
 import org.simantics.district.network.DistrictNetworkUtil;
 import org.simantics.district.network.ontology.DistrictNetworkResource;
-import org.simantics.district.network.ui.nodes.DistrictNetworkNodeUtils;
+import org.simantics.district.network.ui.nodes.ConnectionLineNode;
 import org.simantics.layer0.Layer0;
 import org.simantics.modeling.ModelingResources;
 import org.simantics.scenegraph.INode;
-import org.simantics.scenegraph.g2d.G2DNode;
 import org.simantics.scenegraph.profile.EvaluationContext;
 import org.simantics.scenegraph.profile.common.ProfileVariables;
-import org.simantics.scenegraph.utils.GeometryUtils;
 import org.simantics.scl.compiler.top.ValueNotFound;
 import org.simantics.scl.osgi.SCLOsgi;
 import org.simantics.scl.runtime.SCLContext;
 import org.simantics.scl.runtime.function.Function1;
 import org.simantics.structural.stubs.StructuralResource2;
 
+@Deprecated
 public class ConnectionLineStyle extends StyleBase<List<Point2D>> {
        
-       public static class ConnectionLineNode extends G2DNode {
-               private static final BasicStroke STROKE = new BasicStroke(1.f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] {4.f, 2.f}, 0.f);
-               private static final Color[] colors = { Color.RED, Color.GREEN, Color.BLUE, Color.ORANGE, Color.CYAN, Color.PINK };
-               
-               private float strokeWidth;
-               private Line2D[] lines;
+       @Override
+       public List<Point2D> calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem)
+                       throws DatabaseException {
+               return doCalculateConnectedComponentPoints(graph, groupItem);
+       }
 
-               public ConnectionLineNode() {
-                       super();
-               }
-               
-               private static final long serialVersionUID = 1L;
+    public static List<Point2D> doCalculateConnectedComponentPoints(ReadGraph graph, Resource vertex) throws DatabaseException {
+        DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+        ModelingResources MOD = ModelingResources.getInstance(graph);
+        StructuralResource2 STR = StructuralResource2.getInstance(graph);
+        
+        if (!graph.isInstanceOf(vertex, DN.Vertex))
+            return Collections.emptyList();
 
-               @Override
-               public Rectangle2D getBoundsInLocal() {
-                       return null;
-               }
+        double[] coords = graph.getRelatedValue(vertex, DiagramResource.getInstance(graph).HasLocation);
 
-               @Override
-               public Rectangle2D getBoundsInLocal(boolean b) {
-                       return null;
-               }
+        Resource component = DistrictNetworkUtil.getMappedComponentCached(graph, vertex);
+        if (component == null)
+            return Collections.emptyList();
 
-               @Override
-               public Rectangle2D getBounds() {
-                       return null;
-               }
-               
-               public void setStrokeWidth(float w) {
-                       strokeWidth = w;
-               }
-               
-               public void setPoints(List<Point2D> result) {
-                       Point2D p0 = DistrictNetworkNodeUtils.calculatePoint2D(result.get(0), null);
-                       lines = new Line2D[result.size() - 1];
-                       for (int i = 1; i < result.size(); i++) 
-                       {
-                               Point2D p = result.get(i);
-                               lines[i-1] = p != null ? new Line2D.Double(p0, DistrictNetworkNodeUtils.calculatePoint2D(p, null)) : null;
-                       }
-               }
-               
-               @Override
-               public void render(Graphics2D g2d) {
-                       if (lines == null || lines.length == 0)
-                               return;
-                       
-                       // Keep fixed line width on screen
-                       float scaleRecip = (float) GeometryUtils.getScale(g2d.getTransform());
-                       g2d.setStroke(GeometryUtils.scaleStroke(STROKE, strokeWidth / scaleRecip));
-                       
-                       for (int i = 0; i < lines.length; i++) {
-                               if (lines[i] != null) {
-                                       g2d.setColor(colors[i % colors.length]);
-                                       g2d.draw(lines[i]);
-                               }
-                       }
-               }
-       }
-       
-       @Override
-       public List<Point2D> calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem)
-                       throws DatabaseException {
-               DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
-               ModelingResources MOD = ModelingResources.getInstance(graph);
-               StructuralResource2 STR = StructuralResource2.getInstance(graph);
-               
-               Resource vertex = groupItem;
-               if (!graph.isInstanceOf(vertex, DN.Vertex))
-                       return Collections.emptyList();
-               
-               double[] coords = graph.getRelatedValue(vertex, DiagramResource.getInstance(graph).HasLocation);
-               
-               Resource component = DistrictNetworkUtil.getMappedComponentCached(graph, vertex);
-               if (component == null)
-                       return Collections.emptyList();
-               
-               Resource componentType = graph.getPossibleType(component, STR.Component);
-               if (componentType == null)
-                       return Collections.emptyList();
-               
-               Function1<Resource, List<Resource>> fun = getConnectedComponentsFunctionCached(graph, componentType);
-               if (fun == null)
-                       return Collections.emptyList();
+        Resource componentType = graph.getPossibleType(component, STR.Component);
+        if (componentType == null)
+            return Collections.emptyList();
+
+        Function1<Resource, List<Resource>> fun = getConnectedComponentsFunctionCached(graph, componentType);
+        if (fun == null)
+            return Collections.emptyList();
+
+        List<Resource> components = Simantics.applySCLRead(graph, fun, component);
+
+        if (components == null || components.isEmpty())
+            return Collections.emptyList();
+
+        List<Point2D> result = new ArrayList<>(components.size() + 1);
+        result.add(new Point2D.Double(coords[0], coords[1]));
+        for (Resource comp : components) {
+            Resource e = comp != null ? graph.getPossibleObject(comp, MOD.ComponentToElement) : null;
+            Resource mappingElement = e != null ? graph.getPossibleObject(e, DN.MappedFromElement) : null;
+            if (mappingElement != null) {
+                double[] coords2 = graph.getRelatedValue(mappingElement,
+                        DiagramResource.getInstance(graph).HasLocation);
+                result.add(new Point2D.Double(coords2[0], coords2[1]));
+            } else {
+                result.add(null);
+            }
+        }
+
+        return result;
+    }
 
-               List<Resource> components = Simantics.applySCLRead(graph, fun, component);
-               
-               if (components == null || components.isEmpty())
-                       return Collections.emptyList();
-               
-               List<Point2D> result = new ArrayList<>(components.size() + 1);
-               result.add(new Point2D.Double(coords[0], coords[1]));
-               for (Resource comp : components) {
-                       Resource e = comp != null ? graph.getPossibleObject(comp, MOD.ComponentToElement) : null;
-                       Resource mappingElement = e != null ? graph.getPossibleObject(e, DN.MappedFromElement) : null;
-                       if (mappingElement != null) {
-                               double[] coords2 = graph.getRelatedValue(mappingElement, DiagramResource.getInstance(graph).HasLocation);
-                               result.add(new Point2D.Double(coords2[0], coords2[1]));
-                       }
-                       else {
-                               result.add(null);
-                       }
-               }
-               
-               return result;
-       }
-       
        @Override
        public void applyStyleForNode(EvaluationContext observer, INode parent, List<Point2D> result) {
                if (result == null || result.size() < 2) {
-                       ProfileVariables.denyChild(parent, "*", "districtNetworkConnection");
+                       ProfileVariables.denyChild(parent, "*", ConnectionLineNode.NODE_NAME);
                        return;
                }
                
-               ConnectionLineNode node = ProfileVariables.claimChild(parent, "*", "districtNetworkConnection", ConnectionLineNode.class, observer);
+               ConnectionLineNode node = ProfileVariables.claimChild(parent, "*", ConnectionLineNode.NODE_NAME, ConnectionLineNode.class, observer);
                if (node == null)
                        return;
                
@@ -162,7 +99,7 @@ public class ConnectionLineStyle extends StyleBase<List<Point2D>> {
 
        @Override
        protected void cleanupStyleForNode(EvaluationContext evaluationContext, INode parent) {
-               ProfileVariables.denyChild(parent, "*", "districtNetworkConnection");
+               ProfileVariables.denyChild(parent, "*", ConnectionLineNode.NODE_NAME);
        }
        
        private static Function1<Resource, List<Resource>> getConnectedComponentsFunctionCached(ReadGraph graph, Resource componentType)
index e21bcb2a241a59e68a05c1815bb223deb1b34ceb..c8d34072bfca8c5f01edccd937b57f255417a797 100644 (file)
@@ -103,6 +103,7 @@ public class DynamicVisualisationsUI {
     private Button hoveringEdgesEnabledButton;
     private Button elevationServerEnabledButton;
     private Button notInSimulationButton;
+    private Button showConnectedComponentsButton;
 
     private List<Supplier<Pair<String, DynamicArrowContribution>>> edgeArrowSuppliers;
 
@@ -289,6 +290,10 @@ public class DynamicVisualisationsUI {
         elevationServerEnabledButton = new Button(parent, SWT.CHECK);
         elevationServerEnabledButton.setText("Elevation Server Bounding Box");
         addSelectionListener(elevationServerEnabledButton);
+        
+        showConnectedComponentsButton = new Button(parent, SWT.CHECK);
+        showConnectedComponentsButton.setText("Show Connected Components");
+        addSelectionListener(showConnectedComponentsButton);
     }
     
     private void initializeHoverElements(Composite parent) {
@@ -671,6 +676,7 @@ public class DynamicVisualisationsUI {
         
         boolean elevationServerBoundingBox = elevationServerEnabledButton.getSelection();
         boolean notInSimulation = notInSimulationButton.getSelection();
+        boolean showConnectedComponents = showConnectedComponentsButton.getSelection();
         
         Simantics.getSession().asyncRequest(new WriteRequest() {
             
@@ -713,6 +719,7 @@ public class DynamicVisualisationsUI {
                 
                 DynamicVisualisations.setElevationServerBoundingBox(graph, exist, elevationServerBoundingBox);
                 DynamicVisualisations.setNotInSimulation(graph, exist, notInSimulation);
+                DynamicVisualisations.setShowConnectedComponents(graph, exist, showConnectedComponents);
             }
         });
     }
@@ -1488,6 +1495,10 @@ public class DynamicVisualisationsUI {
                 hoveringVertexEnabledButton.setSelection(visualisation.isKeyVariablesVertexHover());
                 hoveringEdgesEnabledButton.setSelection(visualisation.isKeyVariablesEdgesHover());
                 
+                showConnectedComponentsButton.setSelection(visualisation.showConnectedComponents());
+                notInSimulationButton.setSelection(visualisation.isInSimulation());
+                elevationServerEnabledButton.setSelection(visualisation.isShowElevationServerBoundingBox());
+                
                 hideConsumersButton.setSelection(visualisation.isHideConsumers());
                 hideEdgesButton.setSelection(visualisation.isHideEdges());
                 hideProducersButton.setSelection(visualisation.isHideProducers());
index 5ab8e0ded9aadc8fe638c93a764012b8b8d2576a..f5976e2652b317ba2ead9c0aa5697c5efbf8d204 100644 (file)
@@ -21,7 +21,8 @@ Require-Bundle: org.simantics.db,
  org.simantics.db.indexing,
  org.simantics.scl.osgi,
  org.eclipse.collections.eclipse-collections,
- org.eclipse.collections.eclipse-collections-api
+ org.eclipse.collections.eclipse-collections-api,
+ org.simantics.structural.synchronization.client
 Export-Package: org.simantics.district.network,
  org.simantics.district.network.changeset,
  org.simantics.district.network.profile,
index 08a1b01330642f3abbe99d37b426fb0c482c083c..3bd0594817accce56ef5a5e88b075eb5f89ccc14 100644 (file)
@@ -89,8 +89,9 @@ public class ActiveDynamicVisualisationsRequest extends ResourceRead<DynamicVisu
                 Boolean keyVariablesVertexHover = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_KeyVariableVertexHover, Bindings.BOOLEAN);
                 Boolean keyVariablesEdgesHover = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_KeyVariableEdgeHover, Bindings.BOOLEAN);
                 
-                Boolean showElevationServerBoundingBox = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_ShowElevationServerBoundingBox, Bindings.BOOLEAN);
-                Boolean notInSimulation = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_NotInSimulation, Bindings.BOOLEAN);
+                Boolean showElevationServerBoundingBox = DynamicVisualisations.showElevationServerBoundingBox(graph, visualisationResource);
+                Boolean notInSimulation = DynamicVisualisations.isNotInSimulation(graph, visualisationResource);
+                Boolean showConnectedComponents = DynamicVisualisations.showConnectedComponents(graph, visualisationResource);
                 
                 DynamicVisualisation visualisation = new DynamicVisualisation(name, visualisationResource,
                         interval != null ? interval : 2000,
@@ -122,7 +123,8 @@ public class ActiveDynamicVisualisationsRequest extends ResourceRead<DynamicVisu
                         keyVariablesVertexHover != null ? keyVariablesVertexHover : false,
                         keyVariablesEdgesHover != null ? keyVariablesEdgesHover : false,
                         showElevationServerBoundingBox != null ? showElevationServerBoundingBox : false,
-                        notInSimulation != null ? notInSimulation : false
+                        notInSimulation != null ? notInSimulation : false,
+                        showConnectedComponents != null ? showConnectedComponents : false
                     );
                 return visualisation; 
             }
index e2cb72bfb0cbb3b6f05476d77380a8e681acbf0b..fd3f704bb68b07aadb993989902423ce64c88698 100644 (file)
@@ -363,4 +363,14 @@ public class DynamicVisualisations {
         return graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_NotInSimulation, Bindings.BOOLEAN);
     }
 
+    public static void setShowConnectedComponents(WriteGraph graph, Resource visualisation, boolean showConnectedComponents) throws DatabaseException {
+        DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+        graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowConnectedComponents, showConnectedComponents, Bindings.BOOLEAN);
+    }
+
+    public static Boolean showConnectedComponents(ReadGraph graph, Resource visualisation) throws DatabaseException {
+        DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+        return graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowConnectedComponents, Bindings.BOOLEAN);
+    }
+
 }
index d64461e18936e6884f1ba5b686f0807415baecfe..683ab4194a8b15ca39a8beb2b3e7297819ea7128 100644 (file)
@@ -44,12 +44,13 @@ public class DynamicVisualisation {
     private final boolean dynamicSymbolsShutoffValves;
     private final boolean dynamicSymbolsValves;
     private final boolean dynamicSymbolsPumpingStations;
-    private boolean keyVariablesVertexHover;
-    private boolean keyVariablesEdgesHover;
-    private boolean resetVisualisation;
+    private final boolean keyVariablesVertexHover;
+    private final boolean keyVariablesEdgesHover;
+    private final boolean resetVisualisation;
     
-    private boolean showElevationServerBoundingBox;
-    private boolean isInSimulation;
+    private final boolean showElevationServerBoundingBox;
+    private final boolean isInSimulation;
+    private final boolean showConnectedComponents;
     
     public DynamicVisualisation(String name, Resource visualisationResource, long interval, boolean disabled,
             boolean resetVisualisation, Map<String, DynamicColorContribution> colorContributions,
@@ -76,7 +77,8 @@ public class DynamicVisualisation {
             boolean keyVariablesVertexHover,
             boolean keyVariablesEdgesHover,
             boolean showElevationServerBoundingBox,
-            boolean isInSimulation
+            boolean isInSimulation,
+            boolean showConnectedComponents
             ) {
         this.name = name;
         this.visualisationResource = visualisationResource;
@@ -114,6 +116,7 @@ public class DynamicVisualisation {
         
         this.showElevationServerBoundingBox = showElevationServerBoundingBox;
         this.isInSimulation = isInSimulation;
+        this.showConnectedComponents = showConnectedComponents;
     }
 
     public String getName() {
@@ -239,4 +242,12 @@ public class DynamicVisualisation {
     public Map<String, DynamicSymbolContributionObject> getDynamicSymbolContributions() {
         return dynamicSymbolContributions;
     }
+    
+    public boolean isShowElevationServerBoundingBox() {
+        return showElevationServerBoundingBox;
+    }
+    
+    public boolean showConnectedComponents() {
+        return showConnectedComponents;
+    }
 }
diff --git a/org.simantics.district.network/src/org/simantics/district/network/visualisations/model/VisualisationComponent.java b/org.simantics.district.network/src/org/simantics/district/network/visualisations/model/VisualisationComponent.java
new file mode 100644 (file)
index 0000000..e6dff12
--- /dev/null
@@ -0,0 +1,32 @@
+package org.simantics.district.network.visualisations.model;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+
+import org.simantics.db.Resource;
+import org.simantics.structural.synchronization.utils.ComponentBase;
+
+public class VisualisationComponent {
+
+    private final Resource resource;
+    private final ComponentBase<?> component;
+    private final List<Point2D> connectedComponents;
+
+    public VisualisationComponent(Resource resource, ComponentBase<?> component, List<Point2D> connectedComponents) {
+        this.resource = resource;
+        this.component = component;
+        this.connectedComponents = connectedComponents;
+    }
+
+    public Resource getResource() {
+        return resource;
+    }
+
+    public ComponentBase<?> getComponent() {
+        return component;
+    }
+
+    public List<Point2D> getConnectedComponents() {
+        return connectedComponents;
+    }
+}