Beispiel #1
0
        public override GPoint FromLatLngToPixel(double lat, double lng, int zoom)
        {
            GPoint empty = GPoint.Empty;

            lat = PureProjection.Clip(lat, this.MinLatitude, this.MaxLatitude);
            lng = PureProjection.Clip(lng, this.MinLongitude, this.MaxLongitude);
            double tileMatrixResolution = GetTileMatrixResolution(zoom);

            empty.X = (long)Math.Round((double)((lng - orignX) / tileMatrixResolution));
            empty.Y = (long)Math.Round((double)((orignY - lat) / tileMatrixResolution));
            return(this.RectiryPixelPoint(empty));
        }
Beispiel #2
0
        public override PointLatLng FromPixelToLatLng(long x, long y, int zoom)
        {
            PointLatLng empty = PointLatLng.Empty;
            GSize       tileMatrixSizePixel = this.GetTileMatrixSizePixel(zoom);
            double      width  = tileMatrixSizePixel.Width;
            double      height = tileMatrixSizePixel.Height;
            double      num3   = (PureProjection.Clip((double)x, 0.0, width - 1.0) / width) - 0.5;
            double      num4   = 0.5 - (PureProjection.Clip((double)y, 0.0, height - 1.0) / height);

            empty.Lat = 90.0 - ((360.0 * Math.Atan(Math.Exp((-num4 * 2.0) * 3.1415926535897931))) / 3.1415926535897931);
            empty.Lng = 360.0 * num3;
            PointLatLng lng2 = new PointLatLng();

            double[] latlng = new double[2];
            this.transform(empty.Lat, empty.Lng, latlng);
            lng2.Lat   = latlng[0];
            lng2.Lng   = latlng[1];
            empty.Lat -= lng2.Lat - empty.Lat;
            empty.Lng -= lng2.Lng - empty.Lng;
            return(empty);
        }
Beispiel #3
0
        public override GPoint FromLatLngToPixel(double lat, double lng, int zoom)
        {
            double[] latlng = new double[2];
            this.transform(lat, lng, latlng);
            lat = latlng[0];
            lng = latlng[1];
            GPoint empty = GPoint.Empty;

            lat = PureProjection.Clip(lat, MinLatitude, MaxLatitude);
            lng = PureProjection.Clip(lng, MinLongitude, MaxLongitude);
            double num  = (lng + 180.0) / 360.0;
            double num2 = Math.Sin((lat * 3.1415926535897931) / 180.0);
            double num3 = 0.5 - (Math.Log((1.0 + num2) / (1.0 - num2)) / 12.566370614359172);
            GSize  tileMatrixSizePixel = this.GetTileMatrixSizePixel(zoom);
            long   width  = tileMatrixSizePixel.Width;
            long   height = tileMatrixSizePixel.Height;

            empty.X = (long)PureProjection.Clip((num * width) + 0.5, 0.0, (double)(width - 1L));
            empty.Y = (long)PureProjection.Clip((num3 * height) + 0.5, 0.0, (double)(height - 1L));
            return(empty);
        }