- Quadtree vv = Simantics.getSession().syncRequest(new UniqueRead<Quadtree>() {
-
- @Override
- public Quadtree perform(ReadGraph graph) throws DatabaseException {
- Collection<Resource> vertices = graph.syncRequest(new ObjectsWithType(model.getParentDiagram(), Layer0.getInstance(graph).ConsistsOf, DistrictNetworkResource.getInstance(graph).Vertex));
- Quadtree vv = new Quadtree();
- for (Resource vertex : vertices) {
- double[] coords = graph.getRelatedValue2(vertex, DiagramResource.getInstance(graph).HasLocation, Bindings.DOUBLE_ARRAY);
- double x1 = coords[0] - halfPadding;
- double y1= coords[1] - halfPadding;
- double x2 = coords[0] + halfPadding;
- double y2= coords[1] + halfPadding;
- Envelope e = new Envelope(x1, x2, y1, y2);
- vv.insert(e, new ResourceVertex(vertex, coords, true));
- }
- return vv;
- }
- });