- public static Resource create(WriteGraph graph, Resource diagramResource, double[] start, double[] end, double padding) throws DatabaseException {
- return create(graph, diagramResource, null, start, end, padding);
+ public static Optional<Resource> create(WriteGraph graph, Resource diagramResource, double[] start, double startElevation, double[] end, double endElevation, double[] detailedGeometryCoords, double padding) throws DatabaseException {
+ Collection<Resource> vertices = graph.syncRequest(new ObjectsWithType(diagramResource, Layer0.getInstance(graph).ConsistsOf, DistrictNetworkResource.getInstance(graph).Vertex));
+ double halfPadding = padding / 2;
+
+ 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, false));
+ }
+ return create(graph, vv, diagramResource, null, start, startElevation, end, endElevation, detailedGeometryCoords, padding, true);