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


C# GoogleMap.AddPolyline方法代码示例

本文整理汇总了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));
        }
开发者ID:Lichwa,项目名称:JakDojadeXamarin,代码行数:35,代码来源:MapRoute.cs

示例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);
		}
开发者ID:eduardoguilarducci,项目名称:recipes,代码行数:13,代码来源:CustomMapRenderer.cs

示例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;
        }
开发者ID:gabornemeth,项目名称:XamMapz,代码行数:20,代码来源:PolylineAdv.cs

示例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);
					});
				}
			}
		}
开发者ID:305088020,项目名称:ChART,代码行数:38,代码来源:MapsFragment.cs


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