ParseEnglishGetCapabilities() 공개 메소드

public ParseEnglishGetCapabilities ( System.Xml.Linq.XDocument getCapabilitiesEnglish ) : Dictionary>
getCapabilitiesEnglish System.Xml.Linq.XDocument
리턴 Dictionary>
        public WmsServiceViewModel GetLayers(string wmsUrl)
        {
            WmsServiceViewModel serviceModel = new WmsServiceViewModel();

            if (!wmsUrl.EndsWith("?"))
            {
                wmsUrl = wmsUrl + "?";
            }
            wmsUrl = wmsUrl + "service=wms&request=GetCapabilities";

            XDocument xmlDocument = XDocument.Load(wmsUrl);

            XElement root = xmlDocument.Element(WMS + "WMS_Capabilities");
            if (root != null)
            {
                WmsGetCapabilities13Parser parser = new WmsGetCapabilities13Parser();
                serviceModel = parser.Parse(xmlDocument);
                if (serviceModel.SupportsEnglishGetCapabilities)
                {
                    XDocument getCapabilitiesEnglish = XDocument.Load(wmsUrl + "&language=eng");
                    Dictionary<string, Dictionary<string, string>> englishInformation = parser.ParseEnglishGetCapabilities(getCapabilitiesEnglish);
                    serviceModel.AppendEnglishInformation(englishInformation);
                }
            }
            else
            {
                root = xmlDocument.Element("WMT_MS_Capabilities");
                if (root != null)
                {
                    serviceModel = new WmsGetCapabilities11Parser().Parse(xmlDocument);
                }
            }

            return serviceModel;
        }
예제 #2
0
        public WmsServiceViewModel GetLayers(string wmsUrl)
        {
            if (!string.IsNullOrWhiteSpace(wmsUrl))
            {
                WmsServiceViewModel serviceModel = new WmsServiceViewModel();

                XDocument xmlDocument = XDocument.Load(wmsUrl);

                XElement root = xmlDocument.Element(WMS + "WMS_Capabilities");
                if (root != null)
                {
                    WmsGetCapabilities13Parser parser = new WmsGetCapabilities13Parser();
                    serviceModel = parser.Parse(xmlDocument);
                    if (serviceModel.SupportsEnglishGetCapabilities)
                    {
                        XDocument getCapabilitiesEnglish = XDocument.Load(wmsUrl + "&language=eng");
                        Dictionary <string, Dictionary <string, string> > englishInformation = parser.ParseEnglishGetCapabilities(getCapabilitiesEnglish);
                        serviceModel.AppendEnglishInformation(englishInformation);
                    }
                }
                else
                {
                    root = xmlDocument.Element("WMT_MS_Capabilities");
                    if (root != null)
                    {
                        serviceModel = new WmsGetCapabilities11Parser().Parse(xmlDocument);
                    }
                }

                return(serviceModel);
            }
            else
            {
                return(null);
            }
        }