use of aimax.osm.data.MapEvent in project aima-java by aimacode.
the class DefaultMap method addToTrack.
/** {@inheritDoc} */
@Override
public void addToTrack(String trackName, Position pos) {
Track track = getTrack(trackName);
if (track == null) {
track = new DefaultTrack(nextTrackId++, trackName, trackName);
updateEntityViewInfo(track, false);
tracks.add(track);
}
track.addNode(pos);
fireMapDataEvent(new MapEvent(this, MapEvent.Type.TRACK_MODIFIED, track.getId()));
}
use of aimax.osm.data.MapEvent in project aima-java by aimacode.
the class DefaultMap method compile.
/**
* Separates way nodes from points of interests, cleans up useless garbage
* and creates a kd-tree for the remaining entities. Always call this method
* before using using the container for viewing.
*/
public void compile() {
ArrayList<Long> toDelete = new ArrayList<Long>();
for (MapNode node : nodes.values()) {
if (node.hasPosition()) {
if (node.getName() != null || node.getAttributes().length > 0)
pois.add(node);
else if (node.getWayRefs().isEmpty())
toDelete.add(node.getId());
} else {
LOG.warning("No definition found for referenced node " + node.getId() + ".");
toDelete.add(node.getId());
}
}
for (long id : toDelete) {
nodes.remove(id);
}
BoundingBox bbAllNodes = new BoundingBox();
bbAllNodes.adjust(nodes.values());
bbAllNodes.adjust(pois);
if (boundingBox == null)
boundingBox = bbAllNodes;
else
boundingBox.intersectWith(bbAllNodes);
applyClassifierAndUpdateTree(bbAllNodes);
fireMapDataEvent(new MapEvent(this, MapEvent.Type.MAP_NEW));
}
use of aimax.osm.data.MapEvent in project aima-java by aimacode.
the class DefaultMap method clearMarkersAndTracks.
/** {@inheritDoc} */
@Override
public void clearMarkersAndTracks() {
markers.clear();
tracks.clear();
fireMapDataEvent(new MapEvent(this, MapEvent.Type.MAP_MODIFIED));
}
use of aimax.osm.data.MapEvent in project aima-java by aimacode.
the class DefaultMap method clear.
/** No data available after this reset. */
protected void clear() {
EntityAttributeManager.instance().clearHash();
nodes.clear();
ways.clear();
pois.clear();
markers.clear();
tracks.clear();
entityTree = null;
boundingBox = null;
fireMapDataEvent(new MapEvent(this, MapEvent.Type.MAP_CLEARED));
}
use of aimax.osm.data.MapEvent in project aima-java by aimacode.
the class DefaultMap method createTrack.
/** {@inheritDoc} */
@Override
public void createTrack(String trackName, List<Position> positions) {
clearTrack(trackName);
Track track = new DefaultTrack(nextTrackId++, trackName, trackName);
updateEntityViewInfo(track, false);
tracks.add(track);
for (Position pos : positions) track.addNode(pos);
fireMapDataEvent(new MapEvent(this, MapEvent.Type.TRACK_MODIFIED, track.getId()));
}
Aggregations