public SCMap AddWmsImageLayer(string serverUrl, string activeLayer, WmsImageLayerOptions options = null) { options ??= new WmsImageLayerOptions(); var provider = new WmsDataProvider() { ServerUri = serverUrl, ActiveLayerName = activeLayer, }; if (options.MaxRequestedImageWidth.HasValue) { provider.MaxRequestedImageWidth = options.MaxRequestedImageWidth.Value; } if (options.MaxRequestedImageHeight.HasValue) { provider.MaxRequestedImageHeight = options.MaxRequestedImageHeight.Value; } if (options.Parameters != null) { foreach (DictionaryEntry parameter in options.Parameters) { provider.CustomParameters.Add(Convert.ToString(parameter.Key), Convert.ToString(parameter.Value)); } } options.UpdateLayerImage(this, provider); return(this); }
public override MapImageDataProviderBase CreateMapDataProvider() { var provider = new WmsDataProvider() { ServerUri = ServerUrl, ActiveLayerName = this.ActiveLayer, }; if (MaxRequestedImageWidth.HasValue) { provider.MaxRequestedImageWidth = MaxRequestedImageWidth.Value; } if (MaxRequestedImageHeight.HasValue) { provider.MaxRequestedImageHeight = MaxRequestedImageHeight.Value; } if (Parameters != null) { foreach (DictionaryEntry parameter in Parameters) { provider.CustomParameters.Add(Convert.ToString(parameter.Key), Convert.ToString(parameter.Value)); } } return(provider); }
private void Form1_Load(object sender, EventArgs e) { ImageLayer imageLayer = new ImageLayer(); mapControl1.Layers.Add(imageLayer); WmsDataProvider provider = new WmsDataProvider(); imageLayer.DataProvider = provider; provider.ServerUri = "http://YOUR_SERVER_URI"; provider.ActiveLayerName = "ACTIVE_LAYER_NAME"; imageLayer.Error += OnError; }