/// <summary>${mapping_GetWMTSCapabilities_method_ParseCapabilities_D}</summary> public virtual GetWMTSCapabilitiesResult ParseCapabilities(XDocument document) { GetWMTSCapabilitiesResult result = new GetWMTSCapabilitiesResult(); if (document != null && document.Root != null) { string nsName = document.Root.Name.NamespaceName; XNamespace ns = document.Root.Name.Namespace; XAttribute versionAttr = document.Root.Attribute("version"); if (versionAttr != null) { result.Version = versionAttr.Value; } foreach (var layer in (from xmlLayer in document.Descendants(XName.Get("Layer", nsName)) select new WMTSLayerInfo { Name = xmlLayer.Element(((XElement)xmlLayer.FirstNode).Name.Namespace + "Identifier") == null ? string.Empty : xmlLayer.Element(((XElement)xmlLayer.FirstNode).Name.Namespace + "Identifier").Value, ////哪个值是有效的?Bounds值并不是WGS84BoundingBox值 //Bounds = GetBounds(xmlLayer.Element(((XElement)xmlLayer.FirstNode).Name.Namespace + "WGS84BoundingBox")), ImageFormat = GetSupportFormats(xmlLayer.Elements(XName.Get("Format", nsName)).ToList()), Style = GetSupportStyle(xmlLayer.Elements(XName.Get("Style", nsName)).ToList()), TileMatrixSetLinks = GetSupportLinks(xmlLayer.Elements(XName.Get("TileMatrixSetLink", nsName)).ToList()) })) { result.LayerInfos.Add(layer); }; foreach (var tileMatrixSet in (from xmlTileMatrixSet in document.Root.Element(XName.Get("Contents", nsName)).Elements(XName.Get("TileMatrixSet", nsName)) select new WMTSTileMatrixSetInfo { Name = xmlTileMatrixSet.Element(((XElement)xmlTileMatrixSet.FirstNode).Name.Namespace + "Identifier") == null ? string.Empty : xmlTileMatrixSet.Element(((XElement)xmlTileMatrixSet.FirstNode).Name.Namespace + "Identifier").Value, WellKnownScaleSet = xmlTileMatrixSet.Element(XName.Get("WellKnownScaleSet", nsName)) == null ? string.Empty : xmlTileMatrixSet.Element(XName.Get("WellKnownScaleSet", nsName)).Value, SupportedCRS = GetCRS(xmlTileMatrixSet.Element(((XElement)xmlTileMatrixSet.FirstNode).Name.Namespace + "SupportedCRS")), //获取级数 TileMatrixs = (from xmlTileMatrix in xmlTileMatrixSet.Elements(XName.Get("TileMatrix", nsName)) select new TileMatrix { Name = xmlTileMatrix.Element(((XElement)xmlTileMatrix.FirstNode).Name.Namespace + "Identifier").Value, ScaleDenominator = double.Parse(xmlTileMatrix.Element(XName.Get("ScaleDenominator", nsName)).Value, CultureInfo.InvariantCulture), MatrixWidth = int.Parse(xmlTileMatrix.Element(XName.Get("MatrixWidth", nsName)).Value, CultureInfo.InvariantCulture), TileWidth = int.Parse(xmlTileMatrix.Element(XName.Get("TileWidth", nsName)).Value, CultureInfo.InvariantCulture), MatrixHeight = int.Parse(xmlTileMatrix.Element(XName.Get("MatrixHeight", nsName)).Value, CultureInfo.InvariantCulture), TileHeight = int.Parse(xmlTileMatrix.Element(XName.Get("TileHeight", nsName)).Value, CultureInfo.InvariantCulture), }).ToList(), })) { result.WMTSTileMatrixSetInfo.Add(tileMatrixSet); }; } return result; }
/// <summary>${mapping_GetWMTSCapabilities_Event_GetCapabilitiesComplated_D}</summary> protected void OnGetCapabilitiesComplated(GetWMTSCapabilitiesResult arg, string originResult, object userState) { if (ProcessCompleted != null) { ProcessCompleted(this, new ResultEventArgs<GetWMTSCapabilitiesResult>(arg, originResult, userState)); } }