当前位置: 首页>>代码示例>>C#>>正文


C# GoogleMap.AnimateCamera方法代码示例

本文整理汇总了C#中Android.Gms.Maps.GoogleMap.AnimateCamera方法的典型用法代码示例。如果您正苦于以下问题:C# GoogleMap.AnimateCamera方法的具体用法?C# GoogleMap.AnimateCamera怎么用?C# GoogleMap.AnimateCamera使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Gms.Maps.GoogleMap的用法示例。


在下文中一共展示了GoogleMap.AnimateCamera方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            button = FindViewById<Button>(Resource.Id.GetLocationButton);
            latitude = FindViewById<TextView>(Resource.Id.LatitudeText);
            longitude = FindViewById<TextView>(Resource.Id.LongitudeText);
            provider = FindViewById<TextView>(Resource.Id.ProviderText);
            address = FindViewById<TextView>(Resource.Id.AddressText);

            // MapFragment の用意と初期の場所を指定します。
            // MapFragment.Map が deprecated みたいなので、正しい書き方を教えてください><
            MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.MapFragment);
            map = mapFrag.Map;
            if (map != null) // Map の準備が出来たら (最初は null を返します)
            {
                map.MyLocationEnabled = true; // 現在地ボタン オン
                map.UiSettings.ZoomControlsEnabled = true; // ズームコントロール オン
                // 初期位置(カメラ)を移動
                map.AnimateCamera(CameraUpdateFactory.NewCameraPosition(
                    new CameraPosition(
                        new LatLng(35.685344d, 139.753029d), // 皇居(中心位置)
                        12f, 0f, 0f))); // ズームレベル、方位、傾き
            }
        }
开发者ID:zcccust,项目名称:Study,代码行数:28,代码来源:MainActivity.cs

示例2: OnMapReady

        public void OnMapReady(GoogleMap googleMap)
        {
            this.googleMap = googleMap;

            LatLng denmarkLatLng = new LatLng(56, 10.5);
            googleMap.MoveCamera(CameraUpdateFactory.NewLatLng(denmarkLatLng));
            googleMap.AnimateCamera(CameraUpdateFactory.ZoomTo(6));
        }
开发者ID:wijen1,项目名称:HowlOut,代码行数:8,代码来源:LocationDialog.cs

示例3: SetupMapIfNeeded

        private bool SetupMapIfNeeded()
        {
            if (_map == null)
            {
                _map = _mapFragment.Map;
                if (_map != null)
                {
                    AddMonkeyMarkersToMap();
                    AddInitialPolarBarToMap();

                    // Animate the move on the map so that it is showing the markers we added above.
                    _map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(LocationForCustomIconMarkers[1], 2));
                    return true;
                }
                return false;
            }
            return true;
        }
开发者ID:josephkiran,项目名称:Projects,代码行数:18,代码来源:MapWithOverlaysActivity.cs

示例4: DrawMap

        async public void DrawMap()
        {
            if  ( _stateClass._person != null)
            {


                _mapFragment = MapFragment.FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
                _map = _mapFragment.Map;
                _map.Clear();

                // Set the map type 
                // show user location
                _map.MyLocationEnabled = true;

                // setup a location manager
                _locationManager = _mainActivity.GetSystemService (Context.LocationService) as LocationManager;

                // use a generic location provider instead
                Criteria locationCriteria = new Criteria();
                locationCriteria.Accuracy = Accuracy.Coarse;
                locationCriteria.PowerRequirement = Power.Medium;

                await System.Threading.Tasks.Task.Delay(0);

                var geoCoder = new Geocoder(_mainActivity);
             
                try
                {
                    Address address = this.GetAddressesFromLocation(_stateClass._person.Strasse,_stateClass._person.PLZ,_stateClass._person.Ort,_stateClass._person.Land);
                    MarkerOptions marker1 = new MarkerOptions();

                    if (address != null)
                    {

                        marker1.SetPosition(new LatLng(address.Latitude, address.Longitude));
                        marker1.SetTitle(_stateClass._person.Name + " - " + _stateClass._person.Strasse + " - " + _stateClass._person.Ort + "- " + _stateClass._person.Umsatz);
                        marker1.InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed));
                        _Marker =  _map.AddMarker(marker1);
                        _map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(new Android.Gms.Maps.Model.LatLng(address.Latitude, address.Longitude), 9.0f));

                    }
                    else
                    {
                        Android.Widget.Toast.MakeText(_mainActivity,_mainActivity.Resources.GetString(Resource.String.AddresseNichtGefunden), Android.Widget.ToastLength.Short).Show();
                    }

                    _map.MarkerClick +=  (object sender, GoogleMap.MarkerClickEventArgs markerClickEventArgs) => 
                        {
                            markerClickEventArgs.Handled = true;
                            Marker marker = markerClickEventArgs.Marker;
                            _map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(marker.Position, 13));
                            marker.ShowInfoWindow();
                        };
                }   

                catch(Exception ex)
                {
                    DataAccessLayer.ExceptionWriter.WriteLogFile(ex);
                }
            }
        }
