コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
		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);
		}
コード例 #4
0
		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);
		}