protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // hide title bar. this.RequestWindowFeature(global::Android.Views.WindowFeatures.NoTitle); // initialize map. var map = new Map(); // add tile Layer. // WARNING: Always look at usage policies! // WARNING: Don't use my tiles, it's a free account and will shutdown when overused! map.AddLayer(new LayerTile("http://a.tiles.mapbox.com/v3/osmsharp.i8ckml0l/{0}/{1}/{2}.png", 160)); // define the mapview. var mapViewSurface = new MapViewSurface(this); mapViewSurface.MapScaleFactor = 2; _mapView = new MapView(this, mapViewSurface); _mapView.Map = map; _mapView.MapMaxZoomLevel = 18; // limit min/max zoom because MBTiles sample only contains a small portion of a map. _mapView.MapMinZoomLevel = 0; _mapView.MapTilt = 0; _mapView.MapCenter = new GeoCoordinate(21.38, -157.782); _mapView.MapZoom = 12; _mapView.MapAllowTilt = false; // set the map view as the default content view. SetContentView(_mapView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.RequestWindowFeature(global::Android.Views.WindowFeatures.NoTitle); var map = new Map(); map.AddLayer( new LayerMBTile( SQLiteConnection.CreateFrom( Assembly.GetExecutingAssembly() .GetManifestResourceStream(@"LainLadangLainBelalang.kempen.mbtiles"), "map"))); var mvs = new MapViewSurface(this); _mv = new MapView(this, mvs) { Map = map, MapMaxZoomLevel = 17, MapMinZoomLevel = 12, MapTilt = 0, MapCenter = new GeoCoordinate(51.26361, 4.78620), MapZoom = 16, MapAllowTilt = false }; SetContentView(_mv); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // hide title bar. this.RequestWindowFeature(global::Android.Views.WindowFeatures.NoTitle); // initialize map. var map = new Map(); // add MBTiles Layer. // any stream will do or any path on the device to a MBTiles SQLite databas // in this case the data is taken from the resource stream, written to disk and then opened. map.AddLayer(new LayerMBTile(SQLiteConnection.CreateFrom( Assembly.GetExecutingAssembly().GetManifestResourceStream(@"Android.Demo.kempen.mbtiles"), "map"))); // define the mapview. var mapViewSurface = new MapViewSurface(this); mapViewSurface.MapScaleFactor = 2; _mapView = new MapView(this, mapViewSurface); _mapView.Map = map; _mapView.MapMaxZoomLevel = 17; // limit min/max zoom because MBTiles sample only contains a small portion of a map. _mapView.MapMinZoomLevel = 12; _mapView.MapTilt = 0; _mapView.MapCenter = new GeoCoordinate(51.26361, 4.78620); _mapView.MapZoom = 16; _mapView.MapAllowTilt = false; // set the map view as the default content view. SetContentView(_mapView); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // hide title bar. this.RequestWindowFeature(global::Android.Views.WindowFeatures.NoTitle); // initialize map. var map = new Map(); // add a preprocessed vector data file. var sceneStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"Android.Demo.default.map"); map.AddLayer(new LayerScene(Scene2D.Deserialize(sceneStream, true))); // define the mapview. var mapViewSurface = new MapViewSurface(this); mapViewSurface.MapScaleFactor = 2; _mapView = new MapView(this, mapViewSurface); _mapView.Map = map; _mapView.MapMaxZoomLevel = 17; // limit min/max zoom, the vector data in this sample covers only a small area. _mapView.MapMinZoomLevel = 12; _mapView.MapTilt = 0; _mapView.MapCenter = new GeoCoordinate(51.26361, 4.78620); _mapView.MapZoom = 16; _mapView.MapAllowTilt = false; // set the map view as the default content view. SetContentView(_mapView); }
/// <summary> /// Initialize this instance. /// </summary> private void Initialize() { _mapView = new MapViewSurface(this.Context, this); _mapView.MapTapEvent += delegate(GeoCoordinate geoCoordinate) { if (this.MapTapEvent != null) { this.MapTapEvent(geoCoordinate); } }; this.AddView(_mapView); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // hide title bar. this.RequestWindowFeature(global::Android.Views.WindowFeatures.NoTitle); // initialize map. var map = new Map(); // add a preprocessed vector data file. //var sceneStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"Android.Demo.default.map"); //map.AddLayer(new LayerScene(Scene2D.Deserialize(sceneStream, true))); //OsmSharp.Osm.Data.Memory.MemoryDataSource dataSource; //using (var sceneStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"Android.Demo.map1.osm")) //{ // dataSource = OsmSharp.Osm.Data.Memory.MemoryDataSource.CreateFromXmlStream(sceneStream); //} string path = Assembly.GetExecutingAssembly().GetName().Name; StreamReader streamReader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(path + ".EmbeddedResources.default.mapcss")); string test = streamReader.ReadToEnd(); StyleInterpreter styleInterpreter = new OsmSharp.UI.Map.Styles.MapCSS.MapCSSInterpreter(test); map.AddLayerOsm(OsmSharp.Osm.Data.Memory.MemoryDataSource.CreateFromXmlStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(path + ".EmbeddedResources.map.osm")), styleInterpreter); //var r2d = new CanvasRenderer2D(); //var renderer = new OsmSharp.UI.Map.MapRenderer<Canvas>(r2d); //var view = OsmSharp.UI.Renderer.View2D.CreateFromBounds(dataSource.BoundingBox.TopLeft.Latitude, dataSource.BoundingBox.TopLeft.Longitude, // dataSource.BoundingBox.BottomRight.Latitude, dataSource.BoundingBox.BottomRight.Longitude); //map.ViewChanged(16, new OsmSharp.Math.Geo.GeoCoordinate(view.Center), null, view); // define the mapview. var mapViewSurface = new MapViewSurface(this); mapViewSurface.MapScaleFactor = 2; _mapView = new MapView(this, mapViewSurface); _mapView.Map = map; _mapView.MapMaxZoomLevel = 17; // limit min/max zoom, the vector data in this sample covers only a small area. _mapView.MapMinZoomLevel = 12; _mapView.MapTilt = 0; //_mapView.MapCenter = new GeoCoordinate(51.26361, 4.78620); _mapView.MapCenter = new GeoCoordinate(30.538079, 114.4159972); _mapView.MapZoom = 16; _mapView.MapAllowTilt = false; // set the map view as the default content view. SetContentView(_mapView); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // enable the logging. OsmSharp.Logging.Log.Enable(); OsmSharp.Logging.Log.RegisterListener(new OsmSharp.Android.UI.Log.LogTraceListener()); // hide title bar. this.RequestWindowFeature(global::Android.Views.WindowFeatures.NoTitle); // initialize OsmSharp native handlers. Native.Initialize(); // initialize router. RouterFacade.Initialize(); // initialize map. var map = new Map(); // add tile Layer. // WARNING: Always look at usage policies! // WARNING: Don't use my tiles, it's a free account and will shutdown when overused! map.AddLayer(new LayerTile(@"http://otile1.mqcdn.com/tiles/1.0.0/osm/{0}/{1}/{2}.png")); // define route layer. _routeLayer = new LayerRoute(map.Projection); map.AddLayer(_routeLayer); // define the mapview. var surface = new MapViewSurface(this); _mapView = new MapView(this, surface); _mapView.Map = map; _mapView.MapMaxZoomLevel = 18; _mapView.MapMinZoomLevel = 0; _mapView.MapTilt = 0; _mapView.MapCenter = new GeoCoordinate(51.2631, 4.7872); _mapView.MapZoom = 16; _mapView.MapAllowTilt = false; _mapView.MapTapEvent += _mapView_MapTapEvent; // set the map view as the default content view. SetContentView(_mapView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.RequestWindowFeature(global::Android.Views.WindowFeatures.NoTitle); var map = new Map(); var sceneStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"LainLadangLainBelalang.default.map"); map.AddLayer(new LayerScene(Scene2D.Deserialize(sceneStream, true))); var mvs = new MapViewSurface(this); _mv = new MapView(this, mvs) { Map = map, MapMaxZoomLevel = 17, MapMinZoomLevel = 12, MapTilt = 0, MapCenter = new GeoCoordinate(51.26361, 4.78620), MapZoom = 16, MapAllowTilt = false }; SetContentView(_mv); }