use of aimax.osm.data.MapEvent in project aima-java by aimacode.
the class DefaultMap method setEntityClassifier.
/**
* Provides the data store with an entity classifier. The classifier
* strongly influences the generation of the entity tree.
*/
@Override
public void setEntityClassifier(EntityClassifier<EntityViewInfo> classifier) {
entityClassifier = classifier;
if (entityTree != null) {
applyClassifierAndUpdateTree(entityTree.getBoundingBox());
fireMapDataEvent(new MapEvent(this, MapEvent.Type.MAP_MODIFIED));
}
}
use of aimax.osm.data.MapEvent in project aima-java by aimacode.
the class DefaultMap method removeMarker.
/** {@inheritDoc} */
@Override
public void removeMarker(MapNode marker) {
markers.remove(marker);
fireMapDataEvent(new MapEvent(this, MapEvent.Type.MARKER_REMOVED, marker.getId()));
}
use of aimax.osm.data.MapEvent in project aima-java by aimacode.
the class DefaultMap method addMarker.
/** {@inheritDoc} */
@Override
public MapNode addMarker(float lat, float lon) {
long id = 1;
for (MapNode node : markers) if (node.getId() >= id)
id = node.getId() + 1;
MapNode node = new DefaultMapNode(id);
node.setName(Long.toString(id));
List<EntityAttribute> atts = new ArrayList<EntityAttribute>(1);
atts.add(new EntityAttribute("marker", "yes"));
node.setAttributes(atts);
node.setPosition(lat, lon);
updateEntityViewInfo(node, false);
markers.add(node);
fireMapDataEvent(new MapEvent(this, MapEvent.Type.MARKER_ADDED, node.getId()));
return node;
}
use of aimax.osm.data.MapEvent in project aima-java by aimacode.
the class DefaultMap method clearTrack.
/** {@inheritDoc} */
@Override
public void clearTrack(String trackName) {
Track track = getTrack(trackName);
if (track != null) {
tracks.remove(track);
fireMapDataEvent(new MapEvent(this, MapEvent.Type.MAP_MODIFIED));
}
}
use of aimax.osm.data.MapEvent in project aima-java by aimacode.
the class MapViewPane method removeNearestMarker.
/**
* Removes the mark which is the nearest with respect to the given view
* coordinates.
*/
public void removeNearestMarker(int x, int y) {
List<MapNode> markers = getMap().getMarkers();
float lat = getTransformer().lat(y);
float lon = getTransformer().lon(x);
MapNode marker = new Position(lat, lon).selectNearest(markers, null);
if (marker != null)
markers.remove(marker);
getMap().fireMapDataEvent(new MapEvent(getMap(), MapEvent.Type.MAP_MODIFIED));
}
Aggregations