Esempio n. 1
0
 public void SetLevel(DrawMgrsRaster.EGridPrecision pPrecision, double pMeterPerPixel)
 {
     pMeterPerPixel = ((int)(pMeterPerPixel * 10)) / 10.0;
     switch (pPrecision)
     {
         case DrawMgrsRaster.EGridPrecision.Grid100m:
             MaxMetersPerPixelGrid100m = Math.Min(LimitMetersPerPixelGrid100m, pMeterPerPixel);
             if (MaxMetersPerPixelGrid1km <= MaxMetersPerPixelGrid100m) MaxMetersPerPixelGrid1km = Math.Min(MaxMetersPerPixelGrid100m + 0.1, LimitMetersPerPixelGrid1km);
             if (MaxMetersPerPixelGrid10km <= MaxMetersPerPixelGrid1km) MaxMetersPerPixelGrid10km = Math.Min(MaxMetersPerPixelGrid10km + 0.1, LimitMetersPerPixelGrid10km);
             break;
         case DrawMgrsRaster.EGridPrecision.Grid1km:
             MaxMetersPerPixelGrid1km = Math.Min(LimitMetersPerPixelGrid1km, pMeterPerPixel);
             if (MaxMetersPerPixelGrid100m >= MaxMetersPerPixelGrid1km) MaxMetersPerPixelGrid100m = Math.Min(MaxMetersPerPixelGrid1km - 0.1, LimitMetersPerPixelGrid100m);
             if (MaxMetersPerPixelGrid10km <= MaxMetersPerPixelGrid1km) MaxMetersPerPixelGrid10km = Math.Min(MaxMetersPerPixelGrid1km + 0.1, LimitMetersPerPixelGrid10km);
             break;
         case DrawMgrsRaster.EGridPrecision.Grid10km:
             MaxMetersPerPixelGrid10km = Math.Min(LimitMetersPerPixelGrid10km, pMeterPerPixel);
             if (MaxMetersPerPixelGrid1km >= MaxMetersPerPixelGrid10km) MaxMetersPerPixelGrid1km = Math.Min(MaxMetersPerPixelGrid10km-0.1, LimitMetersPerPixelGrid1km);
             if (MaxMetersPerPixelGrid100m >= MaxMetersPerPixelGrid1km) MaxMetersPerPixelGrid100m = Math.Min(MaxMetersPerPixelGrid1km-0.1, LimitMetersPerPixelGrid100m);
             
             break;
         case DrawMgrsRaster.EGridPrecision.Grid100km:
             SetLevel(DrawMgrsRaster.EGridPrecision.Grid10km, pMeterPerPixel - 0.1);
             break;
     }
    
    
    
     
 }
Esempio n. 2
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));
        }
Esempio n. 3
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);
        }