private void setUpClusterer()
        {
            // Declare a variable for the cluster manager.
            //

            // Position the map.
            _map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(51.503186, -0.126446), 10));

            // Initialize the manager with the context and the map.
            // (Activity extends context, so we can pass 'this' in the constructor.)
//	     mClusterManager = new ClusterManager<MyItem>(this, IDictionary);

            // Point the map's listeners at the listeners implemented by the cluster
            // manager.
//	      IDictionary.OnCameraChangeListener = mClusterManager;
//	IDictionary.OnMarkerClickListener = mClusterManager;

            // Add cluster items (markers) to the cluster manager.
            addItems();
        }
        private void SetupMapIfNeeded()
        {
            if (_map == null)
            {
                _map = _mapFragment.Map;
                if (_map != null)
                {
                    MarkerOptions markerOpt1 = new MarkerOptions();
                    markerOpt1.SetPosition(CacheManager.AverisCoordinate);
                    markerOpt1.SetTitle("Averis Sdn Bhd");
                    markerOpt1.InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueCyan));
                    _map.AddMarker(markerOpt1);
                    _map.MarkerClick += MarkerClick;

                    // We create an instance of CameraUpdate, and move the map to it.
                    CameraUpdate cameraUpdate = CameraUpdateFactory.NewLatLngZoom(CacheManager.AverisCoordinate, 16);
                    _map.MoveCamera(cameraUpdate);
                }
            }
        }
Ejemplo n.º 3
0
        public void ShowAustralia(View v)
        {
            // Wait until map is ready
            if (map == null)
            {
                return;
            }

            // Create bounds that include all locations of the map
            var boundsBuilder = new LatLngBounds.Builder()
                                .Include(PERTH)
                                .Include(ADELAIDE)
                                .Include(MELBOURNE)
                                .Include(SYDNEY)
                                .Include(DARWIN)
                                .Include(BRISBANE);

            // Move camera to show all markers and locations
            map.MoveCamera(CameraUpdateFactory.NewLatLngBounds(boundsBuilder.Build(), 20));
        }
Ejemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);


            var btnLocate = FindViewById <Button>(Resource.Id.btnLocate);

            //將地圖初始化
            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeSatellite)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeCompassEnabled(true);

                var fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }


            btnLocate.Click += delegate
            {
                if (_map == null)
                {
                    _map = _mapFragment.Map;
                }
                if (_map != null)
                {
                    //定位置台北101
                    _map.MapType = GoogleMap.MapTypeNormal;
                    CameraUpdate cameraUpdate = CameraUpdateFactory.NewLatLngZoom(new LatLng(25.033611, 121.565000), 15);
                    _map.MoveCamera(cameraUpdate);
                }
            };
        }
 public void SetCamera(View view)
 {
     try
     {
         LatLng latLng  = null;
         float  zoom    = 0f;
         float  bearing = 0f;
         float  tilt    = 0f;
         if (!TextUtils.IsEmpty(edtCameraLng.Text) && !TextUtils.IsEmpty(edtCameraLat.Text))
         {
             latLng = new LatLng(Single.Parse(edtCameraLat.Text.ToString().Trim()),
                                 Single.Parse(edtCameraLng.Text.ToString().Trim()));
         }
         if (!TextUtils.IsEmpty(edtCameraZoom.Text))
         {
             zoom = Single.Parse(edtCameraZoom.Text.ToString().Trim());
         }
         if (!TextUtils.IsEmpty(edtCameraBearing.Text))
         {
             bearing = Single.Parse(edtCameraBearing.Text.ToString().Trim());
         }
         if (!TextUtils.IsEmpty(edtCameraTilt.Text))
         {
             tilt = Single.Parse(edtCameraTilt.Text.ToString().Trim());
         }
         CameraPosition cameraPosition = new
                                         CameraPosition.Builder().Target(latLng).Zoom(zoom).Bearing(bearing).Tilt(tilt).Build();
         CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
         hMap.MoveCamera(cameraUpdate);
     }
     catch (Java.Lang.IllegalArgumentException e)
     {
         Log.Error(TAG, "IllegalArgumentException " + e.ToString());
         Toast.MakeText(this, "IllegalArgumentException", ToastLength.Short).Show();
     }
     catch (Java.Lang.NullPointerException e)
     {
         Log.Error(TAG, "NullPointerException " + e.ToString());
         Toast.MakeText(this, "NullPointerException", ToastLength.Short).Show();
     }
 }
