/// <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); }
/// <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); }
/// <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); } }
/// <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(); }
/// <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); } }
/// <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); }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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()) { }
/// <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()) { }
/// <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()) { }
/// <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); } } }
/// <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; }
/// <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); } }
/// <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; }
/// <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); } } }
/// <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; } }
/// <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 (); }