本文整理汇总了C#中MapView.ZoomToMarkers方法的典型用法代码示例。如果您正苦于以下问题:C# MapView.ZoomToMarkers方法的具体用法?C# MapView.ZoomToMarkers怎么用?C# MapView.ZoomToMarkers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapView
的用法示例。
在下文中一共展示了MapView.ZoomToMarkers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
//.........这里部分代码省略.........
map.AddLayer(
new LayerScene(
Scene2DLayered.Deserialize(
Assembly.GetExecutingAssembly().GetManifestResourceStream(@"OsmSharp.Android.UI.Sample.wvl.map"), true)));
// var routingSerializer = new V2RoutingDataSourceLiveEdgeSerializer(true);
// var graphSerialized = routingSerializer.Deserialize(
// //Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.osm.pbf.routing.3"));
// Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.wvl.pbf.routing.4"));
////
//// var graphLayer = new LayerDynamicGraphLiveEdge(graphSerialized, mapCSSInterpreter);
//// map.AddLayer(graphLayer);
//
// // calculate route.
// Router router = Router.CreateLiveFrom(
// graphSerialized,
// new OsmRoutingInterpreter());
var routingSerializer = new OsmSharp.Routing.CH.Serialization.Sorted.CHEdgeDataDataSourceSerializer(false);
var graphDeserialized = routingSerializer.Deserialize(
Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.wvl.routing"), true);
_router = Router.CreateCHFrom(
graphDeserialized, new CHRouter(graphDeserialized),
new OsmRoutingInterpreter());
GeoCoordinate point1 = new GeoCoordinate(51.158075, 2.961545);
GeoCoordinate point2 = new GeoCoordinate(51.190503, 3.004793);
RouterPoint routerPoint1 = _router.Resolve(Vehicle.Car, point1);
RouterPoint routerPoint2 = _router.Resolve(Vehicle.Car, point2);
Route route1 = _router.Calculate(Vehicle.Car, routerPoint1, routerPoint2);
RouteTracker routeTracker = new RouteTracker(route1, new OsmRoutingInterpreter());
_enumerator = route1.GetRouteEnumerable(20).GetEnumerator();
_routeLayer = new LayerRoute(map.Projection);
_routeLayer.AddRoute (route1, SimpleColor.FromKnownColor(KnownColor.Blue).Value);
map.AddLayer(_routeLayer);
// // create gpx layer.
// LayerGpx gpxLayer = new LayerGpx(map.Projection);
// gpxLayer.AddGpx(
// Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.gpx"));
// map.AddLayer(gpxLayer);
// // set control properties.
// var mapView = new MapView(this);
// mapView.MapMaxZoomLevel = 20;
// mapView.MapMinZoomLevel = 12;
// //var mapView = new MapGLView (this);
// mapView.Map = map;
// //mapView.Center = new GeoCoordinate(51.158075, 2.961545); // gistel
// //mapView.MapCenter = new GeoCoordinate (50.88672, 3.23899);
// mapView.MapCenter = new GeoCoordinate(51.26337, 4.78739);
// //mapView.Center = new GeoCoordinate(51.156803, 2.958887);
// mapView.MapZoomLevel = 15;
// var mapView = new OpenGLRenderer2D(
// this, null);
// _mapView = new MapView<MapGLView>(this, new MapGLView(this));
_mapView = new MapView(this, new MapViewSurface(this));
//_mapView = new MapView(this, new MapViewGLSurface(this));
_mapView.Map = map;
(_mapView as IMapView).AutoInvalidate = true;
_mapView.MapMaxZoomLevel = 20;
_mapView.MapMinZoomLevel = 12;
_mapView.MapTilt = 0;
//var mapView = new MapGLView (this);
_mapView.MapCenter = new GeoCoordinate(51.158075, 2.961545); // gistel
//mapView.MapCenter = new GeoCoordinate (50.88672, 3.23899);
//mapLayout.MapCenter = new GeoCoordinate(51.26337, 4.78739);
//mapView.Center = new GeoCoordinate(51.156803, 2.958887);
_mapView.MapZoom = 17;
//MapViewAnimator mapViewAnimator = new MapViewAnimator(mapLayout);
_mapView.MapTapEvent += delegate(GeoCoordinate geoCoordinate)
{
_mapView.ZoomToMarkers();
//_mapView.AddMarker(geoCoordinate).Click += new EventHandler(MainActivity_Click);
//mapViewAnimator.Stop();
//mapViewAnimator.Start(geoCoordinate, 15, new TimeSpan(0, 0, 2));
};
//Create the user interface in code
var layout = new RelativeLayout (this);
layout.AddView(_mapView);
_mapView.AddMarker(new GeoCoordinate(51.1612, 2.9795));
_mapView.AddMarker(new GeoCoordinate(51.1447, 2.9483));
_mapView.ZoomToMarkers();
_routeTrackerAnimator = new RouteTrackerAnimator(_mapView, routeTracker, 5);
//Timer timer = new Timer(3000);
//timer.Elapsed += new ElapsedEventHandler(TimerHandler);
//timer.Start();
SetContentView (layout);
}