public ptRender(IFeatureRenderer pFeatureRender, ILayer pLayer) { if (pLayer != null) { IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer; m_FeatureClass = pFeatureLayer.FeatureClass; m_LayerName = pFeatureLayer.Name; IDataset pds = pFeatureLayer.FeatureClass as IDataset; m_DatasetName = pds.Name; AnnotationClass = new AnnotationClass(pFeatureLayer); SymbolList = new List <ptSymbolClass>(); m_ptLayer = new ptLayer(); m_ptLayer.InitailGeneralInfo(pFeatureLayer); m_ptLayer.m_LayerRender = this; } }
public override XmlElement GetRendXmlNode(XmlDocument xmlDoc, XmlElement RootXmlElement) { try { //如果有标注,则添加标注信息 XmlElement pAnnotationElment = null; if (AnnotationClass.IsSingleProperty && !string.IsNullOrEmpty(AnnotationClass.PropertyName)) { pAnnotationElment = AnnotationClass.GetSymbolNode(xmlDoc); } //开始解析渲染符号信息 for (int i = 0; i < SymbolList.Count; i++) { XmlElement pRuleElement = default(XmlElement); ptSymbolClass pSymbolClass = SymbolList[i]; //生成Rule节点信息 pRuleElement = CommXmlHandle.CreateElement("Rule", xmlDoc); pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("RuleName", xmlDoc, string.IsNullOrEmpty(pSymbolClass.Label)?string.Format("rule{0}", i):pSymbolClass.Label)); pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("Title", xmlDoc, string.IsNullOrEmpty(pSymbolClass.Label) ? string.Format("rule{0}", i) : pSymbolClass.Label)); //设置显示比例尺 if (!double.IsNaN(m_ptLayer.m_MaxScale) && !double.IsNaN(m_ptLayer.m_MinScale)) { pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("MinScale", xmlDoc, m_ptLayer.m_MaxScale.ToString())); pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("MaxScale", xmlDoc, m_ptLayer.m_MinScale.ToString())); } //获取符号节点 IList <XmlElement> pSymbolizedNode = pSymbolClass.GetSymbolNode(xmlDoc); foreach (XmlElement pElement in pSymbolizedNode) { pRuleElement.AppendChild(pElement); } if (pAnnotationElment != null) { pRuleElement.AppendChild(pAnnotationElment.CloneNode(true)); } RootXmlElement.AppendChild(pRuleElement); } } catch (Exception ex) { ptLogManager.WriteMessage(string.Format("解析符号信息失败:{0}{1}{2}{3}", Environment.NewLine, ex.Message, Environment.NewLine, ex.StackTrace)); } return(RootXmlElement); }
public override XmlElement GetRendXmlNode(XmlDocument xmlDoc, XmlElement RootXmlElement) { try { //如果有标注,则添加标注信息 XmlElement pAnnotationElment = null; if (AnnotationClass.IsSingleProperty && !string.IsNullOrEmpty(AnnotationClass.PropertyName)) { pAnnotationElment = AnnotationClass.GetSymbolNode(xmlDoc); } //开始解析渲染符号信息 for (int i = 0; i < SymbolList.Count; i++) { XmlElement pRuleElement = default(XmlElement); ptSymbolClass pSymbolClass = SymbolList[i]; //生成Rule节点信息 pRuleElement = CommXmlHandle.CreateElement("Rule", xmlDoc); pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("RuleName", xmlDoc, pSymbolClass.Label)); pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("Title", xmlDoc, pSymbolClass.Label)); if (pSymbolClass.LowerLimit != 0.00 && pSymbolClass.UpperLimit != 0.00) { //写条件节点 XmlElement pFilterElement = CommXmlHandle.CreateElement("Filter", xmlDoc); XmlElement pBetweenElement = CommXmlHandle.CreateElement("PropertyIsBetween", xmlDoc); pFilterElement.AppendChild(pBetweenElement); XmlElement pPropertyNameElement = CommXmlHandle.CreateElementAndSetElemnetText("PropertyName", xmlDoc, this.FieldName); pBetweenElement.AppendChild(pPropertyNameElement); XmlElement pLowerBoundaryElement = CommXmlHandle.CreateElement("LowerBoundary", xmlDoc); pBetweenElement.AppendChild(pLowerBoundaryElement); XmlElement pLowerValue = CommXmlHandle.CreateElementAndSetElemnetText("", xmlDoc, CommStaticClass.CommaToPoint(pSymbolClass.LowerLimit)); pLowerBoundaryElement.AppendChild(pLowerValue); XmlElement pUpperElement = CommXmlHandle.CreateElement("UpperBoundary", xmlDoc); pBetweenElement.AppendChild(pUpperElement); XmlElement pUpperValueElement = CommXmlHandle.CreateElementAndSetElemnetText("Fieldvalue", xmlDoc, CommStaticClass.CommaToPoint(pSymbolClass.UpperLimit)); pUpperElement.AppendChild(pUpperValueElement); pRuleElement.AppendChild(pFilterElement); } //设置显示比例尺 if (!double.IsNaN(m_ptLayer.m_MaxScale) && !double.IsNaN(m_ptLayer.m_MinScale)) { pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("MinScale", xmlDoc, m_ptLayer.m_MaxScale.ToString())); pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("MaxScale", xmlDoc, m_ptLayer.m_MinScale.ToString())); } //获取符号节点 IList <XmlElement> pSymbolizedNode = pSymbolClass.GetSymbolNode(xmlDoc); foreach (XmlElement pElement in pSymbolizedNode) { pRuleElement.AppendChild(pElement); } if (pAnnotationElment != null) { pRuleElement.AppendChild(pAnnotationElment.CloneNode(true)); } RootXmlElement.AppendChild(pRuleElement); } } catch (Exception ex) { ptLogManager.WriteMessage(string.Format("解析符号信息失败:{0}{1}{2}{3}", Environment.NewLine, ex.Message, Environment.NewLine, ex.StackTrace)); } return(RootXmlElement); }
public override XmlElement GetRendXmlNode(XmlDocument xmlDoc, XmlElement RootXmlElement) { try { XmlElement pAnnotationElment = null; //如果有标注,则添加标注信息 if (AnnotationClass.IsSingleProperty && !string.IsNullOrEmpty(AnnotationClass.PropertyName)) { pAnnotationElment = AnnotationClass.GetSymbolNode(xmlDoc); } //开始解析渲染符号信息 for (int i = 0; i < SymbolList.Count; i++) { XmlElement pRuleElement = default(XmlElement); ptSymbolClass pSymbolClass = SymbolList[i]; //生成Rule节点信息 pRuleElement = CommXmlHandle.CreateElement("Rule", xmlDoc); pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("RuleName", xmlDoc, pSymbolClass.Label)); pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("Title", xmlDoc, pSymbolClass.Label)); XmlElement pFilterElement = CommXmlHandle.CreateElement("Filter", xmlDoc); //设置符号选择器 //多字段多值组合符号 if (this.FieldCount > 1) { XmlElement pAndElement = CommXmlHandle.CreateElement("And", xmlDoc); for (int l = 0; l <= FieldCount - 1; l++) { XmlElement pEqualToElment = CommXmlHandle.CreateElement("PropertyIsEqualTo", xmlDoc); pEqualToElment.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("PropertyName", xmlDoc, FieldNames[l])); pEqualToElment.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("Fieldvalue", xmlDoc, pSymbolClass.Fieldvalues[l])); pAndElement.AppendChild(pEqualToElment); } pFilterElement.AppendChild(pAndElement); } //单字段多值同一符号 else if (FieldCount == 1) { XmlElement pOrElement = default(XmlElement); if (pSymbolClass.Fieldvalues.Count > 1) { pOrElement = CommXmlHandle.CreateElement("Or", xmlDoc); } for (int l = 0; l <= pSymbolClass.Fieldvalues.Count - 1; l++) { if (pSymbolClass.Fieldvalues.Count > 1) { XmlElement pEqualToElment = CommXmlHandle.CreateElement("PropertyIsEqualTo", xmlDoc); pEqualToElment.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("PropertyName", xmlDoc, FieldNames[l])); pEqualToElment.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("Fieldvalue", xmlDoc, pSymbolClass.Fieldvalues[l])); pOrElement.AppendChild(pEqualToElment); } else { XmlElement pEqualToElment = CommXmlHandle.CreateElement("PropertyIsEqualTo", xmlDoc); pEqualToElment.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("PropertyName", xmlDoc, FieldNames[l])); pEqualToElment.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("Fieldvalue", xmlDoc, pSymbolClass.Fieldvalues[l])); pFilterElement.AppendChild(pEqualToElment); } } if (pSymbolClass.Fieldvalues.Count > 1) { pFilterElement.AppendChild(pOrElement); } } pRuleElement.AppendChild(pFilterElement); //设置显示比例尺 if (!double.IsNaN(m_ptLayer.m_MaxScale) && !double.IsNaN(m_ptLayer.m_MinScale)) { pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("MinScale", xmlDoc, m_ptLayer.m_MaxScale.ToString())); pRuleElement.AppendChild(CommXmlHandle.CreateElementAndSetElemnetText("MaxScale", xmlDoc, m_ptLayer.m_MinScale.ToString())); } //获取符号节点 IList <XmlElement> pSymbolizedNode = pSymbolClass.GetSymbolNode(xmlDoc); foreach (XmlElement pElement in pSymbolizedNode) { pRuleElement.AppendChild(pElement); } //写注记节点 if (pAnnotationElment != null) { pRuleElement.AppendChild(pAnnotationElment.CloneNode(true)); } RootXmlElement.AppendChild(pRuleElement); } } catch (Exception ex) { ptLogManager.WriteMessage(string.Format("解析符号信息失败:{0}{1}{2}{3}", Environment.NewLine, ex.Message, Environment.NewLine, ex.StackTrace)); } return(RootXmlElement); }