use of aimax.osm.data.Position in project aima-java by aimacode.
the class MapAdapter method getNearestLocation.
/**
* Returns the ID of the way node in the underlying OSM map which is nearest
* with respect to the specified coordinates and additionally passes the
* filter.
*/
public String getNearestLocation(Point2D pt) {
Position pos = new Position((float) pt.getY(), (float) pt.getX());
MapNode node = osmMap.getNearestWayNode(pos, filter);
return (node != null) ? Long.toString(node.getId()) : null;
}
use of aimax.osm.data.Position in project aima-java by aimacode.
the class OsmAgentView method updateTrack.
private void updateTrack(Agent agent, String location) {
MapAdapter map = (MapAdapter) getMapEnv().getMap();
MapNode node = map.getWayNode(location);
if (node != null) {
int aIdx = getMapEnv().getAgents().indexOf(agent);
map.getOsmMap().addToTrack(TRACK_NAME + aIdx, new Position(node.getLat(), node.getLon()));
}
}
Aggregations