MapPosition: minor improvements (#940)
This commit is contained in:
@@ -155,15 +155,17 @@ public class MapPosition {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPosition(GeoPoint geoPoint) {
|
public MapPosition setPosition(GeoPoint geoPoint) {
|
||||||
setPosition(geoPoint.getLatitude(), geoPoint.getLongitude());
|
setPosition(geoPoint.getLatitude(), geoPoint.getLongitude());
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPosition(double latitude, double longitude) {
|
public MapPosition setPosition(double latitude, double longitude) {
|
||||||
latitude = MercatorProjection.limitLatitude(latitude);
|
latitude = MercatorProjection.limitLatitude(latitude);
|
||||||
longitude = MercatorProjection.limitLongitude(longitude);
|
longitude = MercatorProjection.limitLongitude(longitude);
|
||||||
this.x = MercatorProjection.longitudeToX(longitude);
|
this.x = MercatorProjection.longitudeToX(longitude);
|
||||||
this.y = MercatorProjection.latitudeToY(latitude);
|
this.y = MercatorProjection.latitudeToY(latitude);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copy(MapPosition other) {
|
public void copy(MapPosition other) {
|
||||||
@@ -177,7 +179,7 @@ public class MapPosition {
|
|||||||
this.roll = other.roll;
|
this.roll = other.roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(double x, double y, double scale, float bearing, float tilt) {
|
public MapPosition set(double x, double y, double scale, float bearing, float tilt) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.scale = scale;
|
this.scale = scale;
|
||||||
@@ -185,11 +187,13 @@ public class MapPosition {
|
|||||||
this.bearing = (float) FastMath.clampDegree(bearing);
|
this.bearing = (float) FastMath.clampDegree(bearing);
|
||||||
this.tilt = tilt;
|
this.tilt = tilt;
|
||||||
this.zoomLevel = FastMath.log2((int) scale);
|
this.zoomLevel = FastMath.log2((int) scale);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(double x, double y, double scale, float bearing, float tilt, float roll) {
|
public MapPosition set(double x, double y, double scale, float bearing, float tilt, float roll) {
|
||||||
set(x, y, scale, bearing, tilt);
|
set(x, y, scale, bearing, tilt);
|
||||||
this.roll = (float) FastMath.clampDegree(roll);
|
this.roll = (float) FastMath.clampDegree(roll);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user