Search in sources :

Example 1 with AndroidBitmap

use of org.oscim.android.canvas.AndroidBitmap 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 2 with AndroidBitmap

use of org.oscim.android.canvas.AndroidBitmap in project android_packages_apps_GmsCore by microg.

the class MarkerImpl method getMarkerItem.

@Override
public MarkerItem getMarkerItem(Context context) {
    if (removed)
        return null;
    MarkerItem item = new MarkerItem(getId(), getTitle(), getSnippet(), GmsMapsTypeHelper.fromLatLng(getPosition()));
    BitmapDescriptorImpl icon = this.icon;
    if (icon == null)
        icon = DefaultBitmapDescriptor.DEFAULT_DESCRIPTOR_IMPL;
    if (icon.getBitmap() != null) {
        oldBitmap = new AndroidBitmap(icon.getBitmap());
        prepareMarkerIcon(item);
    } else {
        if (!icon.loadBitmapAsync(context, new Runnable() {

            @Override
            public void run() {
                listener.update(MarkerImpl.this);
            }
        })) {
            // Was loaded since last check...
            oldBitmap = new AndroidBitmap(icon.getBitmap());
            prepareMarkerIcon(item);
        }
        // Keep old icon while loading new
        if (oldBitmap != null) {
            prepareMarkerIcon(item);
        }
    }
    return item;
}
Also used : MarkerItem(org.oscim.layers.marker.MarkerItem) AndroidBitmap(org.oscim.android.canvas.AndroidBitmap) BitmapDescriptorImpl(org.microg.gms.maps.bitmap.BitmapDescriptorImpl)

Aggregations

AndroidBitmap (org.oscim.android.canvas.AndroidBitmap)2 BitmapDescriptorImpl (org.microg.gms.maps.bitmap.BitmapDescriptorImpl)1 SharedTileCache (org.microg.gms.maps.data.SharedTileCache)1 ClearableVectorLayer (org.microg.gms.maps.markup.ClearableVectorLayer)1 ItemizedLayer (org.oscim.layers.marker.ItemizedLayer)1 MarkerItem (org.oscim.layers.marker.MarkerItem)1 MarkerSymbol (org.oscim.layers.marker.MarkerSymbol)1 BuildingLayer (org.oscim.layers.tile.buildings.BuildingLayer)1 VectorTileLayer (org.oscim.layers.tile.vector.VectorTileLayer)1 LabelLayer (org.oscim.layers.tile.vector.labeling.LabelLayer)1 Layers (org.oscim.map.Layers)1 ITileCache (org.oscim.tiling.ITileCache)1 OSciMap4TileSource (org.oscim.tiling.source.oscimap4.OSciMap4TileSource)1