Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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>();
        }
Ejemplo n.º 3
0
 /// <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));
 }
Ejemplo n.º 4
0
 /// <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));
 }
Ejemplo n.º 5
0
        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;
        }