+ 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();
+
+ 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;