Search in sources :

Example 1 with AMapLayer

use of net.osmand.aidl.maplayer.AMapLayer 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 2 with AMapLayer

use of net.osmand.aidl.maplayer.AMapLayer in project Osmand by osmandapp.

the class OsmandAidlApi method removeMapPoint.

boolean removeMapPoint(String layerId, String pointId) {
    if (pointId != null) {
        AMapLayer layer = layers.get(layerId);
        if (layer != null) {
            layer.removePoint(pointId);
            refreshMap();
            return true;
        }
    }
    return false;
}
Also used : AMapLayer(net.osmand.aidl.maplayer.AMapLayer)

Example 3 with AMapLayer

use of net.osmand.aidl.maplayer.AMapLayer 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 AMapLayer

use of net.osmand.aidl.maplayer.AMapLayer in project Osmand by osmandapp.

the class OsmandAidlApi method putMapPoint.

boolean putMapPoint(String layerId, AMapPoint point) {
    if (point != null) {
        AMapLayer layer = layers.get(layerId);
        if (layer != null) {
            layer.putPoint(point);
            refreshMap();
            return true;
        }
    }
    return false;
}
Also used : AMapLayer(net.osmand.aidl.maplayer.AMapLayer)

Aggregations

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