/// <summary> /// gets matrix size in tiles /// </summary> /// <param name="zoom"></param> /// <returns></returns> public virtual GSize GetTileMatrixSizeXY(int zoom) { GSize sMin = GetTileMatrixMinXY(zoom); GSize sMax = GetTileMatrixMaxXY(zoom); return(new GSize(sMax.Width - sMin.Width + 1, sMax.Height - sMin.Height + 1)); }
public GRect(GPoint location, GSize size) { this.x = location.X; this.y = location.Y; this.width = size.Width; this.height = size.Height; }
public override bool Equals(object obj) { if (!(obj is GSize)) { return(false); } GSize comp = (GSize)obj; // Note value types can't have derived classes, so we don't need to // return((comp.width == this.width) && (comp.height == this.height)); }
public override PointLatLng FromPixelToLatLng(long x, long y, int zoom) { PointLatLng ret = PointLatLng.Empty; GSize s = GetTileMatrixSizePixel(zoom); double mapSizeX = s.Width; double mapSizeY = s.Height; double xx = (Clip(x, 0, mapSizeX - 1) / mapSizeX) - 0.5; double yy = 0.5 - (Clip(y, 0, mapSizeY - 1) / mapSizeY); ret.Lat = 90 - 360 * Math.Atan(Math.Exp(-yy * 2 * Math.PI)) / Math.PI; ret.Lng = 360 * xx; return(ret); }
public override GPoint FromLatLngToPixel(double lat, double lng, int zoom) { GPoint ret = GPoint.Empty; lat = Clip(lat, MinLatitude, MaxLatitude); lng = Clip(lng, MinLongitude, MaxLongitude); double x = (lng + 180) / 360; double sinLatitude = Math.Sin(lat * Math.PI / 180); double y = 0.5 - Math.Log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI); GSize s = GetTileMatrixSizePixel(zoom); long mapSizeX = s.Width; long mapSizeY = s.Height; ret.X = (long)Clip(x * mapSizeX + 0.5, 0, mapSizeX - 1); ret.Y = (long)Clip(y * mapSizeY + 0.5, 0, mapSizeY - 1); return(ret); }
public static GSize Subtract(GSize sz1, GSize sz2) { return(new GSize(sz1.Width - sz2.Width, sz1.Height - sz2.Height)); }
public static GSize Add(GSize sz1, GSize sz2) { return(new GSize(sz1.Width + sz2.Width, sz1.Height + sz2.Height)); }
public void Inflate(GSize size) { Inflate(size.Width, size.Height); }
public static GPoint Subtract(GPoint pt, GSize sz) { return(new GPoint(pt.X - sz.Width, pt.Y - sz.Height)); }
public static GPoint Add(GPoint pt, GSize sz) { return(new GPoint(pt.X + sz.Width, pt.Y + sz.Height)); }
public GPoint(GSize sz) { this.x = sz.Width; this.y = sz.Height; }
/// <summary> /// gets matrix size in pixels /// </summary> /// <param name="zoom"></param> /// <returns></returns> public virtual GSize GetTileMatrixSizePixel(int zoom) { GSize s = GetTileMatrixSizeXY(zoom); return(new GSize(s.Width * TileSize.Width, s.Height * TileSize.Height)); }
/// <summary> /// tile matrix size in pixels at custom zoom level /// </summary> /// <param name="zoom"></param> /// <returns></returns> public long GetTileMatrixItemCount(int zoom) { GSize s = GetTileMatrixSizeXY(zoom); return(s.Width * s.Height); }