@Override public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) { LOG.info("Linking transit stops to tagged bus stops..."); index = new StreetVertexIndexServiceImpl(graph); // iterate over a copy of vertex list because it will be modified ArrayList<Vertex> vertices = new ArrayList<>(); vertices.addAll(graph.getVertices()); for (TransitStop ts : Iterables.filter(vertices, TransitStop.class)) { // if the street is already linked there is no need to linked it again, // could happened if using the prune isolated island boolean alreadyLinked = false; for(Edge e:ts.getOutgoing()){ if(e instanceof StreetTransitLink) { alreadyLinked = true; break; } } if(alreadyLinked) continue; // only connect transit stops that (a) are entrances, or (b) have no associated // entrances if (ts.isEntrance() || !ts.hasEntrances()) { boolean wheelchairAccessible = ts.hasWheelchairEntrance(); if (!connectVertexToStop(ts, wheelchairAccessible)) { LOG.debug("Could not connect " + ts.getStopCode() + " at " + ts.getCoordinate().toString()); //LOG.warn(graph.addBuilderAnnotation(new StopUnlinked(ts))); } } } }
public String toString() { return ((position==null) ? "" :position.toString())+" ("+index+")"; } }
// build polygon p1 LinearRing p1 = new GeometryFactory().createLinearRing(new Coordinate[]{new Coordinate(0,0), new Coordinate(0,10), new Coordinate(10,10), new Coordinate(10,0), new Coordinate(0,0)}); // build polygon p2 LinearRing p2 = new GeometryFactory().createLinearRing(new Coordinate[]{new Coordinate(5,5), new Coordinate(15,5), new Coordinate(15,15), new Coordinate(5,15), new Coordinate(5,5)}); // calculate intersecting points Geometry intersectingPoints = p1.intersection(p2); // print result for(Coordinate c : intersectingPoints.getCoordinates()){ System.out.println(c.toString()); }
// create ring: P1(0,0) - P2(0,10) - P3(10,10) - P4(0,10) LinearRing lr = new GeometryFactory().createLinearRing(new Coordinate[]{new Coordinate(0,0), new Coordinate(0,10), new Coordinate(10,10), new Coordinate(10,0), new Coordinate(0,0)}); // create line: P5(5, -1) - P6(5, 11) -> crossing the ring vertically in the middle LineString ls = new GeometryFactory().createLineString(new Coordinate[]{new Coordinate(5,-1), new Coordinate(5,11)}); // calculate intersection points Geometry intersectionPoints = lr.intersection(ls); // simple output of points for(Coordinate c : intersectionPoints.getCoordinates()){ System.out.println(c.toString()); }
@Override public void filter(Coordinate coord) { try { if (Double.isNaN(coord.z)) { coord.z = 0; } double[] xyz = coordinateOperation .transform(new double[]{coord.x, coord.y, coord.z}); coord.x = xyz[0]; coord.y = xyz[1]; if (xyz.length > 2) { coord.z = xyz[2]; } else { coord.z = Double.NaN; } } catch (IllegalCoordinateException ice) { throw new RuntimeException("Cannot transform the coordinate" + coord.toString(), ice); } }
@Override public void filter(Coordinate coord) { try { if (Double.isNaN(coord.z)) { coord.z = 0; } double[] xyz = coordinateOperation .transform(new double[]{coord.x, coord.y, coord.z}); coord.x = xyz[0]; coord.y = xyz[1]; if (xyz.length > 2) { coord.z = xyz[2]; } else { coord.z = Double.NaN; } } catch (IllegalCoordinateException ice) { throw new RuntimeException("Cannot transform the coordinate" + coord.toString(), ice); } }
@Override public void filter(Coordinate coord) { try { if (Double.isNaN(coord.z)) { coord.z = 0; } double[] xyz = coordinateOperation .transform(new double[]{coord.x, coord.y, coord.z}); coord.x = xyz[0]; coord.y = xyz[1]; if (xyz.length > 2) { coord.z = xyz[2]; } else { coord.z = Double.NaN; } } catch (IllegalCoordinateException ice) { throw new RuntimeException("Cannot transform the coordinate" + coord.toString(), ice); } }
private String makeCoordinateString(Coordinate coordinate) { if(transform != null) { double[] points = new double[]{coordinate.x, coordinate.y}; try { transform.transform(points, 0, points, 0, 1); } catch (TransformException e) { e.printStackTrace(); return null; } StringBuffer buffer = new StringBuffer(50); buffer.append(Double.toString(points[0])); buffer.append(","); buffer.append(Double.toString(points[1])); return buffer.toString(); } else { StringBuffer buffer = new StringBuffer(50); buffer.append(Double.toString(coordinate.x)); buffer.append(","); buffer.append(Double.toString(coordinate.y)); return coordinate.toString(); } }
ErrorSeverity.ERROR, ErrorMessage.format(ErrorMessageKeys.OUTSIDE_CRS, jtsCoord.toString()), new ErrorLocator(-1, -1, XMLUtils .buildXPointer(coordNode)));
+ c.toString(), bestStreet.getName(), parallel, nearestPoint);