本文整理汇总了C#中Android.Gms.Maps.Model.LatLng类的典型用法代码示例。如果您正苦于以下问题:C# LatLng类的具体用法?C# LatLng怎么用?C# LatLng使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LatLng类属于Android.Gms.Maps.Model命名空间,在下文中一共展示了LatLng类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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));
}
}
示例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));
}
示例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));
}
示例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);
}
}
示例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));
}
示例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));
}
}
示例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++;
}
}
示例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;
}
示例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;
}