Ejemplo n.º 6
0
        public async void OnMapReady(GoogleMap googleMap)
        {
            // disable the compass on the map
            googleMap.UiSettings.CompassEnabled = false;

            // disable the my location button
            googleMap.UiSettings.MyLocationButtonEnabled = false;

            // disable the map toolbar
            googleMap.UiSettings.MapToolbarEnabled = false;

            // prevent tap gestures (this will automatically open the external map application, which we don't want in this case)
            googleMap.MapClick += (sender, e) =>
            {
                // an empty delegate, to prevent click events
            };

            // attempt to get the lat and lon for the address
            _GeocodedLocation = await GetPositionAsync();

            if (_GeocodedLocation != null)
            {
                // because we now have coordinates, show the get directions action image view, and wire up its click handler
                _GetDirectionsActionImageView.Visibility = ViewStates.Visible;

                // initialze the map
                MapsInitializer.Initialize(this);

                // display the map region that contains the point. (the zoom level has been defined on the map layout in AcquaintanceDetail.axml)
                googleMap.MoveCamera(CameraUpdateFactory.NewLatLng(_GeocodedLocation));

                // create a new pin
                var marker = new MarkerOptions();

                // set the pin's position
                marker.SetPosition(new LatLng(_GeocodedLocation.Latitude, _GeocodedLocation.Longitude));

                // add the pin to the map
                googleMap.AddMarker(marker);
            }
        }
Ejemplo n.º 7
0
        public void OnMapReady(GoogleMap googleMap)
        {
            gMap         = googleMap;
            gMap.MapType = GoogleMap.MapTypeNormal;

            gMap.SetOnMarkerClickListener(this);
            gMap.UiSettings.ZoomControlsEnabled     = true;
            gMap.UiSettings.MyLocationButtonEnabled = true;
            gMap.UiSettings.MapToolbarEnabled       = true;
            gMap.UiSettings.CompassEnabled          = true;
            gMap.UiSettings.ScrollGesturesEnabled   = true;
            gMap.UiSettings.ZoomGesturesEnabled     = true;
            gMap.MoveCamera(CameraUpdateFactory.ZoomIn());

            gMap.AddMarker(new MarkerOptions().SetPosition(nightClub));
            //.SetIcon(BitmapDescriptorFactory.FromBitmap(GetCustomLocationMarkerView(Resource.Drawable.map_nightClub))));

            //Bar
            gMap.AddMarker(new MarkerOptions().SetPosition(bar));
            //.SetIcon(BitmapDescriptorFactory.FromBitmap(GetCustomLocationMarkerView(Resource.Drawable.map_barIcon))));

            //Sports bar
            gMap.AddMarker(new MarkerOptions().SetPosition(sportsBar));
            //.SetIcon(BitmapDescriptorFactory.FromBitmap(GetCustomLocationMarkerView(Resource.Drawable.map_sportsBar))));

            //restuarant
            gMap.AddMarker(new MarkerOptions().SetPosition(restaurant));
            //.SetIcon(BitmapDescriptorFactory.FromBitmap(GetCustomLocationMarkerView(Resource.Drawable.map_restaurant))));

            gMap.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(nightClub, 18));

            if (currentLocationLatLng != null)
            {
                isCurrentLocationZoomedIn = true;
                ZoomIntoCurrentLocation();
            }
            else
            {
                Console.WriteLine("OnMapReady : current location latLng not fetched");
            }
        }
