public Dictionary <string, ILegendItemStyle> GetLegendItemStyles() { Dictionary <string, ILegendItemStyle> legendItemStyles = new Dictionary <string, ILegendItemStyle>(); List <string> layerNames = new List <string>() { "fkb_ABCD" }; XmlDocument xmlDocument = GetStyleXml(layerNames); XmlNamespaceManager ns = new XmlNamespaceManager(xmlDocument.NameTable); ns.AddNamespace("ns", "http://www.opengis.net/sld"); XmlNodeList names = xmlDocument.SelectNodes("//ns:Rule/ns:Name", ns); foreach (XmlNode name in names) { LegendItemStyle layerStyle = new LegendItemStyle(); layerStyle.FillColor = name.ParentNode.SelectSingleNode("descendant::*[@name='fill']").InnerText; layerStyle.StrokeColor = name.ParentNode.SelectSingleNode("descendant::*[@name='stroke']").InnerText; layerStyle.FillOpacity = _FillOpacity; layerStyle.StrokeWidth = _StrokeWidth; legendItemStyles.Add(name.InnerText, layerStyle); } return(legendItemStyles); }
public Dictionary <string, ILegendItemStyle> GetLegendItemStyles(List <ITransactionData> transactionData) { Dictionary <string, ILegendItemStyle> legendItemStyles = new Dictionary <string, ILegendItemStyle>(); List <string> layerNames = new List <string>(); transactionData.ForEach(td => layerNames.Add($"{_dataSetToLayerMap[td.DataSetName]}_N1")); XmlDocument xmlDocument = GetStyleXml(layerNames); XmlNodeList fillStyles = xmlDocument.GetElementsByTagName("Fill"); XmlNodeList strokeStyles = xmlDocument.GetElementsByTagName("Stroke"); for (int i = 0; i < transactionData.Count; ++i) { LegendItemStyle layerStyle = new LegendItemStyle(); layerStyle.FillColor = fillStyles[i].SelectSingleNode("*[@name='fill']").InnerText; layerStyle.FillOpacity = fillStyles[i].SelectSingleNode("*[@name='fill-opacity']").InnerText; layerStyle.StrokeColor = strokeStyles[i].SelectSingleNode("*[@name='stroke']").InnerText; layerStyle.StrokeWidth = strokeStyles[i].SelectSingleNode("*[@name='stroke-width']").InnerText; legendItemStyles.Add(transactionData[i].DataSetName, layerStyle); } return(legendItemStyles); }