void AddPolyline2() { var existingPOIItemStart = mMapView.FindPOIItemByTag(10001); if (existingPOIItemStart != null) { mMapView.RemovePOIItem(existingPOIItemStart); } var existingPOIItemEnd = mMapView.FindPOIItemByTag(10002); if (existingPOIItemEnd != null) { mMapView.RemovePOIItem(existingPOIItemEnd); } var existingPolyline = mMapView.FindPolylineByTag(2000); if (existingPolyline != null) { mMapView.RemovePolyline(existingPolyline); } var poiItemStart = new MapPOIItem(); poiItemStart.ItemName = "Start"; poiItemStart.Tag = 10001; poiItemStart.MapPoint = MapPoint.MapPointWithWCONGCoord(475334.0, 1101210.0); poiItemStart.POIItemMarkerType = MarkerType.CustomImage; poiItemStart.AnimationType = ShowAnimationType.SpringFromGround; poiItemStart.ShowCalloutBalloonOnTouch = false; poiItemStart.CustomImageResourceId = Resource.Drawable.custom_poi_marker_start; poiItemStart.CustomImageAnchorPointOffset = new ImageOffset(29, 2); mMapView.AddPOIItem(poiItemStart); var poiItemEnd = new MapPOIItem(); poiItemEnd.ItemName = "End"; poiItemEnd.Tag = 10001; poiItemEnd.MapPoint = MapPoint.MapPointWithWCONGCoord(485016.0, 1118034.0); poiItemEnd.POIItemMarkerType = MarkerType.CustomImage; poiItemEnd.AnimationType = ShowAnimationType.SpringFromGround; poiItemEnd.ShowCalloutBalloonOnTouch = false; poiItemEnd.CustomImageResourceId = Resource.Drawable.custom_poi_marker_end; poiItemEnd.CustomImageAnchorPointOffset = new ImageOffset(29, 2); mMapView.AddPOIItem(poiItemEnd); var polyline2 = new MapPolyline(21); polyline2.Tag = 2000; polyline2.LineColor = Color.Argb(128, 0, 0, 255); polyline2.AddPoints(mPolyline2Points); mMapView.AddPolyline(polyline2); var mapPointBounds = new MapPointBounds(mPolyline2Points); int padding = 200; // px mMapView.MoveCamera(CameraUpdateFactory.NewMapPointBounds(mapPointBounds, padding)); }
void OnMapViewInitialized(object sender, MapViewInitializedEventArgs e) { var poiItem1 = new MapPOIItem(); poiItem1.ItemName = "POI1"; poiItem1.MapPoint = MAP_POINT_POI1; poiItem1.POIItemMarkerType = MarkerType.BluePin; mapView.AddPOIItem(poiItem1); var poiItem2 = new MapPOIItem(); poiItem2.ItemName = "POI2"; poiItem2.MapPoint = MAP_POINT_POI2; poiItem2.POIItemMarkerType = MarkerType.YellowPin; mapView.AddPOIItem(poiItem2); }
void CreateDefaultMarker(MapView mapView) { mDefaultMarker = new MapPOIItem(); var name = "Default Marker"; mDefaultMarker.ItemName = name; mDefaultMarker.Tag = 0; mDefaultMarker.MapPoint = DEFAULT_MARKER_POINT; mDefaultMarker.POIItemMarkerType = MarkerType.BluePin; mDefaultMarker.SelectedMarkerType = MarkerType.RedPin; mapView.AddPOIItem(mDefaultMarker); mapView.SelectPOIItem(mDefaultMarker, true); mapView.SetMapCenterPoint(DEFAULT_MARKER_POINT, false); }
void CreateCustomMarker(MapView mapView) { mCustomMarker = new MapPOIItem(); var name = "Custom Marker"; mCustomMarker.ItemName = name; mCustomMarker.Tag = 1; mCustomMarker.MapPoint = CUSTOM_MARKER_POINT; mCustomMarker.POIItemMarkerType = MarkerType.CustomImage; mCustomMarker.CustomImageResourceId = Resource.Drawable.custom_marker_red; mCustomMarker.CustomImageAutoscale = false; mCustomMarker.SetCustomImageAnchor(0.5f, 1.0f); mapView.AddPOIItem(mCustomMarker); mapView.SelectPOIItem(mCustomMarker, true); mapView.SetMapCenterPoint(CUSTOM_MARKER_POINT, false); }
void CreateCustomBitmapMarker(MapView mapView) { mCustomBmMarker = new MapPOIItem(); var name = "Custom Bitmap Marker"; mCustomBmMarker.ItemName = name; mCustomBmMarker.Tag = 2; mCustomBmMarker.MapPoint = CUSTOM_MARKER_POINT2; mCustomBmMarker.POIItemMarkerType = MarkerType.CustomImage; Bitmap bm = BitmapFactory.DecodeResource(Resources, Resource.Drawable.custom_marker_star); mCustomBmMarker.CustomImageBitmap = bm; mCustomBmMarker.CustomImageAutoscale = false; mCustomBmMarker.SetCustomImageAnchor(0.5f, 0.5f); mapView.AddPOIItem(mCustomBmMarker); mapView.SelectPOIItem(mCustomBmMarker, true); mapView.SetMapCenterPoint(CUSTOM_MARKER_POINT, false); }