Ejemplo n.º 8
0
        public void OnMapReady(GoogleMap googleMap)
        {
            _googleMap = googleMap;
            _googleMap.UiSettings.ZoomControlsEnabled = true;
            _googleMap.UiSettings.CompassEnabled      = true;

            if (ActivityCompat.CheckSelfPermission(Application.Context, Manifest.Permission.AccessFineLocation) == (Android.Content.PM.Permission.Denied) ||
                ActivityCompat.CheckSelfPermission(Application.Context, Manifest.Permission.AccessCoarseLocation) == (Android.Content.PM.Permission.Denied))
            {
                GetLocationPermission();
                System.Threading.Thread.Sleep(5000);
            }
            _googleMap.MyLocationEnabled = true;

            LatLng location = new LatLng(49.99181, 36.23572);

            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(location);
            builder.Zoom(15);
            CameraPosition cameraPosition = builder.Build();

            CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            _googleMap.MoveCamera(cameraUpdate);

            _markerOptions = new MarkerOptions();
            _markerOptions.Draggable(true);
            if (ViewModel.LalitudeMarker != 0 & ViewModel.LongitudeMarker != 0)
            {
                _lalitude  = this.ViewModel.LalitudeMarker;
                _longitude = this.ViewModel.LongitudeMarker;
                _latLng    = new LatLng(_lalitude, _longitude);
                _marker    = _googleMap.AddMarker(new MarkerOptions().SetPosition(_latLng));
            }

            _googleMap.MapClick      += MapOptionsClick;
            _googleMap.MarkerDragEnd += MarkerOptionLongClick;

            this.ViewModel.LalitudeMarker  = _lalitude;
            this.ViewModel.LongitudeMarker = _longitude;
        }
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (requestCode == 1)
            {
                if (resultCode == Android.App.Result.Ok)
                {
                    System.Console.WriteLine($"requestCode is {requestCode}");
                    takeAddressFromSearch    = true;
                    pickupRadio.Checked      = false;
                    destinationRadio.Checked = false;

                    var place = Autocomplete.GetPlaceFromIntent(data);
                    pickupLocationText.Text = place.Name.ToString();
                    pickupAddress           = place.Name.ToString();
                    pickupLocationLatLng    = place.LatLng;
                    mainMap.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(place.LatLng, 15));
                    centerMarker.SetColorFilter(Color.DarkGreen);
                }
            }

            if (requestCode == 2)
            {
                if (resultCode == Android.App.Result.Ok)
                {
                    System.Console.WriteLine($"requestCode is {requestCode}");
                    takeAddressFromSearch    = true;
                    pickupRadio.Checked      = false;
                    destinationRadio.Checked = false;

                    var place = Autocomplete.GetPlaceFromIntent(data);
                    destinationText.Text = place.Name.ToString();
                    destinationAddress   = place.Name.ToString();
                    destinationLatLng    = place.LatLng;
                    mainMap.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(place.LatLng, 15));
                    centerMarker.SetColorFilter(Color.Red);
                    TripLocationsSet();
                }
            }
        }
Ejemplo n.º 10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            currentLat  = 0;
            currentLong = 0;
            RequestWindowFeature(Android.Views.WindowFeatures.NoTitle);
            var settings = CrossSettings.Current;

            score = settings.GetValueOrDefault <int>("score", 0);
            settings.AddOrUpdateValue <int>("score", score);



            spawnList = null;
            base.OnCreate(savedInstanceState);
            InitializeLocationManager();
            SetContentView(Resource.Layout.Map);
            status         = FindViewById <TextView>(Resource.Id.status);
            scoreText      = FindViewById <TextView>(Resource.Id.score);
            scoreText.Text = "Score: " + score.ToString();
            // Create your application here
            InitMapFragment();
            Button locationbtn = FindViewById <Button>(Resource.Id.MyLocationBtn);


            locationbtn.Click += (sender, e) =>
            {
                LatLng mapLocation             = new LatLng(currentLat, currentLong);
                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                builder.Target(mapLocation);
                builder.Zoom(18);
                builder.Bearing(155);
                builder.Tilt(65);
                CameraPosition cameraPosition = builder.Build();
                CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

                if (_map != null)
                {
                    _map.AnimateCamera(cameraUpdate);
                }
            };
        }
