Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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())
 {
 }
Exemplo n.º 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())
 {
 }
Exemplo n.º 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())
 {
 }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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 ();
        }