Beispiel #1
0
        /// <summary>
        /// Gets the source image to display in the dynamic layer. Override this to generate
        /// or modify images.
        /// </summary>
        /// <param name="properties">The image export properties.</param>
        /// <param name="onComplete">The method to call when the image is ready.</param>
        /// <seealso cref="ESRI.ArcGIS.Client.DynamicLayer.OnProgress"/>
        protected override void GetSource(DynamicLayer.ImageParameters properties, DynamicLayer.OnImageComplete onComplete)
        {
            if (!IsInitialized)
            {
                onComplete(null, null);
                return;
            }
            Envelope extent = properties.Extent;
            var ex121 = AppStateSettings.Instance.ViewDef.MapControl.Extent;

            var vp = new MgrsViewport(Map); /* Calculate visisble UTM boxes */
            LastMetersPerPixel = vp.MetersPerPixel;
            if (!Cfg.IsEnabled)
            {
                onComplete(null, null);
                return;
            }
            var draw = new DrawMgrsRaster(Cfg, vp);
            


            int width = properties.Width;
            int height = properties.Height;
            var img1 = GenerateImage1(width, height, 96, dc => draw.Render(dc));


            onComplete(Convert(img1), new ImageResult(extent));
        }
Beispiel #2
0
        protected override void OnRender(DrawingContext pDrawingContext)
        {
            base.OnRender(pDrawingContext);
            if ((!mIsInitialized) && (AppStateSettings.Instance.ViewDef.MapControl != null))
            {
                AppStateSettings.Instance.ViewDef.MapControl.ExtentChanged += (sender, e) => this.InvalidateVisual(); 
                mIsInitialized = true;
            }
            if (!mIsInitialized) return;
            //if (!(Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt))) return;
            

            var vp = new MgrsViewport(AppStateSettings.Instance.ViewDef.MapControl); /* Calculate visisble UTM boxes */
            LastMetersPerPixel = vp.MetersPerPixel;
            if (!Cfg.IsEnabled) return;
            var draw = new DrawMgrsRaster(Cfg, vp);
            draw.Render(pDrawingContext);
        }
Beispiel #3
0
 public DrawMgrsRaster(MgrsConfig pConfig, MgrsViewport pMgrsGrid)
 {
     Viewport = pMgrsGrid;
     Cfg = pConfig;
 }