Search in sources :

Example 1 with OsmandMapLayer

use of net.osmand.plus.views.OsmandMapLayer in project Osmand by osmandapp.

the class MapContextMenu method buttonMorePressed.

public void buttonMorePressed() {
    final ContextMenuAdapter menuAdapter = new ContextMenuAdapter();
    for (OsmandMapLayer layer : mapActivity.getMapView().getLayers()) {
        layer.populateObjectContextMenu(latLon, object, menuAdapter, mapActivity);
    }
    mapActivity.getMapActions().contextMenuPoint(latLon.getLatitude(), latLon.getLongitude(), menuAdapter, object);
}
Also used : ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) OsmandMapLayer(net.osmand.plus.views.OsmandMapLayer)

Example 2 with OsmandMapLayer

use of net.osmand.plus.views.OsmandMapLayer in project Osmand by osmandapp.

the class OsmandAidlApi method registerAddMapLayerReceiver.

private void registerAddMapLayerReceiver(final MapActivity mapActivity) {
    addMapLayerReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            String layerId = intent.getStringExtra(AIDL_OBJECT_ID);
            if (layerId != null) {
                AMapLayer layer = layers.get(layerId);
                if (layer != null) {
                    OsmandMapLayer mapLayer = mapLayers.get(layerId);
                    if (mapLayer != null) {
                        mapActivity.getMapView().removeLayer(mapLayer);
                    }
                    mapLayer = new AidlMapLayer(mapActivity, layer);
                    mapActivity.getMapView().addLayer(mapLayer, layer.getZOrder());
                    mapLayers.put(layerId, mapLayer);
                }
            }
        }
    };
    mapActivity.registerReceiver(addMapLayerReceiver, new IntentFilter(AIDL_ADD_MAP_LAYER));
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) AMapLayer(net.osmand.aidl.maplayer.AMapLayer) OsmandMapLayer(net.osmand.plus.views.OsmandMapLayer) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) AidlMapLayer(net.osmand.plus.views.AidlMapLayer)

Example 3 with OsmandMapLayer

use of net.osmand.plus.views.OsmandMapLayer in project Osmand by osmandapp.

the class OsmandAidlApi method registerMapLayers.

public void registerMapLayers(MapActivity mapActivity) {
    for (AMapLayer layer : layers.values()) {
        OsmandMapLayer mapLayer = mapLayers.get(layer.getId());
        if (mapLayer != null) {
            mapActivity.getMapView().removeLayer(mapLayer);
        }
        mapLayer = new AidlMapLayer(mapActivity, layer);
        mapActivity.getMapView().addLayer(mapLayer, layer.getZOrder());
        mapLayers.put(layer.getId(), mapLayer);
    }
}
Also used : AMapLayer(net.osmand.aidl.maplayer.AMapLayer) OsmandMapLayer(net.osmand.plus.views.OsmandMapLayer) AidlMapLayer(net.osmand.plus.views.AidlMapLayer)

Example 4 with OsmandMapLayer

use of net.osmand.plus.views.OsmandMapLayer in project Osmand by osmandapp.

the class OsmandAidlApi method registerRemoveMapLayerReceiver.

private void registerRemoveMapLayerReceiver(final MapActivity mapActivity) {
    removeMapLayerReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            String layerId = intent.getStringExtra(AIDL_OBJECT_ID);
            if (layerId != null) {
                OsmandMapLayer mapLayer = mapLayers.remove(layerId);
                if (mapLayer != null) {
                    mapActivity.getMapView().removeLayer(mapLayer);
                    mapActivity.refreshMap();
                }
            }
        }
    };
    mapActivity.registerReceiver(removeMapLayerReceiver, new IntentFilter(AIDL_REMOVE_MAP_LAYER));
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) OsmandMapLayer(net.osmand.plus.views.OsmandMapLayer) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver)

Aggregations

OsmandMapLayer (net.osmand.plus.views.OsmandMapLayer)4 BroadcastReceiver (android.content.BroadcastReceiver)2 Context (android.content.Context)2 Intent (android.content.Intent)2 IntentFilter (android.content.IntentFilter)2 AMapLayer (net.osmand.aidl.maplayer.AMapLayer)2 AidlMapLayer (net.osmand.plus.views.AidlMapLayer)2 ContextMenuAdapter (net.osmand.plus.ContextMenuAdapter)1