开发者ID:MbProg,项目名称:TestApolloAndroid,代码行数:61,代码来源:State.cs

示例5: SetupMapIfNeeded

		private void SetupMapIfNeeded()
		{
			if (_map == null)
			{
				_map = _mapFragment.Map;
				if (_map != null)
				{
					var centerPoint = new LatLng (Station.TroncalRouteCenter.Y, Station.TroncalRouteCenter.X);
					Activity.RunOnUiThread (delegate{
						_map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(centerPoint,15.0f));
						_map.MyLocationEnabled = true;
					});
					stations = stationRepository.Stations;
					Activity.RunOnUiThread (delegate{
						foreach(var station in stations){
							var location = new LatLng(station.Latitude, station.Longitude);
							var stationImageId = Resources.GetIdentifier( station.ImageFilename().ToLower(), "drawable", Activity.PackageName);
							var originalStationBitmap = BitmapFactory.DecodeResource(Resources, stationImageId);
							var scale = Resources.DisplayMetrics.Density;
							var pixels = 35;
							var stationBitmap = Bitmap.CreateScaledBitmap(originalStationBitmap, (int) (pixels * scale + 0.5f), (int) (pixels * scale + 0.5f), false);
							MarkerOptions markerOptions = new MarkerOptions()
								.SetPosition(location)
								.InvokeIcon(BitmapDescriptorFactory.FromBitmap(stationBitmap))
								.SetTitle(station.Name);
							_map.AddMarker(markerOptions);
						}
						var polylineOptions = new PolylineOptions();
						polylineOptions.InvokeWidth(5.0f);
						polylineOptions.InvokeColor(Color.Black);
						foreach(var point in Station.TroncalRoutePath){
							polylineOptions.Add(new LatLng(point.Y, point.X));
						}
						_map.AddPolyline(polylineOptions);
					});
				}
			}
		}
开发者ID:305088020,项目名称:ChART,代码行数:38,代码来源:MapsFragment.cs

示例6: OnMapReady

        public async void OnMapReady(GoogleMap googleMap)
        {
            GMap = googleMap;
            GMap.InfoWindowClick += MapOnMarkerClick;
            
            // users = new ArrayList();
            string result= await ApiRequests.getLocations(client);
            if (result!= "error")
            {
                users = JsonConvert.DeserializeObject<User[]>(result);
                

                foreach (User user in users)
                {
                    if (user.latitude != null)
                    {
                        GMap.AddMarker(new MarkerOptions()
                            .SetTitle(user.first_name + " " + user.last_name)
                            
                            .SetSnippet(user.email)
                            .InvokeIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.marker))
                            .SetPosition(new LatLng((double)user.latitude, (double)user.longitude)));
                    }
                }
            }

            GMap.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng((double)client.latitude, (double)client.longitude), 12));

           
        }
开发者ID:DlerAhmad,项目名称:AndroidMessenger,代码行数:30,代码来源:MapActivity.cs

示例7: OnStart

        public override void OnStart ()
        {
            base.OnStart ();


            if (_person != null)
            {
                _mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
                if (_mapFragment == null)
                    return;
                _map = _mapFragment.Map;


                // Set the map type 
                _map.MapType = GoogleMap.MapTypeNormal;

                // show user location
                _map.MyLocationEnabled = true;

                // setup a location manager
                _locationManager = _activity.GetSystemService (Context.LocationService) as LocationManager;

                // use a generic location provider instead
                Criteria locationCriteria = new Criteria();
                locationCriteria.Accuracy = Accuracy.Coarse;
                locationCriteria.PowerRequirement = Power.Medium;

                var geoCoder = new Geocoder(_activity);

                try
                {
                    Address address = this.GetAddressesFromLocation(_person.Strasse,_person.PLZ,_person.Ort,_person.Land);
                    MarkerOptions marker1 = new MarkerOptions();

                    if (address != null)
                    {

                        marker1.SetPosition(new LatLng(address.Latitude, address.Longitude));
                        marker1.SetTitle(_person.Name + " - " + _person.Strasse + " - " + _person.Ort + "- " + _person.Umsatz);
                        marker1.InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed));
                        _Marker =  _map.AddMarker(marker1);
                        _map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(new Android.Gms.Maps.Model.LatLng(address.Latitude, address.Longitude), 9.0f));

                    }
                    else
                    {
                        Android.Widget.Toast.MakeText(_activity,_activity.Resources.GetString(Resource.String.AddresseNichtGefunden), Android.Widget.ToastLength.Short).Show();
                    }


                    _map.MarkerClick += MapOnMarkerClick;



                }   

                catch(Exception ex)
                {
                    DataAccessLayer.ExceptionWriter.WriteLogFile(ex);
                }




            }       
        }
