Ejemplo n.º 1
0
        /// <summary>
        /// Returns the mapcontrols list.
        /// </summary>
        /// <value>The controls.</value>
        public void AddControl(MapControl control)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }

            control.AttachTo(this); // attach this view to the control.
            _controls.Add(control); // add to controls list.
            this.Add(control.BaseView); // add to this view.

            CGRect rect = this.Frame;
            if (rect.Width > 0 && rect.Height > 0)
            {
                View2D view = this.CreateView(rect);
                this.NotifyOnBeforeSetLayout();
                this.NotifyMapChangeToControl(rect.Width, rect.Height, view, this.Map.Projection, control);
                this.NotifyOnAfterSetLayout();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Notifies the map change.
        /// </summary>
        /// <param name="pixelWidth"></param>
        /// <param name="pixelsHeight"></param>
        /// <param name="view"></param>
        /// <param name="projection"></param>
        /// <param name="mapMarker"></param>
        internal void NotifyMapChangeToControl(double pixelsWidth, double pixelsHeight, View2D view, 
			IProjection projection, MapControl mapMarker)
        {
            if (mapMarker != null)
            {
                mapMarker.SetLayout(pixelsWidth, pixelsHeight, view, projection);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Notifies this host that the control was clicked.
 /// </summary>
 /// <param name="clickedControl">Control.</param>
 public void NotifyControlClicked(MapControl clickedControl)
 {
     // make sure to close all other popups.
     foreach (var marker in _markers)
     {
         if (marker != clickedControl)
         {
             marker.NotifyOtherControlClicked();
         }
     }
     foreach (var control in _controls)
     {
         if (control != clickedControl)
         {
             control.NotifyOtherControlClicked();
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Removes the given map control.
 /// </summary>
 /// <param name="control"></param>
 public bool RemoveControl(MapControl control)
 {
     if (control != null)
     {
         control.DetachFrom(this); // remove the map view.
         control.BaseView.RemoveFromSuperview();
         return _controls.Remove(control);
     }
     return false;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Notifies this MapView that a map marker has changed.
 /// </summary>
 /// <param name="mapMarker"></param>
 public void NotifyControlChange(MapControl control)
 {
     CGRect rect = this.Frame;
     // notify map layout of changes.
     if (rect.Width > 0 && rect.Height > 0)
     {
         View2D view = this.CreateView(rect);
         this.NotifyOnBeforeSetLayout();
         this.NotifyMapChangeToControl(rect.Width, rect.Height, view, this.Map.Projection, control);
         this.NotifyOnAfterSetLayout();
     }
 }