add MapPosition(lat,lon,scale), Map.setMapPosition(lat,lon,scale)
This commit is contained in:
parent
170e8287ab
commit
1226e6c292
@ -46,6 +46,11 @@ public class MapPosition {
|
||||
this.angle = 0;
|
||||
}
|
||||
|
||||
public MapPosition(double latitude, double longitude, double scale) {
|
||||
setPosition(latitude, longitude);
|
||||
setScale(scale);
|
||||
}
|
||||
|
||||
public void setZoomLevel(int zoomLevel) {
|
||||
this.zoomLevel = zoomLevel;
|
||||
this.scale = 1 << zoomLevel;
|
||||
@ -75,6 +80,9 @@ public class MapPosition {
|
||||
this.y = other.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return scale relative to zoom-level.
|
||||
*/
|
||||
public double getZoomScale() {
|
||||
return scale / (1 << zoomLevel);
|
||||
}
|
||||
|
@ -191,6 +191,11 @@ public abstract class Map implements EventDispatcher {
|
||||
updateMap(true);
|
||||
}
|
||||
|
||||
public void setMapPosition(double latitude, double longitude, double scale) {
|
||||
mViewport.setMapPosition(new MapPosition(latitude, longitude, scale));
|
||||
updateMap(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current {@link MapPosition}.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user