Ejemplo n.º 11
0
        public void OnMapReady(GoogleMap map)
        {
            _map = map;
            _map.MarkerDragEnd += MarkerDragEnd;
            //Coordenadas del centro de Aguascalientes
            LatLng location = new LatLng(21.880636, -102.297108);

            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(location);
            builder.Zoom(18);
            CameraPosition cameraPosition = builder.Build();
            CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            //Mover la posición de la cámara
            _map.MoveCamera(cameraUpdate);
            //Agregar marcador
            markerOpt1 = new MarkerOptions();
            markerOpt1.SetPosition(new LatLng(21.880636, -102.297108));
            markerOpt1.Draggable(true);
            _map.AddMarker(markerOpt1);
        }
Ejemplo n.º 12
0
        public void OnMapReady(GoogleMap googleMap)
        {
            PolylineOptions path = new PolylineOptions();

            LatLngBounds.Builder builder = new LatLngBounds.Builder();
            foreach (Location l in track.locations)
            {
                LatLng        pos = new LatLng(l.lat, l.lng);
                MarkerOptions m   = new MarkerOptions();
                m.SetPosition(pos);
                m.SetTitle(l.time);
                path.Add(pos);
                builder.Include(pos);
                googleMap.AddMarker(m);
            }
            googleMap.AddPolyline(path);
            LatLngBounds bounds = builder.Build();
            CameraUpdate cu     = CameraUpdateFactory.NewLatLngBounds(bounds, 50);

            googleMap.AnimateCamera(cu);
        }
Ejemplo n.º 13
0
        void SetMapPosition(LatLng location, float bearing = -1)
        {
            if (mMapView == null)
            {
                return;
            }

            if (bearing == -1)
            {
                mMapView.MoveCamera(CameraUpdateFactory.NewLatLngZoom(location, Constants.MAP_ZOOM_LEVEL));
            }
            else
            {
                mMapView.AnimateCamera(CameraUpdateFactory.NewCameraPosition(new CameraPosition(location, Constants.MAP_ZOOM_LEVEL, 45f, _currentLocation.Bearing)));
            }

            if (markerMyLocation != null)
            {
                markerMyLocation.Position = location;
            }
        }
Ejemplo n.º 14
0
        private void UpdateMapView()
        {
            var mapReadyCallback = new LocalMapReady();

            mapReadyCallback.MapReady += (sender, args) =>
            {
                googleMap = (sender as LocalMapReady).Map;
                if (googleMap != null)
                {
                    MarkerOptions markerOptions = new MarkerOptions();
                    markerOptions.SetPosition(rayLocation);
                    markerOptions.SetTitle("Ray's Hot Dogs");
                    googleMap.AddMarker(markerOptions);

                    CameraUpdate cameraUpdate = CameraUpdateFactory.NewLatLngZoom(rayLocation, 15);
                    googleMap.MoveCamera(cameraUpdate);
                }
            };

            mapFragment.GetMapAsync(mapReadyCallback);
        }
        public void AddFromResource(View view)
        {
            if (hMap == null)
            {
                return;
            }
            if (null != overlay)
            {
                overlay.Remove();
            }
            Log.Debug(TAG, "AddFromResource: ");
            GroundOverlayOptions options = new GroundOverlayOptions().Position(MapUtils.FRANCE2, 50, 50)
                                           .InvokeImage(BitmapDescriptorFactory.FromResource(Resource.Drawable.niuyouguo));

            overlay = hMap.AddGroundOverlay(options);
            CameraPosition cameraPosition = new
                                            CameraPosition.Builder().Target(MapUtils.FRANCE2).Zoom(18).Bearing(0f).Tilt(0f).Build();
            CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            hMap.MoveCamera(cameraUpdate);
        }
