Search in sources :

Example 1 with EntityViewInfo

use of aimax.osm.data.entities.EntityViewInfo in project aima-java by aimacode.

the class DefaultMap method updateEntityViewInfo.

/**
	 * Updates the view information of a given entity by means of the current
	 * entity classifier. If suitable viewing information was found and
	 * <code>addToTree</code> is true, the entity is added to the entity tree.
	 */
private void updateEntityViewInfo(MapEntity entity, boolean addToTree) {
    EntityViewInfo info = null;
    if (entityClassifier != null)
        info = entityClassifier.classify(entity);
    entity.setViewInfo(info);
    if (addToTree && info != null)
        entityTree.insertEntity((DefaultMapEntity) entity);
}
Also used : EntityViewInfo(aimax.osm.data.entities.EntityViewInfo)

Example 2 with EntityViewInfo

use of aimax.osm.data.entities.EntityViewInfo in project aima-java by aimacode.

the class OsmViewerPlusApp method actionPerformed.

public void actionPerformed(ActionEvent e) {
    MapViewPane view = frame.getView();
    if (e.getSource() == zoomInButton) {
        view.zoom(2, view.getWidth() / 2, view.getHeight() / 2);
    } else if (e.getSource() == zoomOutButton) {
        view.zoom(0.5f, view.getWidth() / 2, view.getHeight() / 2);
    } else if (e.getSource() == leftButton) {
        view.adjust((int) (0.3 * view.getWidth()), 0);
    } else if (e.getSource() == rightButton) {
        view.adjust((int) (-0.3 * view.getWidth()), 0);
    } else if (e.getSource() == upButton) {
        view.adjust(0, (int) (0.3 * view.getHeight()));
    } else if (e.getSource() == downButton) {
        view.adjust(0, (int) (-0.3 * view.getHeight()));
    } else if (e.getSource() == nightButton) {
        if (nightButton.isSelected()) {
            EntityClassifier<EntityViewInfo> eClassifier = new MapStyleFactory().createNightViewClassifier();
            frame.getView().getRenderer().setBackgroundColor(UColor.BLACK);
            frame.getMap().setEntityClassifier(eClassifier);
        } else {
            EntityClassifier<EntityViewInfo> eClassifier = new MapStyleFactory().createDefaultClassifier();
            frame.getView().getRenderer().setBackgroundColor(UColor.WHITE);
            frame.getMap().setEntityClassifier(eClassifier);
        }
    }
}
Also used : MapStyleFactory(aimax.osm.viewer.MapStyleFactory) MapViewPane(aimax.osm.gui.swing.viewer.MapViewPane) EntityViewInfo(aimax.osm.data.entities.EntityViewInfo)

Example 3 with EntityViewInfo

use of aimax.osm.data.entities.EntityViewInfo in project aima-java by aimacode.

the class OsmRouteFindingAgentApp method createEntityClassifier.

/** Demonstrates how to choose a color for a certain track. */
private EntityClassifier<EntityViewInfo> createEntityClassifier() {
    MapStyleFactory msf = new MapStyleFactory();
    // define colors for tracks
    EntityClassifier<EntityViewInfo> eClassifier = msf.createDefaultClassifier();
    eClassifier.addRule("track_type", TRACK_NAME, msf.createTrackInfo(UColor.RED));
    return eClassifier;
}
Also used : MapStyleFactory(aimax.osm.viewer.MapStyleFactory) EntityViewInfo(aimax.osm.data.entities.EntityViewInfo) DefaultEntityViewInfo(aimax.osm.viewer.DefaultEntityViewInfo)

Aggregations

EntityViewInfo (aimax.osm.data.entities.EntityViewInfo)3 MapStyleFactory (aimax.osm.viewer.MapStyleFactory)2 MapViewPane (aimax.osm.gui.swing.viewer.MapViewPane)1 DefaultEntityViewInfo (aimax.osm.viewer.DefaultEntityViewInfo)1