private void GeodanWmsClick(object sender, RoutedEventArgs e) { MapControl.Map.Layers.Clear(); MapControl.Map.Layers.Add(TiledWmsSample.CreateLayer()); LayerList.Initialize(MapControl.Map.Layers); MapControl.ZoomToFullEnvelope(); MapControl.Refresh(); }
private void radioButton_Click(object sender, EventArgs e) { Cursor mic = mapBox1.Cursor; mapBox1.Cursor = Cursors.WaitCursor; Cursor = Cursors.WaitCursor; try { //mapImage.ActiveTool = MapImage.Tools.None; string text = ((RadioButton)sender).Text; switch (text) { case "Shapefile": mapBox1.Map = ShapefileSample.InitializeMap(tbAngle.Value); break; case "GradientTheme": mapBox1.Map = GradiantThemeSample.InitializeMap(tbAngle.Value); break; case "WFS Client": mapBox1.Map = WfsSample.InitializeMap(tbAngle.Value); break; case "WMS Client": mapBox1.Map = TiledWmsSample.InitializeMap(); //mapBox1.Map = WmsSample.InitializeMap(tbAngle.Value); break; case "OGR - MapInfo": case "OGR - S-57": mapBox1.Map = OgrSample.InitializeMap(tbAngle.Value); break; case "GDAL - GeoTiff": case "GDAL - '.DEM'": case "GDAL - '.ASC'": case "GDAL - '.VRT'": mapBox1.Map = GdalSample.InitializeMap(tbAngle.Value); mapBox1.ActiveTool = MapBox.Tools.Pan; break; case "TileLayer - OSM": case "TileLayer - OSM with XLS": case "TileLayer - Bing Roads": case "TileLayer - Bing Aerial": case "TileLayer - Bing Hybrid": case "TileLayer - GoogleMap": case "TileLayer - GoogleSatellite": case "TileLayer - GoogleTerrain": case "TileLayer - GoogleLabels": case "Eniro": /* * tbAngle.Visible = text.Equals("TileLayer - GoogleLabels"); * if (!tbAngle.Visible) tbAngle.Value = 0; */ mapBox1.Map = TileLayerSample.InitializeMap(tbAngle.Value); ((RadioButton)sender).Text = mapBox1.Map.Layers[0].LayerName; break; case "PostGis": mapBox1.Map = PostGisSample.InitializeMap(tbAngle.Value); break; case "SpatiaLite": mapBox1.Map = SpatiaLiteSample.InitializeMap(tbAngle.Value); break; case "Oracle": mapBox1.Map = OracleSample.InitializeMap(tbAngle.Value); break; default: break; } //Add checked Map decorations foreach (ListViewItem checkedItem in lvwDecorations.CheckedItems) { Type mdType; if (MapDecorationTypes.TryGetValue(checkedItem.Text, out mdType)) { IMapDecoration md = Activator.CreateInstance(mdType) as IMapDecoration; mapBox1.Map.Decorations.Add(md); } } mapBox1.Map.Size = Size; mapBox1.Refresh(); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error"); } Cursor = Cursors.Default; mapBox1.Cursor = mic; }
private void radioButton_Click(object sender, EventArgs e) { try { Cursor mic = mapImage.Cursor; mapImage.Cursor = Cursors.WaitCursor; Cursor = Cursors.WaitCursor; //mapImage.ActiveTool = MapImage.Tools.None; string text = ((RadioButton)sender).Text; switch (text) { case "Shapefile": mapImage.Map = ShapefileSample.InitializeMap(tbAngle.Value); break; case "GradientTheme": mapImage.Map = GradiantThemeSample.InitializeMap(tbAngle.Value); break; case "WFS Client": mapImage.Map = WfsSample.InitializeMap(tbAngle.Value); break; case "WMS Client": mapImage.Map = TiledWmsSample.InitializeMap(); break; case "OGR - MapInfo": case "OGR - S-57": mapImage.Map = OgrSample.InitializeMap(tbAngle.Value); break; case "GDAL - GeoTiff": case "GDAL - '.DEM'": case "GDAL - '.ASC'": case "GDAL - '.VRT'": mapImage.Map = GdalSample.InitializeMap(tbAngle.Value); mapImage.ActiveTool = MapImage.Tools.Pan; break; case "TileLayer - OSM": case "TileLayer - OSM with XLS": case "TileLayer - Bing Roads": case "TileLayer - Bing Aerial": case "TileLayer - Bing Hybrid": case "TileLayer - GoogleMap": case "TileLayer - GoogleSatellite": case "TileLayer - GoogleTerrain": case "TileLayer - GoogleLabels": /* * tbAngle.Visible = text.Equals("TileLayer - GoogleLabels"); * if (!tbAngle.Visible) tbAngle.Value = 0; */ mapImage.Map = TileLayerSample.InitializeMap(tbAngle.Value); ((RadioButton)sender).Text = mapImage.Map.Layers[0].LayerName; break; case "PostGis": mapImage.Map = PostGisSample.InitializeMap(tbAngle.Value); break; case "SpatiaLite": mapImage.Map = SpatiaLiteSample.InitializeMap(tbAngle.Value); break; case "Oracle": mapImage.Map = OracleSample.InitializeMap(tbAngle.Value); break; default: break; } mapImage.Map.Size = Size; mapImage.Refresh(); Cursor = Cursors.Default; mapImage.Cursor = mic; } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error"); } }