Ejemplo n.º 16
0
        public void OnMapReady(GoogleMap map)
        {
            map.MapType = GoogleMap.MapTypeTerrain;

            map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(46.0774, 18.6222), 5.9f));



            events = Event.GetAll().Where(x => x.startdate > DateTime.Now).ToArray();

            foreach (Event item in events)
            {
                MarkerOptions markerOpt = new MarkerOptions();
                markerOpt.SetPosition(new LatLng(item.lat, item.lon));
                markerOpt.SetTitle(item.game);
                markerOpt.SetSnippet(item.startdate.ToString("yyyy-MM-dd"));
                markerOpt.Draggable(true);
                map.MarkerDragStart += Map_MarkerDragStart;
                map.AddMarker(markerOpt);
            }
        }
Ejemplo n.º 17
0
        public static void UpdateMapZoom(GoogleMap _map, double lat, double lon, double?radius)
        {
            var location = new LatLng(lat, lon);

            AddMarker(_map, location);
            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(location);
            builder.Zoom(GetZoomLevel(radius.Value));
            CameraPosition cameraPosition = builder.Build();
            CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            _map.MoveCamera(cameraUpdate);

            double currentRadius = radius ?? 100.0;

            if (radius > 6000000)
            {
                radius = 6000000;
            }
            _map.AddCircle(new CircleOptions().InvokeCenter(location).InvokeRadius(currentRadius).InvokeStrokeWidth(0f).InvokeFillColor(Color.Argb(50, 50, 50, 200)));
        }
Ejemplo n.º 18
0
        private async void ReadingChanged(object sender, CompassChangedEventArgs e)
        {
            if (e.Reading.HeadingMagneticNorth - commpas > 2 || e.Reading.HeadingMagneticNorth - commpas < -2)
            {
                isMove  = true;
                commpas = e.Reading.HeadingMagneticNorth;
                if (isCompas)
                {
                    Plugin.Geolocator.Abstractions.Position position = await CrossGeolocator.Current.GetLastKnownLocationAsync();

                    if (position != null)
                    {
                        await map.AnimateCamera(CameraUpdateFactory.NewCameraPosition(new CameraPosition(new Position(position.Latitude, position.Longitude), 20, e.Reading.HeadingMagneticNorth, 70)), TimeSpan.FromMilliseconds(10));
                    }
                }
            }
            else
            {
                isMove = false;
            }
        }
Ejemplo n.º 19
0
        public void OnLocationChanged(Location location)
        {
            LatLng       coord  = new LatLng(location.Latitude, location.Longitude);
            CameraUpdate update = CameraUpdateFactory.NewLatLngZoom(coord, 17);

            map.AnimateCamera(update);

            if (currentLocationMarker != null)
            {
                currentLocationMarker.Position = coord;
            }
            else
            {
                var markerOptions = new MarkerOptions()
                                    .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue))
                                    .SetPosition(coord)
                                    .SetTitle("Current Position")
                                    .SetSnippet("This is where you are now");
                currentLocationMarker = map.AddMarker(markerOptions);
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Move the google map to the map center
        /// </summary>
        private void MoveToCenter()
        {
            if (this._googleMap == null)
            {
                return;
            }

            if (!this.FormsMap.MapCenter.Equals(this._googleMap.CameraPosition.Target.ToPosition()))
            {
                var cameraUpdate = CameraUpdateFactory.NewLatLng(this.FormsMap.MapCenter.ToLatLng());

                if (this.FormsMap.IsRegionChangeAnimated && !this._init)
                {
                    this._googleMap.AnimateCamera(cameraUpdate);
                }
                else
                {
                    this._googleMap.MoveCamera(cameraUpdate);
                }
            }
        }
