public LatLonZoom GetBestViewContaining(MapRectangle newBounds, Size size) { LatLon center = newBounds.GetCenter(); int zoom = (int)(exactZoom(size.Height / (newBounds.lat1 - newBounds.lat0)) + 0.99); return(new LatLonZoom(center.lat, center.lon, zoom)); }
public LatLonZoom GetBestViewContaining(MapRectangle newBounds, Size size) { LatLon center = newBounds.GetCenter(); int i; for (i = this.ZoomRange.max; i >= this.ZoomRange.min; i--) { LatLonZoom p = new LatLonZoom(newBounds.lat0, newBounds.lon0, i); LatLonZoom p2 = new LatLonZoom(newBounds.lat1, newBounds.lon1, i); Point64 point = this.LatLongZoomToPixel(p); Point64 point2 = this.LatLongZoomToPixel(p2); if (point.Y - point2.Y < (long)size.Height) { break; } } return(new LatLonZoom(center.lat, center.lon, i)); }
public LatLonZoom GetBestViewContaining(MapRectangle newBounds, Size size) { LatLon center = newBounds.GetCenter(); int zoom = (int)(this.exactZoom((double)size.Height / (newBounds.lat1 - newBounds.lat0)) + 0.99); return new LatLonZoom(center.lat, center.lon, zoom); }
public LatLonZoom GetBestViewContaining(MapRectangle newBounds, Size size) { LatLon center = newBounds.GetCenter(); int i; for (i = this.ZoomRange.max; i >= this.ZoomRange.min; i--) { LatLonZoom p = new LatLonZoom(newBounds.lat0, newBounds.lon0, i); LatLonZoom p2 = new LatLonZoom(newBounds.lat1, newBounds.lon1, i); Point64 point = this.LatLongZoomToPixel(p); Point64 point2 = this.LatLongZoomToPixel(p2); if (point.Y - point2.Y < (long)size.Height) { break; } } return new LatLonZoom(center.lat, center.lon, i); }