Search in sources :

Example 1 with MapFileTileSource

use of org.oscim.tiling.source.mapfile.MapFileTileSource in project graphhopper by graphhopper.

the class MainActivity method loadMap.

void loadMap(File areaFolder) {
    logUser("loading map");
    // Map events receiver
    mapView.map().layers().add(new MapEventsReceiver(mapView.map()));
    // Map file source
    MapFileTileSource tileSource = new MapFileTileSource();
    tileSource.setMapFile(new File(areaFolder, currentArea + ".map").getAbsolutePath());
    VectorTileLayer l = mapView.map().setBaseMap(tileSource);
    mapView.map().setTheme(VtmThemes.DEFAULT);
    mapView.map().layers().add(new BuildingLayer(mapView.map(), l));
    mapView.map().layers().add(new LabelLayer(mapView.map(), l));
    // Markers layer
    itemizedLayer = new ItemizedLayer<>(mapView.map(), (MarkerSymbol) null);
    mapView.map().layers().add(itemizedLayer);
    // Map position
    GeoPoint mapCenter = tileSource.getMapInfo().boundingBox.getCenterPoint();
    mapView.map().setMapPosition(mapCenter.getLatitude(), mapCenter.getLongitude(), 1 << 15);
    setContentView(mapView);
    loadGraphStorage();
}
Also used : LabelLayer(org.oscim.layers.tile.vector.labeling.LabelLayer) GeoPoint(org.oscim.core.GeoPoint) MarkerSymbol(org.oscim.layers.marker.MarkerSymbol) VectorTileLayer(org.oscim.layers.tile.vector.VectorTileLayer) BuildingLayer(org.oscim.layers.tile.buildings.BuildingLayer) File(java.io.File) MapFileTileSource(org.oscim.tiling.source.mapfile.MapFileTileSource)

Example 2 with MapFileTileSource

use of org.oscim.tiling.source.mapfile.MapFileTileSource in project PocketMaps by junjunguo.

the class MapHandler method loadMap.

/**
 * load map to mapView
 *
 * @param areaFolder
 */
public void loadMap(File areaFolder) {
    logUser("loading map");
    // Map events receiver
    mapView.map().layers().add(new MapEventsReceiver(mapView.map()));
    // Map file source
    tileSource = new MapFileTileSource();
    tileSource.setMapFile(new File(areaFolder, currentArea + ".map").getAbsolutePath());
    VectorTileLayer l = mapView.map().setBaseMap(tileSource);
    mapView.map().setTheme(VtmThemes.DEFAULT);
    mapView.map().layers().add(new BuildingLayer(mapView.map(), l));
    mapView.map().layers().add(new LabelLayer(mapView.map(), l));
    // Markers layer
    itemizedLayer = new ItemizedLayer<>(mapView.map(), (MarkerSymbol) null);
    mapView.map().layers().add(itemizedLayer);
    customLayer = new ItemizedLayer<>(mapView.map(), (MarkerSymbol) null);
    mapView.map().layers().add(customLayer);
    // Map position
    GeoPoint mapCenter = tileSource.getMapInfo().boundingBox.getCenterPoint();
    mapView.map().setMapPosition(mapCenter.getLatitude(), mapCenter.getLongitude(), 1 << 12);
    // GuiMenu.getInstance().showMap(this);
    // setContentView(mapView);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    activity.addContentView(mapView, params);
    loadGraphStorage();
}
Also used : LabelLayer(org.oscim.layers.tile.vector.labeling.LabelLayer) GeoPoint(org.oscim.core.GeoPoint) MarkerSymbol(org.oscim.layers.marker.MarkerSymbol) VectorTileLayer(org.oscim.layers.tile.vector.VectorTileLayer) ViewGroup(android.view.ViewGroup) BuildingLayer(org.oscim.layers.tile.buildings.BuildingLayer) File(java.io.File) MapFileTileSource(org.oscim.tiling.source.mapfile.MapFileTileSource)

Aggregations

File (java.io.File)2 GeoPoint (org.oscim.core.GeoPoint)2 MarkerSymbol (org.oscim.layers.marker.MarkerSymbol)2 BuildingLayer (org.oscim.layers.tile.buildings.BuildingLayer)2 VectorTileLayer (org.oscim.layers.tile.vector.VectorTileLayer)2 LabelLayer (org.oscim.layers.tile.vector.labeling.LabelLayer)2 MapFileTileSource (org.oscim.tiling.source.mapfile.MapFileTileSource)2 ViewGroup (android.view.ViewGroup)1