Пример #1
0
        /// <summary>
        /// Adds the marker.
        /// </summary>
        /// <returns>The marker.</returns>
        /// <param name="coordinate">Coordinate.</param>
        public MapMarker AddMarker(GeoCoordinate coordinate)
        {
            MapMarker marker = new MapMarker(this.Context, coordinate);

            this.AddMarker(marker);
            return(marker);
        }
Пример #2
0
 /// <summary>
 /// Removes the given map marker.
 /// </summary>
 /// <param name="marker"></param>
 /// <returns></returns>
 public bool RemoveMarker(MapMarker marker)
 {
     if (marker != null)
     {
         this.RemoveView(marker);
         return(_markers.Remove(marker));
     }
     return(false);
 }
Пример #3
0
        /// <summary>
        /// Notifies this MapView that a map marker has changed.
        /// </summary>
        /// <param name="mapMarker"></param>
        public void NotifyMarkerChange(MapMarker mapMarker)
        {         // notify map layout of changes.
            if (_mapView.Width > 0 && _mapView.Height > 0)
            {
                View2D view = _mapView.CreateView();

                this.NotifyMapChangeToMarker(_mapView.Width, _mapView.Height, view, this.Map.Projection, mapMarker);
            }
        }
Пример #4
0
        /// <summary>
        /// Returns the mapmarkers list.
        /// </summary>
        /// <value>The markers.</value>
        public void AddMarker(MapMarker marker)
        {
            _markers.Add(marker);

            var layoutParams = new FrameLayout.LayoutParams(marker.Bitmap.Width, marker.Bitmap.Height + 5);

            layoutParams.LeftMargin = -1;
            layoutParams.TopMargin  = -1;
            layoutParams.Gravity    = GravityFlags.Top | GravityFlags.Left;
            this.AddView(marker, layoutParams);

            _mapView.Change();
        }
Пример #5
0
 /// <summary>
 /// Removes the given map marker.
 /// </summary>
 /// <param name="marker"></param>
 /// <returns></returns>
 public bool RemoveMarker(MapMarker marker)
 {
     lock (_markers)
     {
         if (marker != null)
         {
             marker.DetachFrom(this);
             this.RemoveView(marker.View);
             return(_markers.Remove(marker));
         }
         return(false);
     }
 }
Пример #6
0
        /// <summary>
        /// Adds the marker.
        /// </summary>
        /// <returns>The marker.</returns>
        /// <param name="location">Coordinate.</param>
        public MapMarker AddMarker(GeoCoordinate location)
        {
            if (location == null)
            {
                throw new ArgumentNullException("location");
            }
            ;

            var marker = new MapMarker(this.Context, location);

            this.AddMarker(marker);
            return(marker);
        }
Пример #7
0
        /// <summary>
        /// Returns the mapmarkers list.
        /// </summary>
        /// <value>The markers.</value>
        public void AddMarker(MapMarker marker)
        {
            if (marker == null)
            {
                throw new ArgumentNullException("marker");
            }
            ;

            _markers.Add(marker);              // add to marker list.
            marker.AttachTo(this);             // attach to this view.

            var layoutParams = new FrameLayout.LayoutParams(marker.Image.Width, marker.Image.Height + 5);

            layoutParams.LeftMargin = -1;
            layoutParams.TopMargin  = -1;
            layoutParams.Gravity    = GravityFlags.Top | GravityFlags.Left;
            this.AddView(marker, layoutParams);

            _mapView.Change();
        }
Пример #8
0
        /// <summary>
        /// Returns the mapmarkers list.
        /// </summary>
        /// <value>The markers.</value>
        public void AddMarker(MapMarker marker)
        {
            if (marker == null)
            {
                throw new ArgumentNullException("marker");
            }

            lock (_markers)
            {
                if (marker.Image == null)
                {
                    return;
                }

                _markers.Add(marker);  // add to marker list.
                marker.AttachTo(this); // attach to this view.

                this.AddView(marker.View, marker.View.LayoutParameters);
            }
            this.NotifyControlChange(marker);
            _mapView.TriggerRendering();
        }
