X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=inline;f=org.simantics.district.network%2Fscl%2FSimantics%2FDistrict%2FAlgorithm.scl;h=c03ea7964ebc379a32ebc96a2547f3921a8391cd;hb=29af77f249a4842bfd3f9280755121c9c98b32a1;hp=259ad087620bed708791cb3887a4ba12f6977aef;hpb=f18e970129eb1c170de15e55dd80c29ccd0a3872;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network/scl/Simantics/District/Algorithm.scl b/org.simantics.district.network/scl/Simantics/District/Algorithm.scl index 259ad087..c03ea796 100644 --- a/org.simantics.district.network/scl/Simantics/District/Algorithm.scl +++ b/org.simantics.district.network/scl/Simantics/District/Algorithm.scl @@ -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 -> [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. """