public Marker(GoogleMap map) : base(map) { Clickable = true; Draggable = false; index = map.Markers.Count; }
public static GoogleMap GoogleMap(this AjaxHelper helper, string mapID) { if (string.IsNullOrEmpty(mapID)) { throw new ArgumentNullException("mapID"); } var map = new GoogleMap(helper, mapID); return map; }
public static GoogleMap GoogleMap(this AjaxHelper helper, string mapID) { if (string.IsNullOrEmpty(mapID)) { throw new ArgumentNullException("mapID"); } var map = new GoogleMap(helper, mapID); //edit //map.Zoom( 4 ) // .Center( 39.9097362345372, -97.470703125 ) // .MapType( MapType.Road ); map.MapType( MapType.Road ); //end edit return map; }
private void SetUpMapIfNeeded() { // Do a null check to confirm that we have not already instantiated the map. if (mMap == null) { mMap = ((MapFragment)FragmentManager.FindFragmentById(R.Id.map)).GetMap(); // Check if we were successful in obtaining the map. if (mMap != null) { // The Map is verified. It is now safe to manipulate the map. mMap.SetMapType(GoogleMap.MAP_TYPE_SATELLITE); mMap.SetMyLocationEnabled(true); // Zoom in the Google Map mMap.AnimateCamera(CameraUpdateFactory.ZoomTo(20)); } } }
public MapHandler(string MapsApiKey, GoogleMap Map) { this.MapKey = MapsApiKey; this.Map = Map; }
public CenterFactory(GoogleMap map) { Map = map; }
public void OnMapReady(GoogleMap map) { map.AddMarker(new MarkerOptions().SetPosition(new LatLng(0, 0)).SetTitle("Marker")); }
internal void AddComponent(GoogleMap component) { if(component == null) throw new ArgumentNullException("component"); components.Add(component); }
protected override async void OnElementChanged(ElementChangedEventArgs <View> e) { base.OnElementChanged(e); // For XAML Previewer or FormsGoogleMaps.Init not called. if (!FormsGoogleMaps.IsInitialized) { var tv = new TextView(Context) { Gravity = GravityFlags.Center, Text = "Xamarin.Forms.GoogleMaps" }; tv.SetBackgroundColor(Color.Teal.ToAndroid()); tv.SetTextColor(Color.Black.ToAndroid()); SetNativeControl(tv); return; } var oldMapView = (MapView)Control; var mapView = new MapView(Context); mapView.OnCreate(s_bundle); mapView.OnResume(); SetNativeControl(mapView); var activity = Context as Activity; if (activity != null) { var metrics = new DisplayMetrics(); activity.WindowManager.DefaultDisplay.GetMetrics(metrics); foreach (var logic in _logics) { logic.ScaledDensity = metrics.ScaledDensity; } _cameraLogic.ScaledDensity = metrics.ScaledDensity; } if (e.OldElement != null) { var oldMapModel = (Map)e.OldElement; _cameraLogic.Unregister(); var oldGoogleMap = await oldMapView.GetGoogleMapAsync(); if (oldGoogleMap != null) { oldGoogleMap.SetOnCameraChangeListener(null); oldGoogleMap.SetOnMapClickListener(null); oldGoogleMap.SetOnMapLongClickListener(null); oldGoogleMap.SetOnMyLocationButtonClickListener(null); } oldMapView.Dispose(); } if (oldMapView != null) { _oldNativeMap = await oldMapView.GetGoogleMapAsync(); _oldMap = (Map)e.OldElement; } NativeMap = await((MapView)Control).GetGoogleMapAsync(); _cameraLogic.Register(Map, NativeMap); OnMapReady(NativeMap); }
public MarkerClusteringOptionsFactory(GoogleMap component) { this.Map = component; }
public Polygon(GoogleMap map) : base(map) { points = new List<Location>(); }
public void OnMapReady(GoogleMap googleMap) { mMap = googleMap; }
public void OnMapReady(GoogleMap googleMap) { mGoogleMap = googleMap; mGoogleMap.UiSettings.ZoomControlsEnabled = true; mGoogleMap.MyLocationEnabled = true; }
public MapFunctionHelper(string mMapkey, GoogleMap mmap) { mapkey = mMapkey; mainMap = mmap; }
public void OnMapReady(GoogleMap googleMap) { map = googleMap; map.InfoWindowClick += OnInfoWindowClick; map.SetInfoWindowAdapter(this); }
public CustomerPage() { this.InitializeComponent(); GoogleMap.NavigateToString("maps.google.com"); Update(10); }
public MapCanvasView(Context context, GoogleMap map) : base(context) { _map = map; setupPaint(); }
protected override async void OnElementChanged(ElementChangedEventArgs <Map> e) { base.OnElementChanged(e); if (e.OldElement == e.NewElement) { return; } // For XAML Previewer or FormsGoogleMaps.Init not called. if (!FormsGoogleMaps.IsInitialized) { var tv = new TextView(Context) { Gravity = GravityFlags.Center, Text = "Xamarin.Forms.GoogleMaps" }; tv.SetBackgroundColor(Color.Teal.ToAndroid()); tv.SetTextColor(Color.Black.ToAndroid()); SetNativeControl(tv); return; } // Uninitialize old view GoogleMap oldNativeMap = null; Map oldMap = null; if (e.OldElement != null) { try { var oldNativeView = Control as MapView; // ReSharper disable once PossibleNullReferenceException oldNativeMap = await oldNativeView?.GetGoogleMapAsync(); oldMap = e.OldElement; Uninitialize(oldNativeMap, oldMap); oldNativeView?.Dispose(); } catch (System.Exception ex) { var message = ex.Message; System.Diagnostics.Debug.WriteLine($"Uninitialize old view failed. - {message}"); } } if (e.NewElement == null) { return; } var mapView = new MapView(Context); mapView.OnCreate(s_bundle); mapView.OnResume(); SetNativeControl(mapView); var activity = Context as Activity; if (activity != null) { _scaledDensity = activity.GetScaledDensity(); _cameraLogic.ScaledDensity = _scaledDensity; foreach (var logic in Logics) { logic.ScaledDensity = _scaledDensity; } } var newMap = e.NewElement; NativeMap = await mapView.GetGoogleMapAsync(); foreach (var logic in Logics) { logic.Register(oldNativeMap, oldMap, NativeMap, newMap); logic.ScaledDensity = _scaledDensity; } OnMapReady(NativeMap, newMap); }
protected internal Layer(string name, GoogleMap map) : base(map) { Name = name; }
public KmlLayer(GoogleMap map) : base("kml", map) { Clickable = true; ScreenOverlays = true; }
public Circle(GoogleMap map) : base(map) { }
GoogleMap MakeMap() { var map = new GoogleMap(mapType: GoogleMap.MapType.HYBRID, firstMapControlOnPage: true) { APIKey = "YOUR_GOOGLE_MAPS_API_KEY_HERE", }; //Add Marker from code on creating of view map.AddMarker(new GoogleMap.MapMarker() { lat = 51.511884, lng = -0.195421, title = "Testing Markers on Load", infoWindow = new GoogleMap.MapInfoWindow() { content = "This is the first pin placement (I think it is at Kensington Palace)" } }); ThreadPool.QueueUserWorkItem((state) => { //Add Marker from code after view has been loaded Thread.Sleep(5000); map.AddMarker(new GoogleMap.MapMarker { lat = 51.5073346, lng = -0.1276831, title = "Testing Markers", infoWindow = new GoogleMap.MapInfoWindow { content = "This is a random pin placement" } }); }); ThreadPool.QueueUserWorkItem((state) => { //Change map center location after ten seconds and add a marker there Thread.Sleep(10000); var pos = new GoogleMap.Position { latitude = 40.6892, longitude = 74.0445, }; map.CenterOn(pos); map.AddMarker(new GoogleMap.MapMarker { lat = pos.latitude, lng = pos.longitude, title = "Kyrgyzstan", infoWindow = new GoogleMap.MapInfoWindow { content = "This should be in Kyrgyzstan" } }); ThreadPool.QueueUserWorkItem(async(state2) => { await Task.Delay(5000); var pos2 = await map.GetCenter(); }); }); return(map); }
public void GoToLocation(double latitude, double longitude) { GoogleMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(latitude, longitude), Distance.FromMiles(1))); }
public MapRenderService(GoogleMap map) { _map = map; }
public ImageMapTypeFactory(GoogleMap map) { this.map = map; }
protected override void CreateChildControls() { base.CreateChildControls(); if (base.DesignedControl != null) { //set up the editor properties this.component = (GoogleMap)base.DesignedControl; this.editorDialog = new PropertyEditorDialog(); this.editorDialog.TypeContainer = this.component; this.editorDialog.PropertyChanged += new PropertyValueChangedEventHandler(this.EditorDialog_PropertyChanged); this.Controls.Add(this.editorDialog); this.properties = TypeDescriptor.GetProperties(this.component); //bind the zoom drop down BindZoomOptions(); //set the properties of the controls in the designer this.GoogleKey.Text = this.component.GoogleKey; this.Address.Text = this.component.Address; this.Heading.Text = this.component.Heading; if (this.Width != null) this.Width.Text = this.component.Width.ToString(); if (this.Height != null) this.Height.Text = this.component.Height.ToString(); if (this.EnableDirections != null) this.EnableDirections.Checked = this.component.EnableDirections; if (this.Zoom != null) { ListItem foundZoom= this.Zoom.Items.FindByValue(this.component.Zoom.ToString()); if (foundZoom != null) foundZoom.Selected = true; } this.UpdateMapButton.Click += new EventHandler(UpdateMapButton_Click); } SetMapPreview(); }
public StyledMapTypeFactory(GoogleMap map) { Map = map; }
protected MapObject(GoogleMap map) { if (map == null) throw new ArgumentNullException("map"); Map = map; }
public PolygonFactory(GoogleMap map) { this.map = map; }
public MarkerFactory(GoogleMap map) { if(map == null) throw new ArgumentNullException("map"); this.map = map; }
public CameraPositionlHandler(GoogleMap googleMap, PickDetailActivity rootVC) { _googleMap = googleMap; this.rootVC = rootVC; }
void IOnMapReadyCallback.OnMapReady(GoogleMap map) { NativeMap = map; OnMapReady(map); }
public void OnMapReady(GoogleMap googleMap) { _map = googleMap; LoadStoresToMap(); }
public async void getCurLocation(GoogleMap googleMap) { Console.WriteLine("Test - CurrentLoc"); try { var request = new GeolocationRequest(GeolocationAccuracy.Medium); var location = await Geolocation.GetLocationAsync(request); if (location != null) { Console.WriteLine($"current Loc - Latitude: {location.Latitude}, Longitude: {location.Longitude}, Altitude: {location.Altitude}"); MarkerOptions curLoc = new MarkerOptions(); curLoc.SetPosition(new LatLng(location.Latitude, location.Longitude)); var address = await Geocoding.GetPlacemarksAsync(location.Latitude, location.Longitude); var placemark = address?.FirstOrDefault(); var geocodeAddress = ""; if (placemark != null) { geocodeAddress = $"AdminArea: {placemark.AdminArea}\n" + $"CountryCode: {placemark.CountryCode}\n" + $"CountryName: {placemark.CountryName}\n" + $"FeatureName: {placemark.FeatureName}\n" + $"Locality: {placemark.Locality}\n" + $"PostalCode: {placemark.PostalCode}\n" + $"SubAdminArea: {placemark.SubAdminArea}\n" + $"SubLocality: {placemark.SubLocality}\n" + $"SubThoroughfare: {placemark.SubThoroughfare}\n" + $"Thoroughfare: {placemark.Thoroughfare}\n"; } curLoc.SetTitle("You are here" + geocodeAddress); curLoc.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueAzure)); googleMap.AddMarker(curLoc); CameraPosition.Builder builder = CameraPosition.InvokeBuilder(); builder.Target(new LatLng(location.Latitude, location.Longitude)); builder.Zoom(20); builder.Tilt(65); CameraPosition cPos = builder.Build(); CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cPos); googleMap.MoveCamera(cameraUpdate); } else { OnMapReady(googleMap); } } catch (FeatureNotSupportedException fnsEx) { // Handle not supported on device exception // Toast.MakeText(Activity"Feature Not Supported", ToastLength.Short); } catch (FeatureNotEnabledException fneEx) { // Handle not enabled on device exception // Toast.MakeText(Activity, "Feature Not Enabled", ToastLength.Short); } catch (PermissionException pEx) { // Handle permission exception // Toast.MakeText(Activity, "Needs more permission", ToastLength.Short); } catch (Exception ex) { OnMapReady(googleMap); } }
void ArcgisMapLoaded(object sender, RoutedEventArgs e) { timer.Duration = new TimeSpan(0, 0, 0, 0, 500); Dtimer.Duration = new TimeSpan(0, 0, 0, 15); Ltimer.Duration = new TimeSpan(0, 0, 0, 45); var ml = new WuXiMapLayer(); var MOml = new WuXiMapLayer(); var gmap = new GoogleMap(); var ly = new realLayer(); var osm = new OpenStreetMapLayer(); var cd = new ClientDynamicTileMapServiceLayer(); var myGraphicsLayer = new GraphicsLayer { ID = "MyGraphicsLayer" }; var myLineLayer = new GraphicsLayer { ID = "MyLineLayer" }; MyMap.Layers.Add(ml); MyMap.Layers.Add(ly); MyMap.Layers.Add(myLineLayer); MyMap.Layers.Add(myGraphicsLayer); MyOverviewMap.Layer = MOml; AddPictureMarker(); }
public Overlay(GoogleMap map) : base(map) { }
public CircleFactory(GoogleMap map) { this.map = map; }
public MapHandler(string MapsApiKey, GoogleMap Map, EventHandler <GoogleMap.MarkerClickEventArgs> OnMarkerClickAction) { this.MapKey = MapsApiKey; this.Map = Map; Map.MarkerClick += OnMarkerClickAction; }