Esempio n. 1
0
        public Present Evaluate(Present[] paramList)
        {
            D.Assert(paramList.Length == 3);
            for (int i = 0; i < paramList.Length; i++)
            {
                Present present = paramList[i];
                if (present is PresentFailureCode)
                {
                    return(present);
                }
            }
            if (!(paramList[0] is ImageRef))
            {
                return(paramList[0]);
            }
            ImageRef          imageRef          = (ImageRef)paramList[0];
            TileAddress       tileAddress       = (TileAddress)paramList[1];
            BoundsPresent     boundsPresent     = (BoundsPresent)paramList[2];
            MapRectangle      mapWindow         = CoordinateSystemUtilities.TileAddressToMapRectangle(this.coordinateSystem, tileAddress);
            Region            clipRegion        = boundsPresent.GetRenderRegion().GetClipRegion(mapWindow, tileAddress.ZoomLevel, this.coordinateSystem);
            GDIBigLockedImage gDIBigLockedImage = new GDIBigLockedImage(imageRef.image.Size, "UserClipperVerb");

            gDIBigLockedImage.SetClip(clipRegion);
            gDIBigLockedImage.DrawImageOntoThis(imageRef.image, new RectangleF(0f, 0f, (float)gDIBigLockedImage.Size.Width, (float)gDIBigLockedImage.Size.Height), new RectangleF(0f, 0f, (float)imageRef.image.Size.Width, (float)imageRef.image.Size.Height));
            ImageRef result = new ImageRef(new ImageRefCounted(gDIBigLockedImage));

            boundsPresent.Dispose();
            imageRef.Dispose();
            return(result);
        }
Esempio n. 2
0
        private LatLonZoom PixelToLatLong(Point64 p, int zoomLevel)
        {
            double num  = this.MetersPerPixel(zoomLevel);
            double num2 = (double)p.X * num - 20037508.342789244;
            double num3 = 20037508.342789244 - (double)p.Y * num;

            return(new LatLonZoom(CoordinateSystemUtilities.RadiansToDegrees(1.5707963267948966 - 2.0 * Math.Atan(Math.Exp(-num3 / 6378137.0))), CoordinateSystemUtilities.RadiansToDegrees(num2 / 6378137.0), zoomLevel));
        }
Esempio n. 3
0
        internal static LatLon MercatorToLatLon(LatLon mercator)
        {
            double num  = 40075016.685578488;
            double num2 = mercator.lon * num - 20037508.342789244;
            double num3 = 20037508.342789244 - mercator.lat * num;

            return(new LatLon(CoordinateSystemUtilities.RadiansToDegrees(1.5707963267948966 - 2.0 * Math.Atan(Math.Exp(-num3 / 6378137.0))), CoordinateSystemUtilities.RadiansToDegrees(num2 / 6378137.0)));
        }
Esempio n. 4
0
        private Point64 LatLongZoomToPixel(LatLonZoom p)
        {
            double num  = Math.Sin(CoordinateSystemUtilities.DegreesToRadians(p.lat));
            double num2 = 6378137.0 * CoordinateSystemUtilities.DegreesToRadians(p.lon);
            double num3 = 3189068.5 * Math.Log((1.0 + num) / (1.0 - num));
            double num4 = this.MetersPerPixel(p.zoom);

            return(new Point64((long)Math.Round((20037508.342789244 + num2) / num4), (long)Math.Round((20037508.342789244 - num3) / num4)));
        }
Esempio n. 5
0
        public static LatLon LatLonToMercator(LatLon latlon)
        {
            double num  = Math.Sin(CoordinateSystemUtilities.DegreesToRadians(latlon.lat));
            double num2 = 6378137.0 * CoordinateSystemUtilities.DegreesToRadians(latlon.lon);
            double num3 = 3189068.5 * Math.Log((1.0 + num) / (1.0 - num));
            double num4 = 40075016.685578488;

            return(new LatLon((20037508.342789244 - num3) / num4, (20037508.342789244 + num2) / num4));
        }