本文整理汇总了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))); // ズームレベル、方位、傾き
}
}
示例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));
}
示例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;
}
示例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);
}
}
}
示例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);
});
}
}
}
示例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));
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}