@Override public void visit(Way w) { if (w.getNodesCount() > 0 // do not consider empty ways && !w.hasKey( "addr:interpolation") // ignore addr:interpolation ways as they are not physical // features and most of // the time very near the associated highway, which is perfectly normal, see #9332 && !w.hasTag("highway", "platform") && !w.hasTag("railway", "platform") // similarly for public transport platforms ) { ways.addAll(getWaySegments(w)); QuadBuckets<Node> set = endnodes; if (w.hasKey("highway") || w.hasKey("railway")) { set = endnodesHighway; } addNode(w.firstNode(), set); addNode(w.lastNode(), set); } }
List<MyWaySegment> getWaySegments(Way w) { List<MyWaySegment> ret = new ArrayList<>(); if (!w.isUsable() || w.hasKey("barrier") || w.hasTag("natural", "cliff")) return ret; int size = w.getNodesCount(); if (size < 2) return ret; for (int i = 1; i < size; ++i) { if (i < size - 1) { addNode(w.getNode(i), middlenodes); } Node a = w.getNode(i - 1); Node b = w.getNode(i); if (a.isDrawable() && b.isDrawable()) { MyWaySegment ws = new MyWaySegment(w, a, b); if (ws.isBoundary || ws.isAbandoned) { continue; } ret.add(ws); } } return ret; }