/** * Get vertices inside a bbox. * * @return */ @Secured({"ROLE_USER"}) @GET @Path("/vertices") @Produces({MediaType.APPLICATION_JSON}) public Object getVertices( @QueryParam("lowerLeft") String lowerLeft, @QueryParam("upperRight") String upperRight, @QueryParam("pointsOnly") boolean pointsOnly, @QueryParam("exactClass") String className, @QueryParam("skipTransit") boolean skipTransit, @QueryParam("skipStreets") boolean skipStreets) { initIndexes(); Envelope envelope = getEnvelope(lowerLeft, upperRight); @SuppressWarnings("unchecked") List<Vertex> query = vertexIndex.query(envelope); List<Vertex> filtered = new ArrayList<Vertex>(); for (Vertex v : query) { if (skipTransit && v instanceof TransitVertex) continue; if (skipStreets && v instanceof StreetVertex) continue; if (className != null && !v.getClass().getName().endsWith("." + className)) continue; filtered.add(v); } if (pointsOnly) { SimpleVertexSet out = new SimpleVertexSet(); out.vertices = new ArrayList<SimpleVertex>(filtered.size()); for (Vertex v : filtered) { out.vertices.add(new SimpleVertex(v)); } return out; } else { VertexSet out = new VertexSet(); out.vertices = filtered; Graph graph = graphService.getGraph(); return out.withGraph(graph); } }