void FindMap () { _map = (SupportFragmentManager.FindFragmentById (Resource.Id.map) as SupportMapFragment).Map; if (_map != null) { _map.MyLocationEnabled = true; _map.UiSettings.TiltGesturesEnabled = false; _map.UiSettings.RotateGesturesEnabled = false; _map.MapClick += OnMapClick; _map.MapLongClick += OnMapLongClick; _map.MyLocationChange += HandleMyLocationChange; _map.MarkerClick += OnMarkerClick; _map.SetInfoWindowAdapter (new InfoWindowAdapter ()); // here because map should be already initialized // http://developer.android.com/reference/com/google/android/gms/maps/model/BitmapDescriptorFactory.html _alarm_marker_normal = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_violet); _alarm_marker_normal_selected = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_violet_selected); _alarm_marker_disabled_selected = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_grey_selected); _alarm_marker_disabled = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_grey); RefreshData (); _map.SetOnMapLoadedCallback (this); if (Mode == Mode.Add) { if (AlarmToAddMarker != null) { AlarmToAddMarker = _map.AddMarker (new MarkerOptions ().SetPosition (AlarmToAddMarker.Position).InvokeIcon (_alarm_marker_normal)); } } } }
private void AddToIconCache(ICluster cluster, NativeBitmapDescriptor icon) { var clusterText = GetClusterText(cluster); if (map.ClusterOptions.EnableBuckets) { enabledBucketsCache.Add(clusterText, icon); } else { disabledBucketsCache.Add(clusterText, icon); } }
private void AddPushPins(MapView mapView, IEnumerable <CustomPin> pins) { foreach (var formsPin in pins) { var markerWithIcon = new MarkerOptions(); markerWithIcon.SetPosition(new LatLng(formsPin.Position.Latitude, formsPin.Position.Longitude)); markerWithIcon.SetTitle(formsPin.Label); markerWithIcon.SetSnippet(formsPin.Address); switch (formsPin.Type) { case SuggestionType.Event: _pinIcon = Android.Gms.Maps.Model.BitmapDescriptorFactory.FromResource(EventResource); markerWithIcon.SetIcon(_pinIcon); break; case SuggestionType.Restaurant: _pinIcon = Android.Gms.Maps.Model.BitmapDescriptorFactory.FromResource(RestaurantResource); markerWithIcon.SetIcon(_pinIcon); break; default: markerWithIcon.SetIcon(Android.Gms.Maps.Model.BitmapDescriptorFactory.DefaultMarker()); break; } NativeMap.AddMarker(markerWithIcon); _tempMarkers.Add(new CustomMarkerOptions { Id = formsPin.Id, MarkerOptions = markerWithIcon }); } }
public CustomMapRenderer() { _tempMarkers = new List <CustomMarkerOptions>(); _pinIcon = Android.Gms.Maps.Model.BitmapDescriptorFactory.FromResource(EventResource); }
private Marker AddNewMarkerToMap(MapFragment mapFragment, LatLng position, BitmapDescriptor icon) { var marker = new MarkerOptions(); marker.SetPosition(position); marker.InvokeIcon(icon); var actualMarker = mapFragment.Map.AddMarker(marker); return actualMarker; }
public MarkerOptions InvokeIcon(BitmapDescriptor icon) { return(SetIcon(icon)); }