Ejemplo n.º 21
0
        private void UpdateLocation(Location location)
        {
            if (MainActivity.Instance.Map != null)
            {
                //MarkerOptions markerOpt1 = new MarkerOptions();
                //markerOpt1.SetPosition(new LatLng(location.Latitude, location.Longitude));
                //markerOpt1.SetTitle("ICM Inc");

                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                builder.Target(new LatLng(location.Latitude, location.Longitude));
                builder.Zoom(18);
                builder.Bearing(155);

                CameraPosition cameraPosition = builder.Build();
                CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

                MainActivity.Instance.Map.MoveCamera(cameraUpdate);

                //_map.MoveCamera(cameraUpdate);
            }
        }
        private void SetupMapIfNeeded()
        {
            if (_mapFragment.Map != null)
            {
                _map = _mapFragment.Map;
            }
            if (_map == null)
            {
                return;
            }
            _map.MyLocationEnabled = true;

            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(CurrentLocation);
            builder.Zoom(15);
            builder.Bearing(155);
            builder.Tilt(25);
            CameraPosition cameraPosition = builder.Build();

            _map.MoveCamera(CameraUpdateFactory.NewCameraPosition(cameraPosition));
        }
Ejemplo n.º 23
0
        public void OnMapReady(GoogleMap googleMap)
        {
            map = googleMap;
            MapsInitializer.Initialize(Activity.ApplicationContext);

            map.MapClick    += HandleMapClick;
            map.MarkerClick += HandleMapMarkerClick;

            map.UiSettings.CompassEnabled          = false;
            map.UiSettings.MyLocationButtonEnabled = false;
            map.UiSettings.MapToolbarEnabled       = false;

            var markerLatLong = new LatLng(Place.Geometry.Location.Latitude, Place.Geometry.Location.Longitude);
            var markerOptions = new MarkerOptions();

            markerOptions.SetTitle(Place.Name);
            markerOptions.SetPosition(markerLatLong);

            map.AddMarker(markerOptions);
            map.MoveCamera(CameraUpdateFactory.NewLatLng(markerLatLong));
        }
Ejemplo n.º 24
0
        public async void ReCenter()
        {
            if (CurrentLocation != null && !IsZoommingCamera)
            {
                IsAutoChangeCamera = true;
                IsZoommingCamera   = true;

                IsAuto = true;
                if (mViewPager != null && mViewPager.CurrentItem != CurrentInstruction)
                {
                    mViewPager.SetCurrentItem(CurrentInstruction, false);
                }
                map.AnimateCamera(CameraUpdateFactory.NewLatLng(CurrentLocation));
                await Task.Delay(2000);

                IsAutoChangeCamera       = false;
                IsZoommingCamera         = false;
                IsAuto                   = false;
                ViewModel.IsShowReCenter = false;
            }
        }
Ejemplo n.º 25
0
        public void OnMapReady(GoogleMap googleMap)
        {
            _googleMap = googleMap;

            //_mapFragment.View.LayoutParameters.Height = 900;

            MapsInitializer.Initialize(this);
            if (_isEditable)
            {
                _googleMap.MapLongClick += GoogleMap_MapLongClick;
            }

            if (_markerPosition != null)
            {
                var           coordinates = new LatLng(_markerPosition.Latitude, _markerPosition.Longtitute);
                MarkerOptions markerOpt1  = new MarkerOptions();
                markerOpt1.SetPosition(coordinates);
                _googleMap.MoveCamera(CameraUpdateFactory.NewLatLng(coordinates));
                _googleMap.AddMarker(markerOpt1);
            }
        }
