protected override void OnElementChanged(ElementChangedEventArgs <CustomMapView> e) { base.OnElementChanged(e); if (e.OldElement != null || Element == null) { return; } var formsElement = Element as CustomMapView; if (Control == null) { mapView = new ExtendedMapView(this); mapView.MapStyle = MapStyle.FromJson(AppConstants.MAP_STYLE_GREY, null); mapView.Delegate = new CustomMapViewDelegate(); SetNativeControl(mapView); } if (formsElement != null) { mapView.UpdateUserPosition(formsElement.UserLocation.Latitude, formsElement.UserLocation.Longitude); mapView.SetCamera(formsElement.UserLocation.Latitude, formsElement.UserLocation.Longitude, (float)formsElement.Zoom); } }
public EditLocationPage() { InitializeComponent(); this.ViewModel = new EditLocationPageViewModel() { Title = this.Title }; this.BindingContext = this.ViewModel; this.MyMap.MapStyle = MapStyle.FromJson(MAP_STYLE); this.MyMap.UiSettings.ZoomControlsEnabled = false; this.MyMap.UiSettings.MyLocationButtonEnabled = true; this.MyMap.UiSettings.RotateGesturesEnabled = false; Task.Run(async() => { var myLocation = await LocationService.GetCurrentLocation(this.ViewModel); if (myLocation == null) { return; } Position position = new Position( myLocation.Latitude, myLocation.Longitude); this.MyMap.MoveToRegion( MapSpan.FromCenterAndRadius( position, Distance.FromMeters( MAP_SPAN_RADIUS))); }); }
public NuevoDesarrollo() { InitializeComponent(); try { string estilo = "[{'elementType': 'geometry','stylers': [{'color': '#f5f5f5'}]},{'elementType': 'labels.icon','stylers': [{'visibility': 'off'}]},{'elementType': 'labels.text.fill','stylers': [{'color': '#616161'}]},{'elementType': 'labels.text.stroke','stylers': [{'color': '#f5f5f5'}]},{'featureType': 'administrative','elementType': 'geometry.stroke','stylers': [{'visibility': 'on'}]},{'featureType': 'administrative.land_parcel','elementType': 'labels.text.fill','stylers': [{'color': '#bdbdbd'}]},{'featureType': 'poi','elementType': 'geometry','stylers': [{'color': '#eeeeee'}]},{'featureType': 'poi','elementType': 'labels.text.fill','stylers': [{'color': '#757575'}]},{'featureType': 'poi.park','elementType': 'geometry','stylers': [{'color': '#e5e5e5'}]},{'featureType': 'poi.park','elementType': 'labels.text.fill','stylers': [{'color': '#9e9e9e'}]},{'featureType': 'road','elementType': 'geometry','stylers': [{'color': '#ffffff'}]},{'featureType': 'road.arterial','elementType': 'geometry.fill','stylers': [{'color': '#a9a9a9'}]},{'featureType': 'road.arterial','elementType': 'labels.text.fill','stylers': [{'color': '#757575'}]},{'featureType': 'road.highway','elementType': 'geometry','stylers': [{'color': '#dadada'}]},{'featureType': 'road.highway','elementType': 'geometry.fill','stylers': [{'color': '#941100'}]},{'featureType': 'road.highway','elementType': 'labels.text.fill','stylers': [{'color': '#616161'}]},{'featureType': 'road.local','elementType': 'geometry.fill','stylers': [{'color': '#d6d6d6'}]},{'featureType': 'road.local','elementType': 'labels.text.fill','stylers': [{'color': '#9e9e9e'}]},{'featureType': 'transit.line','elementType': 'geometry','stylers': [{'color': '#e5e5e5'}]},{'featureType': 'transit.station','elementType': 'geometry','stylers': [{'color': '#eeeeee'}]},{'featureType': 'water','elementType': 'geometry','stylers': [{'color': '#c9c9c9'}]},{'featureType': 'water','elementType': 'labels.text.fill','stylers': [{'color': '#9e9e9e'}]}]"; mapa = new Map() { HeightRequest = 150, InitialCameraUpdate = CameraUpdateFactory.NewCameraPosition(new CameraPosition(new Position(20.673755, -103.376783), 10d, 0, 0)) }; mapcont1.Children.Add(mapa); mapa.MyLocationEnabled = true; mapa.MapStyle = MapStyle.FromJson(estilo); mapa.UiSettings.MyLocationButtonEnabled = true; Color color1 = new Color(); color1 = _colors[1].Item2; pincentro = new Pin() { Label = "Nuevo desarrollo", Icon = BitmapDescriptorFactory.DefaultMarker(color1), Position = new Position(mapa.CameraPosition.Target.Latitude, mapa.CameraPosition.Target.Longitude), }; mapa.Pins.Add(pincentro); mapa.CameraChanged += Mapa_CameraChanged; } catch (Exception ex) { } }
public HomePage() { InitializeComponent(); map.MapStyle = MapStyle.FromJson(jsonStyle); map.UiSettings.ZoomControlsEnabled = false; BindingContext = viewModel = new HomePageViewModel(); viewModel.Navigation = this.Navigation; LocationEnabled(); }
private void ApplyMapTheme() { var assembly = typeof(MapPage).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"BCTApp.MapResources.MapTheme.json"); string themeFile; using (var reader = new StreamReader(stream)) { themeFile = reader.ReadToEnd(); beeMap.MapStyle = MapStyle.FromJson(themeFile); } }
public void GetMap(UIView _mapView) { CameraPosition camera = CameraPosition.FromCamera(37.797865, -122.402526, 6); mapView = MapView.FromCamera(CGRect.Empty, camera); mapView.MyLocationEnabled = true; mapView.MapStyle = MapStyle.FromJson(ReadFile(), null); mapView.Frame = _mapView.Bounds; _mapView.AddSubview(mapView); }
private void customMap() //caricare la mappa da map wizard { var assembly = typeof(MainPage).GetTypeInfo().Assembly; Stream stream = assembly.GetManifestResourceStream("RentHouse.com.GoogleMap.json"); string Json = ""; using (var reader = new StreamReader(stream)) { Json = reader.ReadToEnd(); } map.MapStyle = MapStyle.FromJson(Json); }
private void AddMapStyle() { var assembly = typeof(App).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"UITMBER.MapStyle.json"); string styleFile; using (var reader = new System.IO.StreamReader(stream)) { styleFile = reader.ReadToEnd(); } MapControl.MapStyle = MapStyle.FromJson(styleFile); }
void AddMapStyle() { var assembly = typeof(MainPage).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"TrackingSample.MapStyle.json"); string styleFile; using (var reader = new System.IO.StreamReader(stream)) { styleFile = reader.ReadToEnd(); } map.MapStyle = MapStyle.FromJson(styleFile); }
void AddMapStyle() { var assembly = typeof(ExtendedMap).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream("Nunos2.MapStyle.json"); string styleFile; using (var reader = new System.IO.StreamReader(stream)) { styleFile = reader.ReadToEnd(); } MapStyle = MapStyle.FromJson(styleFile); }
private void StylingMap() { var assembly = typeof(App).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"PGBus.Assets.mapstyle.json"); string styleFile; using (var reader = new System.IO.StreamReader(stream)) { styleFile = reader.ReadToEnd(); } map.MapStyle = MapStyle.FromJson(styleFile); }
void AddMapStyle() { var assembly = typeof(MotelsMapPage).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"CabanasRD.GoogleMapStyles.json"); string styleFile; using (var reader = new System.IO.StreamReader(stream)) { styleFile = reader.ReadToEnd(); } MotelsMap.MapStyle = MapStyle.FromJson(styleFile); }
public MapStyle SetMapTheme(string mapTheme) { var assembly = typeof(App).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"GpsNotebook.Resources.MapStyles.{mapTheme}.json"); string styleFile; using (var reader = new System.IO.StreamReader(stream)) { styleFile = reader.ReadToEnd(); } return(MapStyle.FromJson(styleFile)); }
void UpdateMapStyle() { var styleJson = ((MapBase)Element).MapStyle; if (!string.IsNullOrWhiteSpace(styleJson)) { ((MapView)Control).MapStyle = MapStyle.FromJson(styleJson, null); } else { ((MapView)Control).MapStyle = null; } }
private void ApplyMapTheme() { // this.GetType().Assembly.GetManifestResourceNames(); var assembly = typeof(view.Maps).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"App3.MapResources.MapTheme.json"); string themeFile; using (var reader = new System.IO.StreamReader(stream)) { themeFile = reader.ReadToEnd(); map.MapStyle = MapStyle.FromJson(themeFile); } }
public MapPage() { InitializeComponent(); NavigationPage.SetHasBackButton(this, false); whiteBarBottom.Source = ImageSource.FromResource("SewarDal.Images.WhiteBarOpacity200.png"); LocateMeButton.Source = ImageSource.FromResource("SewarDal.Images.locateMeButton.png"); MainMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(21.4874338, 39.2174196), Distance.FromMiles(8)), true); MapStyleJson mymapstyle = new MapStyleJson(); MainMap.MapStyle = MapStyle.FromJson(mymapstyle.mapstyleString); GetLocationPermision(); }
void AddMapStyle() { var assembly = typeof(App).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"OlimoXamarinForms.MapStyle.json"); string styleFile; using (var reader = new System.IO.StreamReader(stream)) { styleFile = reader.ReadToEnd(); } map.MapStyle = MapStyle.FromJson(styleFile); }
public MapDetailPage(Models.Owner owner) { InitializeComponent(); this.ViewModel = new MapDetailPageViewModel(owner) { Title = this.Title }; this.BindingContext = this.ViewModel; this.MyMap.MapStyle = MapStyle.FromJson(MAP_STYLE); this.MyMap.UiSettings.ZoomControlsEnabled = false; this.MyMap.UiSettings.MyLocationButtonEnabled = true; this.MyMap.UiSettings.RotateGesturesEnabled = false; }
private async void SaveButton_Clicked(object sender, EventArgs e) { /*Checks if the selected apptheme isn't the same as the current selected theme*/ if (Preferences.Get("AppThemeToken", 2) != AppTheme.SelectedIndex) { Preferences.Set("AppThemeToken", AppTheme.SelectedIndex); //Storing the selected app theme index in the variable "AppThemeToken" //Changing the style of the map string styleFile = await MapPage.ChangeMapStyle(); //Calls the function that will read the whole JSON file and returns a string Current.CustomMap.MapStyle = MapStyle.FromJson(styleFile); //Changing the map it's theme (style) } await DisplayAlert("Settings Saved", null, null, "Close"); }
static MapInitializer() { try { var assembly = typeof(MapInitializer).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"Jobify.Map.MapStyle.json"); Console.WriteLine(stream.ToString()); string styleFile; using (var reader = new System.IO.StreamReader(stream)) { styleFile = reader.ReadToEnd(); } MapStyle = MapStyle.FromJson(styleFile); } catch (Exception e) { Console.WriteLine("Something wrong with MapStyle file: " + e.Message); } }
protected override void OnElementChanged(ElementChangedEventArgs <View> e) { base.OnElementChanged(e); if (e.OldElement != null || Element == null) { return; } var formsElement = Element as CustomGoogleMap; if (Control == null) { _mapView = new MapView(); _mapView.MapType = MapViewType.Normal; _mapView.MapStyle = MapStyle.FromJson(Constants.GoogleMapStyleSilver, null); SetNativeControl(_mapView); } }
public DashboardPage() { InitializeComponent(); ShowUserPicture(); //Set map style map.MapStyle = MapStyle.FromJson(getMapStyleJson()); //TODO Better way to handle icon ref //_pinTokyo.Icon = _pinTokyo.Icon = BitmapDescriptorFactory.FromBundle("RedPin.png"); //map.Pins.Add(_pinTokyo); map.PinClicked += Map_PinClicked; }
public UsersMap(string username) { InitializeComponent(); CurrentUser = username; Username.Text = username; InnerButtonClose.IsVisible = false; InnerButtonMenu.IsVisible = true; ConnectOpenWithClick(); ConnectCloseWithClick(); ConnectWithClick(); // Choose style for map from list: // styleGreyStandard // styleLightGrey // styleLightColorful map.MapStyle = MapStyle.FromJson(DifferentStylesForMap.styleLightColorful); map.MyLocationEnabled = true; map.UiSettings.MyLocationButtonEnabled = true; map.CameraIdled += (sender, args) => { try { CheckForUpdates(); } catch { // Problems with network // DisplayAlert("Error", "Problems with network", "CLose"); } }; try { CheckForUpdates(); } catch { // Problems with network } }
void AddMapStyle() { try { var assembly = typeof(MainPage).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"MarkerGoogleMaps.MapStyle.json"); string styleFile; using (var reader = new System.IO.StreamReader(stream)) { styleFile = reader.ReadToEnd(); } map.MapStyle = MapStyle.FromJson(styleFile); } catch (Exception ex) { } }
public MapStylePage() { InitializeComponent(); // Hide all labels and change water fill color // You can create your original map style using https://mapstyle.withgoogle.com/ . editorMapStyle.Text = "[\n" + " {\n" + " \"elementType\": \"labels\",\n" + " \"stylers\": [\n" + " {\n" + " \"visibility\": \"off\"\n" + " }\n" + " ]\n" + " },\n" + " {\n" + " \"featureType\": \"water\",\n" + " \"elementType\": \"geometry.fill\",\n" + " \"stylers\": [\n" + " {\n" + " \"color\": \"#4c4c4c\"\n" + " }\n" + " ]\n" + " }" + "]"; buttonClearStyle.Clicked += (sender, e) => { map.MapStyle = null; }; buttonMapStyle.Clicked += (sender, e) => { map.MapStyle = MapStyle.FromJson(editorMapStyle.Text); }; buttonSeeStylingWizard.Clicked += (sender, e) => { Device.OpenUri(new Uri("https://mapstyle.withgoogle.com/")); }; }
//Slide view Up private async void SettingButtonVisibility() { MainMap.MapStyle = MapStyle.FromJson("[\r\n {\r\n \"elementType\": \"geometry\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#212121\"\r\n }\r\n ]\r\n },\r\n {\r\n \"elementType\": \"labels.icon\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"elementType\": \"labels.text.fill\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#757575\"\r\n }\r\n ]\r\n },\r\n {\r\n \"elementType\": \"labels.text.stroke\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#212121\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"administrative\",\r\n \"elementType\": \"geometry\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#757575\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"administrative.country\",\r\n \"elementType\": \"labels.text.fill\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#9e9e9e\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"administrative.locality\",\r\n \"elementType\": \"labels.text.fill\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#bdbdbd\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"poi\",\r\n \"elementType\": \"labels.text.fill\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#757575\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"poi.park\",\r\n \"elementType\": \"geometry\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#181818\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"poi.park\",\r\n \"elementType\": \"labels.text.fill\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#616161\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"poi.park\",\r\n \"elementType\": \"labels.text.stroke\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#1b1b1b\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"road\",\r\n \"elementType\": \"geometry.fill\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#2c2c2c\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"road\",\r\n \"elementType\": \"labels.text.fill\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#8a8a8a\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"road.arterial\",\r\n \"elementType\": \"geometry\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#373737\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"road.highway\",\r\n \"elementType\": \"geometry\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#3c3c3c\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"road.highway.controlled_access\",\r\n \"elementType\": \"geometry\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#4e4e4e\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"road.local\",\r\n \"elementType\": \"labels.text.fill\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#616161\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"transit\",\r\n \"elementType\": \"labels.text.fill\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#757575\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"water\",\r\n \"elementType\": \"geometry\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#000000\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"water\",\r\n \"elementType\": \"labels.text.fill\",\r\n \"stylers\": [\r\n {\r\n \"color\": \"#3d3d3d\"\r\n }\r\n ]\r\n }\r\n]"); OnAppearing(); SettingButton.IsVisible = false; SettingIcon.IsVisible = false; await Task.Delay(2000); SettingButton.IsVisible = true; SettingIcon.IsVisible = true; //var pin = new Pin //{ // Position = new Position(Latitude, Longitude), // Label = $"islam", // Address = $"islam" //}; //MainMap.Pins.Add(pin); }
protected override void OnElementChanged(ElementChangedEventArgs <TripMapView> e) { base.OnElementChanged(e); if (e.NewElement == null || e.OldElement != null) { return; } if (_control == null) { _control = new MapView { MapStyle = MapStyle.FromJson(Constants.MapStyleJson, null), }; _control.MoveCamera(CameraUpdate.ZoomToZoom(13)); } SetNativeControl(_control); }
public void GetMap(UIView _mapView) { CameraPosition camera = CameraPosition.FromCamera(new CLLocationCoordinate2D(GelenMekan.coordinateX, GelenMekan.coordinateY), 6); mapView = MapView.FromCamera(CGRect.Empty, camera); mapView.MyLocationEnabled = true; mapView.MapStyle = MapStyle.FromJson(ReadFile(), null); mapView.Frame = _mapView.Bounds; _mapView.AddSubview(mapView); var xamMarker = new Marker() { Title = "", Snippet = "", Position = new CLLocationCoordinate2D(GelenMekan.coordinateX, GelenMekan.coordinateY), Map = mapView }; mapView.SelectedMarker = xamMarker; }
protected override void OnElementChanged(ElementChangedEventArgs <TripsClusterMapView> e) { base.OnElementChanged(e); if (e.NewElement == null) { return; } if (e.OldElement != null) { var mapView = e.OldElement; mapView.Trips.CollectionChanged -= Trips_CollectionChanged; } var newMapView = e.NewElement; newMapView.Trips.CollectionChanged += Trips_CollectionChanged; if (_control == null) { _control = new MapView { MapStyle = MapStyle.FromJson(Constants.MapStyleJson, null), }; _control.MoveCamera(CameraUpdate.ZoomToZoom(0)); } if (_clusterManager == null) { _clusterManager = new GMUClusterManager(_control, new GMUNonHierarchicalDistanceBasedAlgorithm(), new GMUDefaultClusterRenderer(_control, new GMUDefaultClusterIconGenerator())); } SetNativeControl(_control); GenerateClusters(newMapView); }
void AddMapStyle(StylesEnum mapType) { var assembly = typeof(MapsStylingPage).GetTypeInfo().Assembly; System.IO.Stream stream; switch (mapType) { case StylesEnum.DARK: stream = assembly.GetManifestResourceStream($"MonkeyFestLatam.MasterXFmaps.MapStyles.MapStyleDark.json"); break; case StylesEnum.UBER: stream = assembly.GetManifestResourceStream($"MonkeyFestLatam.MasterXFmaps.MapStyles.MapStyleUber.json"); break; case StylesEnum.RETRO: stream = assembly.GetManifestResourceStream($"MonkeyFestLatam.MasterXFmaps.MapStyles.MapStyleRetro.json"); break; case StylesEnum.AUBERGINE: stream = assembly.GetManifestResourceStream($"MonkeyFestLatam.MasterXFmaps.MapStyles.MapStyleAubergine.json"); break; default: stream = assembly.GetManifestResourceStream($"MonkeyFestLatam.MasterXFmaps.MapStyles.MapStyleNight.json"); break; } string styleFile; using (var reader = new System.IO.StreamReader(stream)) { styleFile = reader.ReadToEnd(); } map.MapStyle = MapStyle.FromJson(styleFile); }