/// <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(); } } }
/// <summary> /// Notifies the map change. /// </summary> /// <param name="pixelsWidth"></param> /// <param name="pixelsHeight"></param> /// <param name="view"></param> /// <param name="projection"></param> /// <param name="mapControl"></param> internal void NotifyMapChangeToControl(double pixelsWidth, double pixelsHeight, View2D view, IProjection projection, MapControl mapControl) { if (mapControl != null && mapControl.Handle != IntPtr.Zero) { //this.RemoveView(mapControl.BaseView); if (mapControl.SetLayout (pixelsWidth, pixelsHeight, view, projection)) { //this.AddView(mapControl.BaseView, mapControl.BaseView.LayoutParameters); UpdateViewLayout (mapControl.BaseView, mapControl.LayoutParams); } } }
/// <summary> /// Removes the given map control. /// </summary> /// <param name="control"></param> /// <returns></returns> public bool RemoveControl(MapControl control) { lock (_controls) { if (control != null) { this.RemoveView(control.BaseView); return _controls.Remove(control); } return false; } }
/// <summary> /// Notifies this MapView that a map marker has changed. /// </summary> /// <param name="mapControl"></param> public void NotifyControlChange(MapControl mapControl) { // notify map layout of changes. if (_mapView.Width > 0 && _mapView.Height > 0) { View2D view = _mapView.CreateView(); this.NotifyOnBeforeSetLayout(); this.NotifyMapChangeToControl(_mapView.Width, _mapView.Height, view, this.Map.Projection, mapControl); this.NotifyOnAfterSetLayout(); } }
/// <summary> /// Returns the mapcontrols list. /// </summary> /// <value>The controls.</value> public void AddControl(MapControl control) { if (control == null) { throw new ArgumentNullException("control"); } lock (_controls) { _controls.Add(control); // add to control list. control.AttachTo(this); // attach to this view. this.AddView(control.BaseView, control.BaseView.LayoutParameters); } this.NotifyControlChange(control); _mapView.TriggerRendering(); }