本文整理汇总了C#中Android.Gms.Maps.GoogleMap.AddPolyline方法的典型用法代码示例。如果您正苦于以下问题:C# GoogleMap.AddPolyline方法的具体用法?C# GoogleMap.AddPolyline怎么用?C# GoogleMap.AddPolyline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Gms.Maps.GoogleMap
的用法示例。
在下文中一共展示了GoogleMap.AddPolyline方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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));
}
示例2: OnMapReady
public void OnMapReady (GoogleMap googleMap)
{
map = googleMap;
var polylineOptions = new PolylineOptions ();
polylineOptions.InvokeColor (0x66FF0000);
foreach (var position in routeCoordinates) {
polylineOptions.Add (new LatLng (position.Latitude, position.Longitude));
}
map.AddPolyline (polylineOptions);
}
示例3: Add
public static PolylineAdv Add(GoogleMap map, PolylineOptions op)
{
var polyline = new PolylineAdv(map, op);
var idxStart = 0;
while (idxStart < op.Points.Count)
{
using (var options = CloneOptions(op))
{
for (var i = idxStart; i < Math.Min(idxStart + PolylineSegmentLength + 1, op.Points.Count); i++)
{
options.Add(op.Points[i]);
}
polyline._polylines.Add(map.AddPolyline(options));
}
idxStart += PolylineSegmentLength;
}
return polyline;
}
示例4: 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);
});
}
}
}