Beispiel #1
0
        public WmsCapabilities(XDocument doc)
            : this()
        {
            if (doc.Root.Name == "ServiceExceptionReport")
            {
                ServiceExceptionReport = new ServiceExceptionReport(doc.Root, "");
                return;
            }

            var node = doc.Element(XName.Get("WMT_MS_Capabilities"));

            if (node == null)
            {
                node = doc.Element(XName.Get("WMS_Capabilities"));
            }

            var att = node.Attribute(XName.Get("version"));

            if (att == null)
            {
                throw WmsParsingException.AttributeNotFound("version");
            }
            Version = new WmsVersion(att.Value);

            att = node.Attribute("updateSequence");
            if (att != null)
            {
                UpdateSequence = int.Parse(att.Value, NumberFormatInfo.InvariantInfo);
            }

            var @namespace = Version.Version == WmsVersionEnum.Version_1_3_0
                            ? "http://www.opengis.net/wms"
                            : string.Empty;

            XmlObject.Namespace = @namespace;

            var element = node.Element(XName.Get("Service", @namespace));

            if (element == null)
            {
                XmlObject.Namespace = @namespace = string.Empty;
                element             = node.Element(XName.Get("Service", @namespace));
            }
            if (element == null)
            {
                throw WmsParsingException.ElementNotFound("Service");
            }

            Service = new Service(element, @namespace);

            element = node.Element(XName.Get("Capability", @namespace));

            if (element == null)
            {
                throw WmsParsingException.ElementNotFound("Capability");
            }

            Capability = new Capability(element, @namespace);
        }
Beispiel #2
0
        public WmsCapabilities(XDocument doc)
            : this()
        {
            if (doc.Root.Name == "ServiceExceptionReport")
            {
                ServiceExceptionReport = new ServiceExceptionReport(doc.Root, "");
                return;
            }

            var node = doc.Element(XName.Get("WMT_MS_Capabilities"));
            if (node == null) node = doc.Element(XName.Get("WMS_Capabilities"));

            var att = node.Attribute(XName.Get("version"));
            if (att == null)
                throw WmsParsingException.AttributeNotFound("version");
            Version = new WmsVersion(att.Value);

            att = node.Attribute("updateSequence");
            if (att != null)
                UpdateSequence = int.Parse(att.Value, NumberFormatInfo.InvariantInfo);

            var @namespace = Version.Version == WmsVersionEnum.Version_1_3_0
                            ? "http://www.opengis.net/wms"
                            : string.Empty;

            XmlObject.Namespace = @namespace;

            var element = node.Element(XName.Get("Service", @namespace));
            if (element == null)
            {
                XmlObject.Namespace = @namespace = string.Empty;
                element = node.Element(XName.Get("Service", @namespace));
            }
            if (element == null)
                throw WmsParsingException.ElementNotFound("Service");

            Service = new Service(element, @namespace);

            element = node.Element(XName.Get("Capability", @namespace));

            if (element == null)
                throw WmsParsingException.ElementNotFound("Capability");

            Capability = new Capability(element, @namespace);
        }
Beispiel #3
0
 public WmsCapabilities(WmsVersionEnum version)
 {
     Version = new WmsVersion(version);
 }
Beispiel #4
0
 public WmsCapabilities(string version)
 {
     Version = new WmsVersion(version);
 }
Beispiel #5
0
 public WmsCapabilities(WmsVersionEnum version)
 {
     Version = new WmsVersion(version);
 }
Beispiel #6
0
 public WmsCapabilities(string version)
 {
     Version = new WmsVersion(version);
 }