Ejemplo n.º 1
0
        private async void BtnLoc_Click(object sender, EventArgs e)
        {
            try
            {
                currentLocation = await Geolocation.GetLastKnownLocationAsync();

                if (currentLocation != null)
                {
                    txtLoc.Text = $"Latitude={currentLocation.Latitude} , Longitude={currentLocation.Longitude} ";
                    Console.WriteLine($"Latitude: {currentLocation.Latitude}, Longitude: {currentLocation.Longitude}, Altitude: {currentLocation.Altitude}");

                    //mapView.GetMapAsync(this);


                    Com.Mapbox.Geojson.Point point = Com.Mapbox.Geojson.Point.FromLngLat(currentLocation.Longitude, currentLocation.Latitude);
                    mapbox.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(point.Latitude(), point.Longitude()), 15));

                    var options = new SymbolOptions();
                    options.WithIconImage("airport-15");
                    options.WithGeometry(point);
                    options.WithIconSize(new Float(2f))
                    .WithDraggable(true);

                    var symbol = symbolManager.Create(options);
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        public void OnStyleLoaded(Style p0)
        {
            symbolManager = new SymbolManager(mapView, mapbox, p0);
            Com.Mapbox.Geojson.Point point = Com.Mapbox.Geojson.Point.FromLngLat(105.505, 21.033);
            mapbox.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(point.Latitude(), point.Longitude()), 8));

            var options = new SymbolOptions();

            options.WithIconImage("fire-station-11");
            options.WithGeometry(point);
            options.WithIconSize(new Float(2f))
            .WithDraggable(true);

            var symbol = symbolManager.Create(options);

            Com.Mapbox.Geojson.Point point2 = Com.Mapbox.Geojson.Point.FromLngLat(25.8672299, 85.1720807);
            var options2 = new SymbolOptions()
                           .WithIconImage("fire-station-11")
                           .WithGeometry(point2)
                           .WithIconSize(new Float(2f))
                           .WithDraggable(true);

            var symbol2 = symbolManager.Create(options2);

            symbolManager.AddClickListener(this);
        }