Search in sources :

Example 6 with MapEvent

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));
    }
}
Also used : MapEvent(aimax.osm.data.MapEvent)

Example 7 with MapEvent

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()));
}
Also used : MapEvent(aimax.osm.data.MapEvent)

Example 8 with MapEvent

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;
}
Also used : EntityAttribute(aimax.osm.data.entities.EntityAttribute) MapEvent(aimax.osm.data.MapEvent) ArrayList(java.util.ArrayList) MapNode(aimax.osm.data.entities.MapNode)

Example 9 with MapEvent

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));
    }
}
Also used : MapEvent(aimax.osm.data.MapEvent) Track(aimax.osm.data.entities.Track)

Example 10 with MapEvent

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

Aggregations

MapEvent (aimax.osm.data.MapEvent)10 MapNode (aimax.osm.data.entities.MapNode)3 Track (aimax.osm.data.entities.Track)3 Position (aimax.osm.data.Position)2 ArrayList (java.util.ArrayList)2 BoundingBox (aimax.osm.data.BoundingBox)1 EntityAttribute (aimax.osm.data.entities.EntityAttribute)1