mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Added get map size (width and height) method in canvasMap with given boundary
#story[928]
This commit is contained in:
@@ -13,7 +13,6 @@ public class CanvasMap {
|
||||
private double width, height; // desired image size
|
||||
private int zoom;
|
||||
|
||||
private int MERCATOR_RANGE = 256;
|
||||
private String KEY = "AIzaSyC-5oOShMCY5Oy_9L7guYMPUPFHDMr37wE";
|
||||
|
||||
public CanvasMap(Boundary bound, double width, double height) {
|
||||
@@ -46,4 +45,23 @@ public class CanvasMap {
|
||||
// sb.append(String.format("&key=%s", KEY));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private MapSize getMapSize(int zoom, Boundary boundary) {
|
||||
double scale = Math.pow(2, zoom);
|
||||
MapGeo geoSW = new MapGeo(boundary.getSouthLat(), boundary.getWestLng());
|
||||
MapGeo geoNE = new MapGeo(boundary.getNorthLat(), boundary.getEastLng());
|
||||
MapPoint pointSW = MercatorProjection.toMapPoint(geoSW);
|
||||
MapPoint pointNE = MercatorProjection.toMapPoint(geoNE);
|
||||
return new MapSize(Math.abs(pointNE.getX() - pointSW.getX()),
|
||||
Math.abs(pointNE.getY() - pointSW.getY()));
|
||||
}
|
||||
|
||||
class MapSize {
|
||||
long width, height;
|
||||
|
||||
MapSize(double width, double height) {
|
||||
this.width = (long) width;
|
||||
this.height = (long) height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user