Ejemplo n.º 26
0
        public void OnMapReady(GoogleMap googleMap)
        {
            mMap = googleMap;

            LatLng       latlng = new LatLng(ConfigManager.DefaultLatMap, ConfigManager.DefaultLongMap);
            CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(latlng, ConfigManager.DefaultDraggZoomMap);

            mMap.MoveCamera(camera);

            // Establezco el tipo de Mapa (Normal, Stelite, Hibrido, etc...)
            mMap.MapType           = GoogleMap.MapTypeNormal;
            mMap.MyLocationEnabled = true;


            // Cargo el Marcador que va a servir de centro y la posicion global
            mMarkerCenter   = MarkerManager.CreateUserDragable();
            mCenterPosition = mMarkerCenter.Position;

            mMap.AddMarker(mMarkerCenter);
            mMap.MarkerDragEnd += MMap_MarkerDragEnd;
        }
Ejemplo n.º 27
0
        private void amap_Loaded(object sender, RoutedEventArgs e)
        {
            this.Dispatcher.BeginInvoke(() =>
            {
                //设置默认的地图经纬度和缩放级别
                amap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(39.987326, 116.48236), 13));

                ////实例化标注点
                AMapMarkerOptions opt = new AMapMarkerOptions()
                {
                    Position = new LatLng(39.987326, 116.48236),
                    Title    = "这是一个marker",
                    IconUri  = new Uri("Images/AZURE.png", UriKind.Relative),
                    Anchor   = new Point(0.5, 0.5),//图标中心点
                };

                //添加点
                marker = amap.AddMarker(opt);
                amap.MarkerClickListener += amap_MarkerClickListener;
            });
        }
Ejemplo n.º 28
0
        }//CreateUserPreferences()

        private void CheckDistanceForZoom()
        {
            Location startLocation = new Location("");

            startLocation.Latitude  = startlat;
            startLocation.Longitude = startlng;

            Location finishLocation = new Location("");

            finishLocation.Latitude  = stoplat;
            finishLocation.Longitude = stoplng;

            markerDistance = startLocation.DistanceTo(finishLocation);

            if (markerDistance >= 0) //markerDistance is in meters
            {
                boundsBuilder.Include(finishLatLng);
                boundsBuilder.Include(startLatLng);
                nMap.MoveCamera(CameraUpdateFactory.NewLatLngBounds(boundsBuilder.Build(), 135));
            }
        }//CheckDistanceForZoom()
Ejemplo n.º 29
0
        public void MarkerSec(int Position)
        {
            //MapDataModel1.ForEach(item =>
            //{
            //    item.IlgiliMarker.SetIcon(BitmapDescriptorFactory.FromBitmap(new MapUtils().createStoreMarker(this.Activity, false, item.user.profile_photo)));
            //});

            var Item = Locationss[Position];
            //#region Bir Öncekini Kapat

            //MapUtils mapUtils2 = new MapUtils();
            //Android.Graphics.Bitmap bitmap = mapUtils2.createStoreMarker(this.Activity, true, Item.user.profile_photo);
            //BitmapDescriptor image = BitmapDescriptorFactory.FromBitmap(bitmap);
            //Item.IlgiliMarker.SetIcon(image);

            //#endregion

            CameraUpdate cameraUpdate = CameraUpdateFactory.NewLatLngZoom(new LatLng(Item.coordinateX, Item.coordinateY), _map.CameraPosition.Zoom);

            _map.AnimateCamera(cameraUpdate);
        }
Ejemplo n.º 30
0
        void AddMarkersToMap()
        {
            var vimyMarker = new MarkerOptions();

            vimyMarker.SetPosition(VimyRidgeLatLng)
            .SetTitle("Vimy Ridge")
            .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueCyan));
            googleMap.AddMarker(vimyMarker);


            var passchendaeleMarker = new MarkerOptions();

            passchendaeleMarker.SetPosition(PasschendaeleLatLng)
            .SetTitle("PasschendaeleLatLng");
            googleMap.AddMarker(passchendaeleMarker);

            // We create an instance of CameraUpdate, and move the map to it.
            var cameraUpdate = CameraUpdateFactory.NewLatLngZoom(VimyRidgeLatLng, 15);

            googleMap.MoveCamera(cameraUpdate);
        }