Search in sources :

Example 6 with MapAdapter

use of aimax.osm.routing.MapAdapter in project aima-java by aimacode.

the class OsmAgentBaseApp method updateTrack.

/** Visualizes agent positions. Call from simulation thread. */
private void updateTrack(Agent agent, Metrics metrics) {
    MapAdapter map = (MapAdapter) env.getMap();
    MapNode node = map.getWayNode(env.getAgentLocation(agent));
    if (node != null) {
        Platform.runLater(() -> map.getOsmMap().addToTrack(TRACK_NAME, new Position(node.getLat(), node.getLon())));
    }
    simPaneCtrl.setStatus(metrics.toString());
}
Also used : Position(aimax.osm.data.Position) MapNode(aimax.osm.data.entities.MapNode) MapAdapter(aimax.osm.routing.MapAdapter)

Example 7 with MapAdapter

use of aimax.osm.routing.MapAdapter 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()));
    }
}
Also used : Position(aimax.osm.data.Position) MapNode(aimax.osm.data.entities.MapNode) MapAdapter(aimax.osm.routing.MapAdapter)

Aggregations

MapAdapter (aimax.osm.routing.MapAdapter)7 Position (aimax.osm.data.Position)3 MapNode (aimax.osm.data.entities.MapNode)3 MapBuilder (aimax.osm.data.MapBuilder)2 DefaultMapBuilder (aimax.osm.data.impl.DefaultMapBuilder)2 Bz2OsmReader (aimax.osm.reader.Bz2OsmReader)2 MapReader (aimax.osm.reader.MapReader)2