Пример #9
0
        /// <summary>
        /// Returns the mapmarkers list.
        /// </summary>
        /// <value>The markers.</value>
        public void AddMarker(MapMarker marker)
        {
            if (marker == null)
            {
                throw new ArgumentNullException("marker");
            }

            lock (_markers)
            {
                if (marker.Image == null)
                    return;

                _markers.Add(marker); // add to marker list.
                marker.AttachTo(this); // attach to this view.

                this.AddView(marker.View, marker.View.LayoutParameters);
            }
            this.NotifyControlChange(marker);
            _mapView.TriggerRendering();
        }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OsmSharp.Android.UI.MapMarker"/> class.
 /// </summary>
 /// <param name="location">Coordinate.</param>
 /// <param name="alignment">The alignment.</param>
 public MapMarker(Context context, GeoCoordinate location,
                  MapMarkerAlignmentType alignment)
     : this(context, location, alignment, MapMarker.GetDefaultImage())
 {
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OsmSharp.Android.UI.MapMarker"/> class.
 /// </summary>
 /// <param name="location">Coordinate.</param>
 public MapMarker(Context context, GeoCoordinate location)
     : this(context, location, MapMarkerAlignmentType.CenterBottom, MapMarker.GetDefaultImage())
 {
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OsmSharp.Android.UI.MapMarker"/> class.
 /// </summary>
 /// <param name="context">Context.</param>
 /// <param name="coordinate">Coordinate.</param>
 internal MapMarker(Context context, GeoCoordinate coordinate)
     : this(context, coordinate, MapMarker.GetDefaultImage())
 {
 }
Пример #13
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 NotifyMapChangeToMarker(double pixelsWidth, double pixelsHeight, View2D view, IProjection projection, MapMarker mapMarker)
 {
     if (mapMarker != null) {
         this.RemoveView (mapMarker);
         if (mapMarker.SetLayout (pixelsWidth, pixelsHeight, view, projection)) {
             this.AddView (mapMarker, mapMarker.LayoutParameters);
         }
     }
 }
Пример #14
0
 /// <summary>
 /// Removes the given map marker.
 /// </summary>
 /// <param name="marker"></param>
 /// <returns></returns>
 public bool RemoveMarker(MapMarker marker)
 {
     if (marker != null)
     {
         this.RemoveView(marker);
         return _markers.Remove(marker);
     }
     return false;
 }
Пример #15
0
        /// <summary>
        /// Notifies this MapView that a map marker has changed.
        /// </summary>
        /// <param name="mapMarker"></param>
        public void NotifyMarkerChange(MapMarker mapMarker)
        {
            // notify map layout of changes.
            if (_mapView.Width > 0 && _mapView.Height > 0) {
                View2D view = _mapView.CreateView ();

                this.NotifyMapChangeToMarker (this.Width, this.Height, view, this.Map.Projection, mapMarker);
            }
        }
Пример #16
0
        /// <summary>
        /// Adds the marker.
        /// </summary>
        /// <returns>The marker.</returns>
        /// <param name="location">Coordinate.</param>
        public MapMarker AddMarker(GeoCoordinate location)
        {
            if (location == null)
            {
                throw new ArgumentNullException("location");
            }
            ;

            var marker = new MapMarker(this.Context, location);
            this.AddMarker(marker);
            return marker;
        }
Пример #17
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 NotifyMapChangeToMarker(double pixelsWidth, double pixelsHeight, View2D view, IProjection projection, MapMarker mapMarker)
 {
     if (mapMarker != null)
     {
         this.RemoveView(mapMarker);
         if (mapMarker.SetLayout(pixelsWidth, pixelsHeight, view, projection))
         {
             this.AddView(mapMarker, mapMarker.LayoutParameters);
         }
     }
 }
Пример #18
0
 /// <summary>
 /// Removes the given map marker.
 /// </summary>
 /// <param name="marker"></param>
 /// <returns></returns>
 public bool RemoveMarker(MapMarker marker)
 {
     lock (_markers)
     {
         if (marker != null)
         {
             marker.DetachFrom(this);
             this.RemoveView(marker.View);
             return _markers.Remove(marker);
         }
         return false;
     }
 }
Пример #19
0
        /// <summary>
        /// Returns the mapmarkers list.
        /// </summary>
        /// <value>The markers.</value>
        public void AddMarker(MapMarker marker)
        {
            if (marker == null) { throw new ArgumentNullException("marker"); };

            _markers.Add (marker); // add to marker list.
            marker.AttachTo (this); // attach to this view.

            var layoutParams = new FrameLayout.LayoutParams (marker.Image.Width, marker.Image.Height + 5);
            layoutParams.LeftMargin = -1;
            layoutParams.TopMargin = -1;
            layoutParams.Gravity = GravityFlags.Top | GravityFlags.Left;
            this.AddView (marker, layoutParams);

            _mapView.Change ();
        }