From: Reino Ruusu Date: Thu, 6 Jun 2019 09:53:33 +0000 (+0300) Subject: Enable static info labels for vertex elements X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F2928%2F1;p=simantics%2Fdistrict.git Enable static info labels for vertex elements gitlab #47 APROS-15309 Change-Id: If37d3256d6bed52a444573e957c47b9997abcb6a --- diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkStaticInfoStyle.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkStaticInfoStyle.java index 49d524a4..20e8ecbc 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkStaticInfoStyle.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkStaticInfoStyle.java @@ -55,13 +55,17 @@ public class DistrictNetworkStaticInfoStyle extends StyleBase edgesToUse = graph.syncRequest(new MidBranchEdgeSetRequest(diagram), TransientCacheListener.instance()); - if (!edgesToUse.contains(mapElement)) - return null; + if (isEdge) { + Resource diagram = graph.getSingleObject(mapElement, Layer0.getInstance(graph).PartOf); + Set edgesToUse = graph.syncRequest(new MidBranchEdgeSetRequest(diagram), TransientCacheListener.instance()); + if (!edgesToUse.contains(mapElement)) + return null; + } DiagramResource DIA = DiagramResource.getInstance(graph); StructuralResource2 STR = StructuralResource2.getInstance(graph); @@ -90,14 +94,23 @@ public class DistrictNetworkStaticInfoStyle extends StyleBase 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. """