/// <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); }
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); }
static RectLatLng() { Empty = new RectLatLng(); }
// 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); }
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))); }