示例#1
0
        /// <summary>
        /// gets all tiles in rect at specific zoom
        /// </summary>
        public List <GPoint> GetAreaTileList(RectLatLng rect, int zoom, int padding)
        {
            List <GPoint> ret = new List <GPoint>();

            GPoint topLeft     = FromPixelToTileXY(FromLatLngToPixel(rect.LocationTopLeft, zoom));
            GPoint rightBottom = FromPixelToTileXY(FromLatLngToPixel(rect.LocationRightBottom, zoom));

            for (long x = (topLeft.X - padding); x <= (rightBottom.X + padding); x++)
            {
                for (long y = (topLeft.Y - padding); y <= (rightBottom.Y + padding); y++)
                {
                    GPoint p = new GPoint(x, y);
                    if (!ret.Contains(p) && p.X >= 0 && p.Y >= 0)
                    {
                        ret.Add(p);
                    }
                }
            }

            return(ret);
        }
示例#2
0
        public bool SetZoomToFitRect(RectLatLng rect)
        {
            int mmaxZoom = GetMaxZoomToFitRect(rect);

            if (mmaxZoom > 0)
            {
                PointLatLng center = new PointLatLng(rect.Lat - (rect.HeightLat / 2), rect.Lng + (rect.WidthLng / 2));
                Position = center;

                if (mmaxZoom > maxZoom)
                {
                    mmaxZoom = maxZoom;
                }

                if (Zoom != mmaxZoom)
                {
                    Zoom = (int)mmaxZoom;
                }

                return(true);
            }
            return(false);
        }
示例#3
0
 static RectLatLng()
 {
     Empty = new RectLatLng();
 }
示例#4
0
 // ok ???
 // http://greatmaps.codeplex.com/workitem/15981
 public bool IntersectsWith(RectLatLng a)
 {
     return(this.Left < a.Right && this.Top > a.Bottom && this.Right > a.Left && this.Bottom < a.Top);
 }
示例#5
0
 public bool Contains(RectLatLng rect)
 {
     return((((this.Lng <= rect.Lng) && ((rect.Lng + rect.WidthLng) <= (this.Lng + this.WidthLng))) && (this.Lat >= rect.Lat)) && ((rect.Lat - rect.HeightLat) >= (this.Lat - this.HeightLat)));
 }