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);
}
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);
}
}
}
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;
}
Aggregations