Search in sources :

Example 1 with DefaultMap

use of aimax.osm.data.impl.DefaultMap 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 DefaultMap

use of aimax.osm.data.impl.DefaultMap in project aima-java by aimacode.

the class UnifiedMapDrawer method drawMap.

public void drawMap(IMAGE_TYPE image, boolean adjustToFit) {
    imageBdr.initialize(image);
    imageBdr.setColor(UColor.WHITE);
    imageBdr.setAreaFilled(true);
    imageBdr.drawRect(0, 0, imageBdr.getWidth(), imageBdr.getHeight());
    if (imageBdr.getWidth() > 0 && map != null) {
        if (adjustToFit)
            getTransformer().adjustTransformation(getMap().getBoundingBox(), imageBdr.getWidth(), imageBdr.getHeight());
        float latMin = transformer.lat(imageBdr.getHeight());
        float lonMin = transformer.lon(0);
        float latMax = transformer.lat(0);
        float lonMax = transformer.lon(imageBdr.getWidth());
        float scale = transformer.computeScale();
        BoundingBox vbox = new BoundingBox(latMin, lonMin, latMax, lonMax);
        float viewScale = scale / renderer.getDisplayFactor();
        renderer.initForRendering(imageBdr, transformer, map);
        map.visitEntities(renderer, vbox, viewScale);
        for (MapEntity entity : map.getVisibleMarkersAndTracks(viewScale)) entity.accept(renderer);
        renderer.printBufferedObjects();
        if (renderer.isDebugModeEnabled() && map instanceof DefaultMap) {
            List<double[]> splits = ((DefaultMap) map).getEntityTree().getSplitCoords();
            imageBdr.setColor(UColor.LIGHT_GRAY);
            imageBdr.setLineStyle(false, 1f);
            imageBdr.setAreaFilled(false);
            CoordTransformer trans = renderer.getTransformer();
            for (double[] split : splits) imageBdr.drawLine(renderer.getTransformer().x(split[1]), trans.y(split[0]), trans.x(split[3]), trans.y(split[2]));
        }
    }
    image = imageBdr.getResult();
}
Also used : BoundingBox(aimax.osm.data.BoundingBox) MapEntity(aimax.osm.data.entities.MapEntity) DefaultMap(aimax.osm.data.impl.DefaultMap)

Aggregations

DefaultMap (aimax.osm.data.impl.DefaultMap)2 BoundingBox (aimax.osm.data.BoundingBox)1 MapEntity (aimax.osm.data.entities.MapEntity)1 MapStyleFactory (aimax.osm.viewer.MapStyleFactory)1