public ScreenMap (ScreenController ctrl, Thing t)
		{
			this.ctrl = ctrl;
			this.engine = ctrl.Engine;
			this.thing = t;

			// OS specific details
			if (new Version (UIDevice.CurrentDevice.SystemVersion) >= new Version(7,0)) 
			{
				// Code that uses features from Xamarin.iOS 7.0
				this.EdgesForExtendedLayout = UIRectEdge.None;
			}

			// Create URLTileLayers
			osmLayer = UrlTileLayer.FromUrlConstructor (
				(uint x, uint y, uint zoom) => {
					string url = String.Format("http://a.tile.openstreetmap.org/{0}/{1}/{2}.png", zoom, x, y);
					return NSUrl.FromString(url);
				}
			); 
			osmLayer.ZIndex = 0;

			ocmLayer = UrlTileLayer.FromUrlConstructor (
				(uint x, uint y, uint zoom) => {
					string url = String.Format("http://c.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png", zoom, x, y);
					return NSUrl.FromString(url);
				}
			); 
			ocmLayer.ZIndex = 0;
		}
        public ScreenMap(ScreenController ctrl, Thing t)
        {
            this.ctrl   = ctrl;
            this.engine = ctrl.Engine;
            this.thing  = t;

            // OS specific details
            if (new Version(UIDevice.CurrentDevice.SystemVersion) >= new Version(7, 0))
            {
                // Code that uses features from Xamarin.iOS 7.0
                this.EdgesForExtendedLayout = UIRectEdge.None;
            }

            // Create URLTileLayers
            osmLayer = UrlTileLayer.FromUrlConstructor(
                (uint x, uint y, uint zoom) => {
                string url = String.Format("http://a.tile.openstreetmap.org/{0}/{1}/{2}.png", zoom, x, y);
                return(NSUrl.FromString(url));
            }
                );
            osmLayer.ZIndex = 0;

            ocmLayer = UrlTileLayer.FromUrlConstructor(
                (uint x, uint y, uint zoom) => {
                string url = String.Format("http://c.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png", zoom, x, y);
                return(NSUrl.FromString(url));
            }
                );
            ocmLayer.ZIndex = 0;
        }
Exemple #3
0
        void DidChangeSwitcher(object sender = null, EventArgs e = null)
        {
            var title         = switcher.TitleAt(switcher.SelectedSegment);
            var selectedFloor = Convert.ToInt32(title);

            if (floor != selectedFloor)
            {
                // Clear existing tileLayer, if any.
                if (tilelayer != null)
                {
                    tilelayer.Map = null;
                }

                // Create a new TileLayer with the new floor choice.
                tilelayer = UrlTileLayer.FromUrlConstructor((x, y, zoom) => {
                    var url = string.Format("http://www.gstatic.com/io2010maps/tiles/9/L{0}_{1}_{2}_{3}.png", floor, zoom, x, y);
                    return(new NSUrl(url));
                });
                tilelayer.Map = mapView;
                floor         = selectedFloor;
            }
        }