I am using the nutiteq SDK for loading the map mbtiles.
I got the event which which fires when zoom/ rotate/tilt/drag happens. But all this comes under one listener as per the documentation.
Sample code:
public class MyMapEventListener extends MapEventListener {
private final MapView mapView;
private final LocalVectorDataSource vectorDataSource;
public MyMapEventListener(MapView mapView, LocalVectorDataSource vectorDataSource) {
this.mapView = mapView;
this.vectorDataSource = vectorDataSource;
}
@Override
public void onMapMoved() {
// super.onMapMoved();
Toast.makeText(mapView.getContext(),(int)mapView.getZoom()+"",Toast.LENGTH_SHORT).show();
}
How can i figure out which event is happening (rotate/zoom/tilt/drag) when onMapMoved() method is called?
You can get and remember last
MapViewstate, and compare with new one - if zoom is changed then it was zoom etc. Be ready that one gestures can include several events (can zoom and rotate with same movement, for example).But why you need these events exactly? Normally apps do not need it, maybe there is better way to implement same application feature.
Ok, that's a different question, as I suspected :) There are ways to have zoom level based object display without listening of map events, so the display control is done automatically for you. Your map view can be even tilted, then you do not have same zoom level for whole map area and performance of listener-based tricks would be bad in any case.
So the proper solutions would be to use different layers, and limit zoom of each with something like following. Note that you can use same datasource (probably you have
LocalVectorDataSourcethere) for both layers.