]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network/scl/Simantics/District/Algorithm.scl
Enable static info labels for vertex elements
[simantics/district.git] / org.simantics.district.network / scl / Simantics / District / Algorithm.scl
index 259ad087620bed708791cb3887a4ba12f6977aef..c03ea7964ebc379a32ebc96a2547f3921a8391cd 100644 (file)
@@ -118,6 +118,20 @@ reportDisconnectedSubnetworks vertexThreshold (diagram, subgraphs) = do
         print ""
         forI (sortStrings (map showEdge es)) (\i s -> print "* e\(i): \(s)")
 
+"""
+Get a set of vertices that acts as break points between network branches.
+"""
+branchPoints :: Resource -> <ReadGraph> [Resource]
+branchPoints networkDiagram = runProc let
+  in  
+    filter isBranchPoint vertices
+  where 
+    all       = if isInstanceOf networkDiagram DIA.Diagram
+                then networkDiagram # L0.ConsistsOf
+                else singleObject networkDiagram MOD.CompositeToDiagram # L0.ConsistsOf
+    vertices = filter (flip isInstanceOf DN.Vertex) all
+    isBranchPoint v = length (v # DN.HasEndVertex_Inverse) != 1 || length (v # DN.HasStartVertex_Inverse) != 1
+
 """
 Get a set of the edges that are at the middle points of each span between branch points.
 """