Search in sources :

Example 1 with MarkerSymbol

use of org.oscim.layers.marker.MarkerSymbol in project graphhopper by graphhopper.

the class MainActivity method createMarkerItem.

@SuppressWarnings("deprecation")
private MarkerItem createMarkerItem(GeoPoint p, int resource) {
    Drawable drawable = getResources().getDrawable(resource);
    Bitmap bitmap = AndroidGraphics.drawableToBitmap(drawable);
    MarkerSymbol markerSymbol = new MarkerSymbol(bitmap, 0.5f, 1);
    MarkerItem markerItem = new MarkerItem("", "", p);
    markerItem.setMarker(markerSymbol);
    return markerItem;
}
Also used : Bitmap(org.oscim.backend.canvas.Bitmap) MarkerSymbol(org.oscim.layers.marker.MarkerSymbol) MarkerItem(org.oscim.layers.marker.MarkerItem) Drawable(android.graphics.drawable.Drawable)

Example 2 with MarkerSymbol

use of org.oscim.layers.marker.MarkerSymbol in project android_packages_apps_GmsCore by microg.

the class BackendMapView method initialize.

private void initialize() {
    ITileCache cache = new SharedTileCache(getContext());
    cache.setCacheSize(512 * (1 << 10));
    OSciMap4TileSource tileSource = new OSciMap4TileSource();
    tileSource.setCache(cache);
    VectorTileLayer baseLayer = map().setBaseMap(tileSource);
    Layers layers = map().layers();
    layers.add(drawables = new ClearableVectorLayer(map()));
    layers.add(labels = new LabelLayer(map(), baseLayer));
    layers.add(buildings = new BuildingLayer(map(), baseLayer));
    layers.add(items = new ItemizedLayer<MarkerItem>(map(), new MarkerSymbol(new AndroidBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.nop)), 0.5F, 1)));
    map().setTheme(MicrogThemes.DEFAULT);
}
Also used : OSciMap4TileSource(org.oscim.tiling.source.oscimap4.OSciMap4TileSource) LabelLayer(org.oscim.layers.tile.vector.labeling.LabelLayer) ITileCache(org.oscim.tiling.ITileCache) MarkerSymbol(org.oscim.layers.marker.MarkerSymbol) VectorTileLayer(org.oscim.layers.tile.vector.VectorTileLayer) AndroidBitmap(org.oscim.android.canvas.AndroidBitmap) BuildingLayer(org.oscim.layers.tile.buildings.BuildingLayer) Layers(org.oscim.map.Layers) ItemizedLayer(org.oscim.layers.marker.ItemizedLayer) SharedTileCache(org.microg.gms.maps.data.SharedTileCache) ClearableVectorLayer(org.microg.gms.maps.markup.ClearableVectorLayer)

Example 3 with MarkerSymbol

use of org.oscim.layers.marker.MarkerSymbol 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 4 with MarkerSymbol

use of org.oscim.layers.marker.MarkerSymbol in project PocketMaps by junjunguo.

the class MapHandler method setCustomPointIcon.

public void setCustomPointIcon(int customIcon) {
    this.customIcon = customIcon;
    if (customLayer.getItemList().size() > 0) {
        // RefreshIcon
        MarkerItem curSymbol = customLayer.getItemList().get(0);
        MarkerSymbol marker = createMarkerItem(new GeoPoint(0, 0), customIcon, 0.5f, 0.5f).getMarker();
        curSymbol.setMarker(marker);
    }
}
Also used : GeoPoint(org.oscim.core.GeoPoint) MarkerSymbol(org.oscim.layers.marker.MarkerSymbol) MarkerItem(org.oscim.layers.marker.MarkerItem)

Example 5 with MarkerSymbol

use of org.oscim.layers.marker.MarkerSymbol 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

MarkerSymbol (org.oscim.layers.marker.MarkerSymbol)6 GeoPoint (org.oscim.core.GeoPoint)3 MarkerItem (org.oscim.layers.marker.MarkerItem)3 BuildingLayer (org.oscim.layers.tile.buildings.BuildingLayer)3 VectorTileLayer (org.oscim.layers.tile.vector.VectorTileLayer)3 LabelLayer (org.oscim.layers.tile.vector.labeling.LabelLayer)3 Drawable (android.graphics.drawable.Drawable)2 File (java.io.File)2 Bitmap (org.oscim.backend.canvas.Bitmap)2 MapFileTileSource (org.oscim.tiling.source.mapfile.MapFileTileSource)2 ViewGroup (android.view.ViewGroup)1 SharedTileCache (org.microg.gms.maps.data.SharedTileCache)1 ClearableVectorLayer (org.microg.gms.maps.markup.ClearableVectorLayer)1 AndroidBitmap (org.oscim.android.canvas.AndroidBitmap)1 ItemizedLayer (org.oscim.layers.marker.ItemizedLayer)1 Layers (org.oscim.map.Layers)1 ITileCache (org.oscim.tiling.ITileCache)1 OSciMap4TileSource (org.oscim.tiling.source.oscimap4.OSciMap4TileSource)1