public async void GetAlertUsers() { double lat = 0; double lng = 0; try { lat = RacoonMap.pinLatitude; lng = RacoonMap.pinLongitutde; Xamarin.Forms.Maps.Position position = new Xamarin.Forms.Maps.Position(lat, lng); UIImage icon = UIImage.FromFile("pin.png"); var xamMarker = new Marker() { Title = RacoonMap.pinLabel, Position = new CLLocationCoordinate2D(lat, lng), AppearAnimation = MarkerAnimation.Pop, Icon = icon, Snippet = RacoonMap.pinAddress, }; xamMarker.Map = GoogleMapView; GoogleMapView.Animate(CameraUpdate.SetTarget(new CLLocationCoordinate2D(RacoonMap.pinLatitude, RacoonMap.pinLongitutde))); GoogleMapView.InfoTapped += GoogleMapView_InfoTapped; GoogleMapView.SelectedMarker = xamMarker; GoogleMapView.TappedMarker = (map, marker) => { GoogleMapView.MarkerInfoWindow = new GMSInfoFor(markerInfoWindow); return(false); }; } catch { } finally { } }
void OnTouchUpInside(object sender, EventArgs e) { ctrl.ButtonPressed(null); if (sender is UIButton && ((UIButton)sender).Tag == 1) { // Ask, which to show var thingOffset = 1; UIActionSheet actionSheet = new UIActionSheet(Catalog.GetString("Focus on")); if (thing != null) { actionSheet.AddButton(thing.Name); thingOffset = 0; } actionSheet.AddButton(Catalog.GetString("Playing area")); actionSheet.AddButton(Catalog.GetString("Location")); actionSheet.AddButton(Catalog.GetString("Cancel")); actionSheet.CancelButtonIndex = 3 - thingOffset; // Black button actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) { CameraUpdate cu = null; if (b.ButtonIndex == 0 - thingOffset) { // Location of thing is selected and thing is a zone if (thing is Zone) { var bounds = ((Zone)thing).Bounds; // cu = CameraUpdate.FitBounds(new CoordinateBounds(new CLLocationCoordinate2D(lat1, lon1),new CLLocationCoordinate2D(lat2, lon2)),30f); cu = CameraUpdate.SetTarget(new CLLocationCoordinate2D(bounds.Left + (bounds.Right - bounds.Left) / 2.0, bounds.Bottom + (bounds.Top - bounds.Bottom) / 2.0)); } else { // Location of thing is selected and thing is no zone if (thing.ObjectLocation != null) { cu = CameraUpdate.SetTarget(new CLLocationCoordinate2D(thing.ObjectLocation.Latitude, thing.ObjectLocation.Longitude)); } } } if (b.ButtonIndex == 1 - thingOffset) { var bounds = engine.Bounds; if (bounds != null) { cu = CameraUpdate.FitBounds(new CoordinateBounds(new CLLocationCoordinate2D(bounds.Left, bounds.Top), new CLLocationCoordinate2D(bounds.Right, bounds.Bottom)), 30f); } } if (b.ButtonIndex == 2 - thingOffset) { // Location of player is selected cu = CameraUpdate.SetTarget(new CLLocationCoordinate2D(engine.Latitude, engine.Longitude)); } if (cu != null) { mapView.MoveCamera(cu); } }; actionSheet.ShowInView(View); } if (sender is UIButton && ((UIButton)sender).Tag == 2) { // Check, if north should be on top headingOrientation = !headingOrientation; NSUserDefaults.StandardUserDefaults.SetBool(headingOrientation, "HeadingOrientation"); if (headingOrientation) { ((UIButton)sender).SetImage(Images.ButtonOrientation, UIControlState.Normal); ctrl.LocatitionManager.UpdatedHeading += OnUpdateHeading; } else { ((UIButton)sender).SetImage(Images.ButtonOrientationNorth, UIControlState.Normal); ctrl.LocatitionManager.UpdatedHeading -= OnUpdateHeading; mapView.AnimateToBearing(0.0); } } if (sender is UIButton && ((UIButton)sender).Tag == 3) { // Change map type // Ask, which to show UIActionSheet actionSheet = new UIActionSheet(Catalog.GetString("Type of map")); actionSheet.AddButton((mapView.MapType == MapViewType.Normal ? Strings.Checked + " " : "") + Catalog.GetString("Google Maps")); actionSheet.AddButton((mapView.MapType == MapViewType.Satellite ? Strings.Checked + " " : "") + Catalog.GetString("Google Satellite")); actionSheet.AddButton((mapView.MapType == MapViewType.Terrain ? Strings.Checked + " " : "") + Catalog.GetString("Google Terrain")); actionSheet.AddButton((mapView.MapType == MapViewType.Hybrid ? Strings.Checked + " " : "") + Catalog.GetString("Google Hybrid")); actionSheet.AddButton((mapView.MapType == MapViewType.None && osmLayer.Map != null ? Strings.Checked + " " : "") + Catalog.GetString("OpenStreetMap")); actionSheet.AddButton((mapView.MapType == MapViewType.None && ocmLayer.Map != null ? Strings.Checked + " " : "") + Catalog.GetString("OpenCycleMap")); actionSheet.AddButton((mapView.MapType == MapViewType.None && osmLayer.Map == null && ocmLayer.Map == null ? Strings.Checked + " " : "") + Catalog.GetString("None")); actionSheet.AddButton(Catalog.GetString("Cancel")); actionSheet.CancelButtonIndex = 7; // Black button actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) { switch (b.ButtonIndex) { case 0: SetMapSource(MapSource.GoogleMaps); break; case 1: SetMapSource(MapSource.GoogleSatellite); break; case 2: SetMapSource(MapSource.GoogleTerrain); break; case 3: SetMapSource(MapSource.GoogleHybrid); break; case 4: // OpenStreetMap SetMapSource(MapSource.OpenStreetMap); break; case 5: // OpenCycleMap SetMapSource(MapSource.OpenCycleMap); break; case 6: SetMapSource(MapSource.None); break; } }; actionSheet.ShowInView(View); } }
public bool DidTapCluster(GMUClusterManager clusterManager, IGMUCluster cluster) { mapView.MoveCamera(CameraUpdate.SetTarget(cluster.Position, mapView.Camera.Zoom + 1)); return(true); }