Esempio n. 1
0
        private static async void AddMapViewOverlayControl()
        {
            #region MapView Overlay Control
            //Creat a Progress Bar user control
            var progressBarControl = new System.Windows.Controls.ProgressBar();
            //Configure the progress bar
            progressBarControl.Minimum         = 0;
            progressBarControl.Maximum         = 100;
            progressBarControl.IsIndeterminate = true;
            progressBarControl.Width           = 300;
            progressBarControl.Value           = 10;
            progressBarControl.Height          = 25;
            progressBarControl.Visibility      = System.Windows.Visibility.Visible;
            //Create a MapViewOverlayControl.
            var mapViewOverlayControl = new MapViewOverlayControl(progressBarControl, true, true, true, OverlayControlRelativePosition.BottomCenter, .5, .8);
            //Add to the active map
            MapView.Active.AddOverlayControl(mapViewOverlayControl);
            await QueuedTask.Run(() =>
            {
                //Wait 3 seconds to remove the progress bar from the map.
                Thread.Sleep(3000);
            });

            //Remove from active map
            MapView.Active.RemoveOverlayControl(mapViewOverlayControl);
            #endregion
        }
        protected override void OnClick()
        {
            Scribble_ControlView  scribbleControl = null;
            MapViewOverlayControl overlayControl  = null;

            string mapURI = MapView.Active.Map.URI;

            if (Scribble_Module.projectControls.Contains(mapURI))
            {
                overlayControl = (MapViewOverlayControl)Scribble_Module.projectControls[mapURI];
                MapView.Active.RemoveOverlayControl(overlayControl);
                Scribble_Module.projectControls.Remove(mapURI);
                overlayControl = null;
            }
            scribbleControl        = new Scribble_ControlView();
            scribbleControl.Name   = "Pro_ScribbleControl";
            scribbleControl.Width  = MapView.Active.GetViewSize().Width;
            scribbleControl.Height = 40;
            scribbleControl.cvs.DefaultDrawingAttributes.Width  = 20;
            scribbleControl.cvs.DefaultDrawingAttributes.Height = 20;
            scribbleControl.cvs.DefaultDrawingAttributes.Color  = Colors.Tomato;
            overlayControl = new MapViewOverlayControl(scribbleControl, false);

            //Add the overlay control to active map view
            MapView.Active.AddOverlayControl(overlayControl);

            //Add to dictionary
            Scribble_Module.projectControls.Add(mapURI, overlayControl);
        }
Esempio n. 3
0
        private void Active_ViewSizeChanged(object sender, EventArgs e)
        {
            if (MapView.Active == null)
            {
                return; // a pane is being opened or closed
            }
            string mapURI = MapView.Active.Map.URI;
            MapViewOverlayControl overlayControl = null;

            if (Scribble_Module.projectControls.Contains(mapURI))
            {
                overlayControl = (MapViewOverlayControl)Scribble_Module.projectControls[mapURI];
                overlayControl.Control.Width  = MapView.Active.GetViewSize().Width;
                overlayControl.Control.Height = MapView.Active.GetViewSize().Height;
            }
        }
        private void UpdatePerfOverlay(TimeSpan perfClear, TimeSpan perfApply, bool isRedraw)
        {
            if (MapView.Active == null)
            {
                return;
            }
            if (_mapCtlPerf == null && _ctlPerf == null)
            {
                _ctlPerf              = new TextBlock();
                _ctlPerf.Background   = Brushes.Transparent;
                _ctlPerf.TextWrapping = System.Windows.TextWrapping.Wrap;
                _mapCtlPerf           = new MapViewOverlayControl(_ctlPerf, true, true, true, OverlayControlRelativePosition.BottomLeft);
                MapView.Active.AddOverlayControl(_mapCtlPerf);
            }

            _ctlPerf.Text = $"Overlays cleared: {perfClear.ToString("mm':'ss':'fff")}\n{(isRedraw ? "Overlay redrawn" : "New overlays added")}: {perfApply.ToString("mm':'ss':'fff")}";
        }