Пример #1
0
        public Pixel GetBaseLayerCenterPixel()
        {
            IDisplayableSource         displayableSource       = this.baseLayer;
            CoordinateSystemIfc        defaultCoordinateSystem = displayableSource.GetDefaultCoordinateSystem();
            TileDisplayDescriptorArray tileArrayDescriptor     = defaultCoordinateSystem.GetTileArrayDescriptor(this.center().llz, base.Size);
            int num  = base.Size.Width / 2;
            int num2 = base.Size.Height / 2;

            foreach (TileDisplayDescriptor current in tileArrayDescriptor)
            {
                Rectangle paintLocation = current.paintLocation;
                if (paintLocation.Left <= num)
                {
                    Rectangle paintLocation2 = current.paintLocation;
                    if (paintLocation2.Right > num)
                    {
                        Rectangle paintLocation3 = current.paintLocation;
                        if (paintLocation3.Top <= num2)
                        {
                            Rectangle paintLocation4 = current.paintLocation;
                            if (paintLocation4.Bottom > num2)
                            {
                                int       arg_D1_0       = num;
                                Rectangle paintLocation5 = current.paintLocation;
                                int       x              = arg_D1_0 - paintLocation5.Left;
                                int       arg_E6_0       = num2;
                                Rectangle paintLocation6 = current.paintLocation;
                                int       y              = arg_E6_0 - paintLocation6.Top;
                                Present   present        = displayableSource.GetImagePrototype(null, (FutureFeatures)19).Curry(new ParamDict(new object[]
                                {
                                    TermName.TileAddress,
                                    current.tileAddress
                                })).Realize("ViewerControl.GetBaseLayerCenterPixel imageRef");
                                Pixel result;
                                if (!(present is ImageRef))
                                {
                                    result = new UndefinedPixel();
                                    return(result);
                                }
                                ImageRef          imageRef = (ImageRef)present;
                                GDIBigLockedImage image;
                                Monitor.Enter(image = imageRef.image);
                                Pixel pixel2;
                                try
                                {
                                    Image  image2 = imageRef.image.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage();
                                    Bitmap bitmap = (Bitmap)image2;
                                    Color  pixel  = bitmap.GetPixel(x, y);
                                    pixel2 = new Pixel(pixel);
                                }
                                finally
                                {
                                    Monitor.Exit(image);
                                }
                                imageRef.Dispose();
                                result = pixel2;
                                return(result);
                            }
                        }
                    }
                }
            }
            return(new UndefinedPixel());
        }
Пример #2
0
 public Pixel GetBaseLayerCenterPixel()
 {
     IDisplayableSource displayableSource = this.baseLayer;
     CoordinateSystemIfc defaultCoordinateSystem = displayableSource.GetDefaultCoordinateSystem();
     TileDisplayDescriptorArray tileArrayDescriptor = defaultCoordinateSystem.GetTileArrayDescriptor(this.center().llz, base.Size);
     int num = base.Size.Width / 2;
     int num2 = base.Size.Height / 2;
     foreach (TileDisplayDescriptor current in tileArrayDescriptor)
     {
         Rectangle paintLocation = current.paintLocation;
         if (paintLocation.Left <= num)
         {
             Rectangle paintLocation2 = current.paintLocation;
             if (paintLocation2.Right > num)
             {
                 Rectangle paintLocation3 = current.paintLocation;
                 if (paintLocation3.Top <= num2)
                 {
                     Rectangle paintLocation4 = current.paintLocation;
                     if (paintLocation4.Bottom > num2)
                     {
                         int arg_D1_0 = num;
                         Rectangle paintLocation5 = current.paintLocation;
                         int x = arg_D1_0 - paintLocation5.Left;
                         int arg_E6_0 = num2;
                         Rectangle paintLocation6 = current.paintLocation;
                         int y = arg_E6_0 - paintLocation6.Top;
                         Present present = displayableSource.GetImagePrototype(null, (FutureFeatures)19).Curry(new ParamDict(new object[]
                         {
                             TermName.TileAddress,
                             current.tileAddress
                         })).Realize("ViewerControl.GetBaseLayerCenterPixel imageRef");
                         Pixel result;
                         if (!(present is ImageRef))
                         {
                             result = new UndefinedPixel();
                             return result;
                         }
                         ImageRef imageRef = (ImageRef)present;
                         GDIBigLockedImage image;
                         Monitor.Enter(image = imageRef.image);
                         Pixel pixel2;
                         try
                         {
                             Image image2 = imageRef.image.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage();
                             Bitmap bitmap = (Bitmap)image2;
                             Color pixel = bitmap.GetPixel(x, y);
                             pixel2 = new Pixel(pixel);
                         }
                         finally
                         {
                             Monitor.Exit(image);
                         }
                         imageRef.Dispose();
                         result = pixel2;
                         return result;
                     }
                 }
             }
         }
     }
     return new UndefinedPixel();
 }