Search in sources :

Example 1 with MapStyleFactory

use of aimax.osm.viewer.MapStyleFactory in project aima-java by aimacode.

the class MapViewFrame method initMapAndClassifier.

/**
	 * Creates the map, provides it to the view, and creates a corresponding
	 * entity classifier which is used by default when reading maps.
	 */
protected void initMapAndClassifier() {
    view.setMap(new DefaultMap());
    viewInfo = new MapStyleFactory().createDefaultClassifier();
}
Also used : MapStyleFactory(aimax.osm.viewer.MapStyleFactory) DefaultMap(aimax.osm.data.impl.DefaultMap)

Example 2 with MapStyleFactory

use of aimax.osm.viewer.MapStyleFactory 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 MapStyleFactory

use of aimax.osm.viewer.MapStyleFactory 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

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