开发者ID:MbProg,项目名称:TestApolloAndroid,代码行数:66,代码来源:MainFragment.cs

示例8: SetUpMapIfNeeded

		private void SetUpMapIfNeeded(List<Feature> data) 
		{
			if(null != _googleMap) 
				return;

			CameraPosition.Builder builder = CameraPosition.InvokeBuilder ();

			if (string.Compare (_selectedCity, "warszawa") == 0) 
			{
				LatLng location = new LatLng (52.2333, 21.0167);
				builder.Target (location);
				builder.Zoom (11);
			}
			if (string.Compare (_selectedCity, "czestochowa") == 0) 
			{
				LatLng location = new LatLng (50.8000, 19.1167);
				builder.Target (location);
				builder.Zoom (11);
			}

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

			var mapReadyCallback = new OnMapReadyClass();
			mapReadyCallback.MapReady += (sender, e) =>
			{
				_googleMap = ((OnMapReadyClass)sender).Map; 
				_googleMap.MapType = GoogleMap.MapTypeNormal;
				_googleMap.AnimateCamera(cameraUpdate);

				GoogleMapHelpers.PlaceMarkersOnTheMap(data, _googleMap);

				_googleMap.SetInfoWindowAdapter(new CustomMarkerPopupAdapter(LayoutInflater));
			};

			try {
				if(_myMapFragment != null)
					_myMapFragment.GetMapAsync(mapReadyCallback); 
				
			} catch (NullReferenceException ex) {
				Console.WriteLine(ex.Source);
			}
		}
开发者ID:znajdzWC,项目名称:znajdz-wc-android,代码行数:43,代码来源:MainActivity.cs

示例9: SetUpMapIfNeeded

		private void SetUpMapIfNeeded() 
		{
			if(null != _googleMap) 
				return;

			CameraPosition.Builder builder = CameraPosition.InvokeBuilder ();

			LatLng location = new LatLng (Convert.ToDouble(_latitude), Convert.ToDouble(_longitude));
			builder.Target (location);
			builder.Zoom (15);

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

			var mapReadyCallback = new OnMapReadyClass();
			mapReadyCallback.MapReady += (sender, e) =>
			{
				_googleMap = ((OnMapReadyClass)sender).Map; 
				_googleMap.MapType = GoogleMap.MapTypeNormal;
				_googleMap.AnimateCamera(cameraUpdate);

				List<Feature> data = new List<Feature>();

				List<double> coord = new List<double> ();
				coord.Add (Convert.ToDouble(_longitude));
				coord.Add (Convert.ToDouble(_latitude));

				_toilet = new Feature () 
				{
					type = "Feature",
					geometry = new Geometry()
					{
						coordinates = coord,
						type = "Point"
					},
					properties = new Properties()
					{
						ranking = "0",
						id = "0",
						name = _name,
						icon = "znajdz_wc_logo_free_marker.png",
						isFree = _isFree,
						comment = _comment,
						photo = "",
						openHours = "",
						isVerified = false,
					}
				};

				data.Add(_toilet);

				GoogleMapHelpers.PlaceMarkersOnTheMap(data, _googleMap);

				_googleMap.SetInfoWindowAdapter(new CustomMarkerPopupAdapter(LayoutInflater));
			};

			try {
				_myMapFragment.GetMapAsync(mapReadyCallback); 

			} catch (NullReferenceException ex) {
				Console.WriteLine(ex.Source);
			}
		}
开发者ID:znajdzWC,项目名称:znajdz-wc-android,代码行数:63,代码来源:AddNewActivity.cs


注:本文中的Android.Gms.Maps.GoogleMap.AnimateCamera方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。