本文整理汇总了C#中Android.Gms.Maps.Model.LatLng类的典型用法代码示例。如果您正苦于以下问题:C# LatLng类的具体用法?C# LatLng怎么用?C# LatLng使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LatLng类属于Android.Gms.Maps.Model命名空间,在下文中一共展示了LatLng类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ToBounds
public static LatLngBounds ToBounds(this MapRegion region)
{
var southwest = new LatLng(region.MinY, region.MinX);
var northeast = new LatLng(region.MaxY, region.MaxX);
return new LatLngBounds(southwest, northeast);
}
开发者ID:fiveninedigital,项目名称:UnifiedMaps,代码行数:7,代码来源:UnifiedMapExtensions.cs
示例2: adddatatomap
// Function to add data fields passed on from Main Activity (Latitude, Longitude, Address - then adds a tag to marker utilising the address field if there's any)
public void adddatatomap()
{
MarkerOptions opt = new MarkerOptions();
double lat = Convert.ToDouble(Intent.GetStringExtra("Latitude"));
double lng = Convert.ToDouble(Intent.GetStringExtra("Longitude"));
string address = Intent.GetStringExtra("Address");
LatLng location = new LatLng(lat, lng);
opt.SetPosition(location);
opt.SetTitle(address);
map.AddMarker(opt); // Adds a marker to map based on the address that was past on from our Main Activity
// Positioning the camera to show the marker based on fields parameter as set below
CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
builder.Target(location);
builder.Zoom(15);
builder.Bearing(90);
builder.Tilt(65);
CameraPosition cameraPosition = builder.Build();
CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
map.MoveCamera(cameraUpdate);
// Marker window clicked event
map.InfoWindowClick += map_InfoWindowClick;
// Marker dragged event
map.MarkerDragEnd += map_MarkerDragEnd;
}
开发者ID:TigerIke,项目名称:WIC-PROJECT,代码行数:30,代码来源:MapActivity.cs
示例3: DecodePolyline
public static IList<LatLng> DecodePolyline(string encoded)
{
List<LatLng> poly = new List<LatLng>();
int index = 0, len = encoded.Length;
int lat = 0, lng = 0;
while (index < len)
{
int b, shift = 0, result = 0;
do
{
b = encoded[index++] - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lat += dlat;
shift = 0;
result = 0;
do
{
b = encoded[index++] - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lng += dlng;
LatLng p = new LatLng((((double)lat / 1E5)), (((double)lng / 1E5)));
poly.Add(p);
}
return poly;
}
开发者ID:ThePublicBikeGang,项目名称:EasyBike,代码行数:34,代码来源:MapHelper.cs
示例4: Ciudad_Marca
public Ciudad_Marca(string nombre,string descripcion, LatLng ubicacion,string imagen)
{
this.Nombre = nombre;
this.Descripcion = descripcion;
this.Ubicacion = ubicacion;
this.Imagen = imagen;
}
开发者ID:DiLRandI,项目名称:Xamarin.android,代码行数:7,代码来源:Ciudad_Marca.cs
示例5: MapRoute
public MapRoute(GoogleMap map, List<Station> stations)
{
_map = map;
_mapRoutes = new List<Polyline>();
_mapStations = new List<Marker>();
// Choose color;
Color color = Color.DodgerBlue;
// Create polyline.
var polyline = new PolylineOptions();
polyline.InvokeWidth(4f);
polyline.InvokeColor(color);
for (var i = 0; i < stations.Count; i++)
{
// Add points to polyline.
var station = stations[i];
if (station != null && station.latitude != 0f && station.longitude != 0f)
{
var latlng = new Android.Gms.Maps.Model.LatLng(station.latitude, station.longitude);
polyline.Add(latlng);
// Create marker.
var marker = new MarkerOptions();
marker.SetPosition(latlng);
marker.SetTitle((i + 1) + ". " + station.postName);
marker.Draggable(false);
marker.SetSnippet("ul. " + station.street);
_mapStations.Add(_map.AddMarker(marker));
}
}
// Add polyline to map.
_mapRoutes.Add(_map.AddPolyline(polyline));
}
开发者ID:Lichwa,项目名称:JakDojadeXamarin,代码行数:35,代码来源:MapRoute.cs
示例6: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.split_street_view_panorama_and_map_demo);
if (savedInstanceState == null)
markerPosition = SYDNEY;
else
markerPosition = savedInstanceState.GetParcelable (MARKER_POSITION_KEY).JavaCast<LatLng> ();
var streetViewPanoramaFragment =
(SupportStreetViewPanoramaFragment)
SupportFragmentManager.FindFragmentById (Resource.Id.streetviewpanorama);
streetViewPanoramaFragment.GetStreetViewPanoramaAsync (this);
SupportMapFragment mapFragment =
(SupportMapFragment) SupportFragmentManager.FindFragmentById (Resource.Id.map);
mapFragment.GetMapAsync (this);
// @Override
// public void onMapReady(GoogleMap map) {
// map.setOnMarkerDragListener(SplitStreetViewPanoramaAndMapDemoActivity.this);
// // Creates a draggable marker. Long press to drag.
// mMarker = map.addMarker(new MarkerOptions()
// .position(markerPosition)
// .icon(BitmapDescriptorFactory.fromResource(R.drawable.pegman))
// .draggable(true));
// }
// });
}
开发者ID:FirstClickStart,项目名称:yesterdaysMuffins,代码行数:31,代码来源:SplitStreetViewPanoramaAndMapDemoActivity.cs
示例7: UpdateEvents
public void UpdateEvents()
{
AddEventMarkers ();
foreach (Event eve in TowManager.Get(1)) {
LatLng latln = new LatLng (eve.Location.Lat, eve.Location.Lng);
map.MoveCamera (CameraUpdateFactory.NewLatLngZoom (latln, 15));
}
}
开发者ID:rockyhe,项目名称:MojioTowingAlert,代码行数:8,代码来源:MainMenuActivity.cs
示例8: 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
示例9: CreateMarker
private void CreateMarker()
{
var latLng = new LatLng(55.816887, 12.532878);
var markerOptions = new MarkerOptions()
.SetPosition(latLng)
.Draggable(true);
_meMarker = _map.AddMarker(markerOptions);
_map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(latLng, 13));
}
开发者ID:Cheesebaron,项目名称:AppCompatAndMaps,代码行数:10,代码来源:LocationFragment.cs
示例10: ChangeRegionInMap
public void ChangeRegionInMap(pcl.Marker marker)
{
if (marker != null) {
LatLng location = new LatLng(marker.Coordinate.Latitude, marker.Coordinate.Longitude);
CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
builder.Target(location);
builder.Zoom(MAP_VIEW_ZOOM_INIT);
CameraPosition cameraPosition = builder.Build();
this.cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
this.map.MoveCamera (this.cameraUpdate);
}
}
开发者ID:rubixware,项目名称:blist-mobile,代码行数:12,代码来源:MapActivity.cs
示例11: SetupMap
public void SetupMap ()
{
GoogleMap map = (FragmentManager.FindFragmentById<MapFragment> (Resource.Id.map)).Map;
double lat = Intent.GetDoubleExtra ("lat", 37.6329946);
double lng = Intent.GetDoubleExtra ("lng", -122.4938344);
float zoom = Intent.GetFloatExtra ("zoom", 15.0f);
var position = new LatLng (lat, lng);
map.MoveCamera (CameraUpdateFactory.NewLatLngZoom (position, zoom));
map.AddMarker (new MarkerOptions ().SetPosition (position));
}
开发者ID:GTmAster,项目名称:monodroid-samples,代码行数:12,代码来源:DetailActivity.cs
示例12: SetViewPoint
public void SetViewPoint(LatLng latlng, bool animated)
{
CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
builder.Target(latlng);
builder.Zoom(14.5F);
CameraPosition cameraPosition = builder.Build();
if (animated) {
_map.AnimateCamera (CameraUpdateFactory.NewCameraPosition (cameraPosition));
} else {
_map.MoveCamera (CameraUpdateFactory.NewCameraPosition (cameraPosition));
}
}
开发者ID:Zve,项目名称:MapsUtilityDemo,代码行数:13,代码来源:MainActivity.cs
示例13: OnMapLongClick
public void OnMapLongClick (LatLng mkr)
{
if (mMap != null)
{
mMap.AddMarker (new MarkerOptions ()
.SetPosition (mkr)
.SetTitle (NumMarker.ToString ())
.SetSnippet ("Marcador " + NumMarker.ToString ())
.Draggable (true));
NumMarker++;
}
}
开发者ID:DiLRandI,项目名称:Xamarin.android,代码行数:13,代码来源:MainActivity.cs
示例14: OnMapReady
public void OnMapReady(GoogleMap googleMap)
{
mMap = googleMap;
LatLng latlng = new LatLng(loc.Latitude, loc.Longitude); //Wijnhaven
CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(latlng, 15);
mMap.MoveCamera(camera);
MarkerOptions start = new MarkerOptions()
.SetPosition(latlng)
.SetTitle("Uw huidige locatie")
.SetSnippet("U bevind zich hier")
.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue));
mMap.AddMarker(start);
MarkerFactory mFactory = new MarkerFactory(preLoad.csvFT.getMarkers());
float lowest = 99999;
for (Iterator iter = mFactory.getIterator(); iter.hasNext();)
{
FietsTrommel ft = iter.next();
if (ft.xcoord.Length > 0 && ft.ycoord.Length > 0)
{
double lat = Convert.ToDouble(ft.xcoord.Replace('.', ','));
double lon = Convert.ToDouble(ft.ycoord.Replace('.', ','));
Location fietsT = new Location("");
fietsT.Latitude = lat;
fietsT.Longitude = lon;
if (fietsT.DistanceTo(loc) < 500)
{
LatLng coords = new LatLng(lat, lon);
MarkerOptions newMarker = new MarkerOptions()
.SetPosition(coords)
.SetTitle(ft.Straat)
.SetSnippet("Sinds: " + ft.Mutdatum)
.Draggable(true);
mMap.AddMarker(newMarker);
}
if (fietsT.DistanceTo(loc) < lowest)
{
lowest = fietsT.DistanceTo(loc);
closest = ft;
}
}
}
Location closestF = new Location("");
double closLat = Convert.ToDouble(closest.xcoord.Replace('.', ','));
double closLon = Convert.ToDouble(closest.ycoord.Replace('.', ','));
closestF.Latitude = closLat;
closestF.Longitude = closLon;
}
开发者ID:Reinierr,项目名称:Project4,代码行数:50,代码来源:gmaps.cs
示例15: OnElementChanged
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.View> e)
{
base.OnElementChanged(e);
extendedMap = (ExtendedMap)Element;
mapView = Control as MapView;
map = mapView.Map;
map.MarkerClick+= HandleMarkerClick;
// Pin tıklanınca sağalta açılan menüyü engellemek için
map.UiSettings.MapToolbarEnabled = true;
map.UiSettings.MyLocationButtonEnabled = true;
if (extendedMap.isOverlayNeeded) {
LatLng southwest = new LatLng (extendedMap.sw.Latitude, extendedMap.sw.Longitude);
LatLng northeast = new LatLng (extendedMap.ne.Latitude, extendedMap.ne.Longitude);
LatLngBounds bounds = new LatLngBounds (southwest, northeast);
string url = extendedMap.overlayURL;//"http://www.mgm.gov.tr/mobile/mblhrt/data/radar/MAX--_6100_P00.png";
Bitmap objBitmap = GetImageBitmapFromUrl (url);
BitmapDescriptor objBitmapDescriptor = BitmapDescriptorFactory.FromBitmap (objBitmap);
GroundOverlayOptions objGroundOverlayOptions = new GroundOverlayOptions ().PositionFromBounds (bounds)/*.Position (objMapPosition, 100000)*/.InvokeImage (objBitmapDescriptor);
map.AddGroundOverlay (objGroundOverlayOptions);
//For freeing memory
objBitmap.Recycle ();
}
for (int i = 0; i < extendedMap.pinDatas.Count; i++) {
var markerWithIcon = new MarkerOptions ();
markerWithIcon.SetPosition (new LatLng (extendedMap.pinDatas[i].lat, extendedMap.pinDatas[i].lng));
markerWithIcon.SetTitle (i.ToString());
/*markerWithIcon.SetTitle ("aa");
markerWithIcon.SetSnippet ("bb");*/
int resID = Resources.GetIdentifier (extendedMap.pinDatas [i].icon, "drawable" , "com.app1001.bluemart");
//System.Diagnostics.Debug.WriteLine (resID);
markerWithIcon.SetIcon(BitmapDescriptorFactory.FromResource(resID));
map.AddMarker (markerWithIcon);
}
//Add Pins
//map.SetInfoWindowAdapter(this);
map.UiSettings.RotateGesturesEnabled = false;
}
开发者ID:jiletx,项目名称:Bluemart,代码行数:50,代码来源:ExtendedMapRenderer.cs
示例16: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.dashboard_listview_detail);
progress = new ProgressDialog (this);
lat = 37.09035962;
lan = -95.71368456;
flag = FindViewById<ImageView> (Resource.Id.ivNew1);
flag.Click += Flag_Click;
ivListEmpty = FindViewById<LinearLayout> (Resource.Id.ivEmptylist);
lvlist = FindViewById<ListView> (Resource.Id.lvListDetail);
llMap = FindViewById<RelativeLayout> (Resource.Id.llmap);
tvnumber = FindViewById<TextView> (Resource.Id.tvNumber);
tvdesc = FindViewById<TextView> (Resource.Id.tvdesc);
tvtime = FindViewById<TextView> (Resource.Id.tvTime);
tvreply = FindViewById<TextView> (Resource.Id.tvReply);
ListSipp = new List<SippReplyModel> ();
Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Light.ttf");
Typeface tf1 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Semibold.ttf");
Typeface tf2 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Bold.ttf");
adapter = new CustomListViewDetail (this, ListSipp);
lvlist.Adapter = adapter;
if (adapter.IsEmpty) {
ivListEmpty.Visibility = ViewStates.Visible;
} else {
ivListEmpty.Visibility = ViewStates.Gone;
}
mapFrag = (MapFragment)FragmentManager.FindFragmentById (Resource.Id.map);
map = mapFrag.Map;
map.UiSettings.CompassEnabled = true;
map.UiSettings.ZoomControlsEnabled = false;
map.MyLocationEnabled = false;
LatLng lastLatLng = new LatLng (lat, lan);
map.MoveCamera (CameraUpdateFactory.NewLatLngZoom (lastLatLng, 15));
MarkerOptions marker = new MarkerOptions ();
marker.SetPosition (new LatLng (lat, lan));
map.AddMarker (marker);
llMap.Background.SetAlpha (200);
llMap.Click += LlMap_Click;
tvnumber.SetTypeface (tf, TypefaceStyle.Normal);
tvnumber.SetTypeface (tf2, TypefaceStyle.Normal);
tvtime.SetTypeface (tf1, TypefaceStyle.Normal);
tvreply.SetTypeface (tf1, TypefaceStyle.Normal);
}
开发者ID:ppkdo,项目名称:sipper,代码行数:49,代码来源:DashBoardListViewDetail.cs
示例17: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.map_activity);
lat = Intent.GetDoubleExtra ("lat", 0);
lan = Intent.GetDoubleExtra ("lan", 0);
mapFrag = (MapFragment)FragmentManager.FindFragmentById (Resource.Id.map);
map = mapFrag.Map;
map.UiSettings.CompassEnabled = true;
map.UiSettings.ZoomControlsEnabled = true;
LatLng lastLatLng = new LatLng (lat, lan);
map.MoveCamera (CameraUpdateFactory.NewLatLngZoom (lastLatLng, 15));
MarkerOptions marker = new MarkerOptions ();
marker.SetPosition (new LatLng (lat, lan));
map.AddMarker (marker);
}
开发者ID:ppkdo,项目名称:sipper,代码行数:16,代码来源:MapActivity.cs
示例18: adddatatomap
public void adddatatomap()
{
LatLng loc0=new LatLng(-37.773250,175.250250);
MarkerOptions opt0 = new MarkerOptions() //no semicolon
.SetPosition(loc0)
.SetRotation(45)
.SetAlpha(.5f)
.Draggable(true)
.SetTitle("In the waikato")
.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.Icon))
.SetSnippet("The presence of this actually creates an infowindow"); // which is why the other marker does not have one
map.AddMarker(opt0);
MarkerOptions opt1 = new MarkerOptions();
double lat = Convert.ToDouble(Intent.GetStringExtra("Latitude"));
double lng = Convert.ToDouble(Intent.GetStringExtra("Longitude"));
string address = Intent.GetStringExtra("Address");
LatLng location = new LatLng(lat, lng);
opt1.SetPosition(location);
opt1.SetTitle(address);
map.AddMarker(opt1);
// Positioning the camera to show the marker
CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
builder.Target(location);
builder.Zoom(15);
builder.Bearing(90);
builder.Tilt(65);
CameraPosition cameraPosition = builder.Build();
CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
map.MoveCamera(cameraUpdate);
//marker window clicked event
map.InfoWindowClick += map_InfoWindowClick;
//marker dragged event
map.MarkerDragEnd += map_MarkerDragEnd;
// map.SetInfoWindowAdapter(this);
// map.SetOnInfoWindowClickListener(this); //- implements the interface IOnInfoWindowclickListener
}
开发者ID:stowjam,项目名称:WeatherApiAssignment,代码行数:46,代码来源:MapActivity.cs
示例19: OnAttached
protected override void OnAttached()
{
var mapView = Control as MapView;
if(mapView == null)
return;
behavior = (MapExtensionBehavior) (Element as Map)?.Behaviors?.FirstOrDefault(x =>
x is MapExtensionBehavior);
if(behavior == null)
return;
var zoomButton = mapView.FindViewById(1); // ズームボタン LinearLayout
if(zoomButton != null)
{
zoomButton.Visibility = Android.Views.ViewStates.Invisible;
}
var locationButton = mapView.FindViewById(2); // 現在位置ボタン ImageView
if(locationButton != null)
{
locationButton.Visibility = Android.Views.ViewStates.Invisible;
}
var callback = new OnMapReadyCallback();
callback.MapReady += (sender, e) => {
googleMap = callback.GoogleMap;
googleMap.MyLocationChange += GoogleMap_MyLocationChange;
// なぜかCameraChangeにハンドラを追加するとXF.Maps.Map.VisibleRegionが更新されなくなる
// googleMap.CameraChange += GoogleMap_CameraChange;
var point = new LatLng(
XFAedSearch.Droid.Helpers.Settings.Latitude,
XFAedSearch.Droid.Helpers.Settings.Longitude);
googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(point,
XFAedSearch.Droid.Helpers.Settings.ZoomLevel));
googleMap.SetOnMapLoadedCallback(new MapLoadedCallback {
OnMapLoadedAction = () => MapLoaded?.Invoke(this, new EventArgs())
});
};
mapView.GetMapAsync(callback);
}
开发者ID:P3PPP,项目名称:XFAedSearch,代码行数:45,代码来源:MapEffect.cs
示例20: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.panorama);
var lat = Intent.GetDoubleExtra ("lat", 37.7977);
var lng = Intent.GetDoubleExtra ("lng", -122.40);
latlng = new LatLng (lat, lng);
streetViewPanoramaView = FindViewById<StreetViewPanoramaView> (Resource.Id.panorama);
streetViewPanoramaView.OnCreate (bundle);
streetViewPanoramaView.GetStreetViewPanoramaAsync (this);
#if !DEBUG
Xamarin.Insights.Track ("AppNav", new Dictionary<string,string> {
{ "page", "panorama" }
});
#endif
}
开发者ID:RobGibbens,项目名称:Coffee-Filter,代码行数:18,代码来源:PanoramaActivity.cs
注:本文中的Android.Gms.Maps.Model.LatLng类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论