Search in sources :

Example 6 with MapWay

use of aimax.osm.data.entities.MapWay in project aima-java by aimacode.

the class MapAdapter method getLocations.

/** {@inheritDoc} Very expensive for large maps! */
@Override
public List<String> getLocations() {
    List<String> result = new ArrayList<>();
    HashSet<MapNode> nodeHash = new HashSet<>();
    for (MapWay way : osmMap.getWays(new BoundingBox(-90, -180, 90, 180))) {
        if (filter == null || filter.isAccepted(way)) {
            for (MapNode node : way.getNodes()) if (!nodeHash.contains(node)) {
                result.add(Long.toString(node.getId()));
                nodeHash.add(node);
            }
        }
    }
    return result;
}
Also used : MapWay(aimax.osm.data.entities.MapWay) BoundingBox(aimax.osm.data.BoundingBox) ArrayList(java.util.ArrayList) MapNode(aimax.osm.data.entities.MapNode) HashSet(java.util.HashSet)

Aggregations

MapNode (aimax.osm.data.entities.MapNode)6 MapWay (aimax.osm.data.entities.MapWay)6 MapEntity (aimax.osm.data.entities.MapEntity)3 BoundingBox (aimax.osm.data.BoundingBox)2 Position (aimax.osm.data.Position)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Track (aimax.osm.data.entities.Track)1 WayRef (aimax.osm.data.entities.WayRef)1 OsmRuntimeException (aimax.osm.reader.OsmRuntimeException)1 IOException (java.io.IOException)1 StringTokenizer (java.util.StringTokenizer)1