public void ParseCapabilities_WhenInputIsWellFormattedWms130_ShouldParseWithoutExceptions() { // arrange var capabilties = new XmlDocument {XmlResolver = null}; capabilties.Load($"{AssemblyInfo.AssemblyDirectory}\\Resources\\capabilities_1_3_0.xml"); // act var client = new Client(capabilties); // assert Assert.True(client != null); }
private WmsProvider(Client wmsClient, Func<string, Task<Stream>> getStreamAsync = null) { InitialiseGetStreamAsyncMethod(getStreamAsync); _wmsClient = wmsClient; TimeOut = 10000; ContinueOnError = true; if (OutputFormats.Contains("image/png")) _mimeType = "image/png"; else if (OutputFormats.Contains("image/gif")) _mimeType = "image/gif"; else if (OutputFormats.Contains("image/jpeg")) _mimeType = "image/jpeg"; else //None of the default formats supported - Look for the first supported output format { throw new ArgumentException( "None of the formates provided by the WMS service are supported"); } LayerList = new Collection<string>(); StylesList = new Collection<string>(); }
/// <summary> /// Recursive method for checking whether a layername exists /// </summary> /// <param name="layer"></param> /// <param name="name"></param> /// <returns></returns> private bool LayerExists(Client.WmsServerLayer layer, string name) { return name == layer.Name || layer.ChildLayers.Any(childlayer => LayerExists(childlayer, name)); }
/// <summary> /// Recursive method for checking whether a layername exists /// </summary> /// <param name="layer">layer</param> /// <param name="name">name of style</param> /// <returns>True of style exists</returns> private bool StyleExists(Client.WmsServerLayer layer, string name) { if (layer.Style.Any(style => name == style.Name)) return true; return layer.ChildLayers.Any(childlayer => StyleExists(childlayer, name)); }
private bool FindLayer(Client.WmsServerLayer layer, string name, out Client.WmsServerLayer result) { result = layer; if (name == layer.Name) { return true; } foreach (Client.WmsServerLayer childlayer in layer.ChildLayers) { if (FindLayer(childlayer, name, out result)) return true; } return false; }