Ejemplo n.º 1
0
        //overlays

        /// <summary>Add a new overlay to MapViewer</summary>
        /// <param name="overlay"></param>
        public void AddOverlay(MapOverlay overlay)
        {
            if (!IsMapLoaded)
            {
                throw new InvalidOperationException("Must load a map before placing overlays");
            }

            overlay.Map = this;


            //insert in the correct layer
            //at top by default
            var layer = -1;

            //find the layer if not default
            if (overlay.Layer < int.MaxValue)
            {
                layer = overlays.FindIndex(o => o.Layer > overlay.Layer);
            }

            if (layer >= 0)
            {
                overlaysCanvas.Children.Insert(layer, overlay);
                overlays.Insert(layer, overlay);
            }
            else
            {
                overlaysCanvas.Children.Add(overlay);
                overlays.Add(overlay);
            }
        }
Ejemplo n.º 2
0
 /// <summary>Remove an overlay from MapViewer</summary>
 /// <param name="overlay"></param>
 public void RemoveOverlay(MapOverlay overlay)
 {
     overlays.Remove(overlay);
     overlaysCanvas.Children.Remove(overlay);
     overlay.Map = null;
 }