/// <summary> /// 解析符号信息 /// </summary> /// <returns></returns> public ptSymbolClass GetSymbolClass(string Label, IList <string> Fieldvalues, double UpperLimit, double LowerLimit) { ptSymbolClass pSymbolClass = null; if (m_pSymbol == null) { return(null); } //点符号 if (m_pSymbol is IMarkerSymbol) { pSymbolClass = GetMarkerSymbolClass(m_pSymbol); } else if (m_pSymbol is ILineSymbol) { pSymbolClass = GetLineSymbolClass(m_pSymbol); } else if (m_pSymbol is IFillSymbol) { pSymbolClass = GetFillSymbolClass(m_pSymbol); } else if (m_pSymbol is I3DChartSymbol) { pSymbolClass = GetIIIDChartSymbolClass(m_pSymbol); } else if (m_pSymbol is ITextSymbol) { pSymbolClass = new TextSymbolClass(m_pSymbol); } pSymbolClass.Label = Label; pSymbolClass.Fieldvalues = Fieldvalues; pSymbolClass.UpperLimit = UpperLimit; pSymbolClass.LowerLimit = LowerLimit; return(pSymbolClass); }
protected override void InitialSymbol() { base.InitialSymbol(); ISymbol pSymbol = m_pSimpleRender.Symbol; ptSymbolFactory pSymbolFac = new ptSymbolFactory(pSymbol); ptSymbolClass pSymbolClass = pSymbolFac.GetSymbolClass(m_pSimpleRender.Label, new List <string>() , 0, 0); SymbolList.Add(pSymbolClass); }
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); }
/// <summary> /// 获取标记符号 /// </summary> /// <param name="Symbol"></param> /// <returns></returns> private ptSymbolClass GetMarkerSymbolClass(ISymbol Symbol) { ptSymbolClass tempSymbol = null; if (Symbol is ISimpleMarkerSymbol) { tempSymbol = new ptSimpleMarkerSymbolClass(Symbol); return(tempSymbol); } else if (Symbol is ICartographicMarkerSymbol) { ICartographicMarkerSymbol ICMS = Symbol as ICartographicMarkerSymbol; if (ICMS is ICharacterMarkerSymbol) { tempSymbol = new ptCharacterMarkerSymbolClass(Symbol); return(tempSymbol); } else if (ICMS is IPictureMarkerSymbol) { tempSymbol = new ptPictureMarkerSymbolClass(Symbol); return(tempSymbol); } } else if (Symbol is IArrowMarkerSymbol) { tempSymbol = new ptArrowMarkerSymbolClass(Symbol); return(tempSymbol); } else if (Symbol is IPictureMarkerSymbol) { tempSymbol = new ptPictureMarkerSymbolClass(Symbol); return(tempSymbol); } else if (Symbol is IMultiLayerMarkerSymbol) { tempSymbol = new ptMultilayerMarkerSymbolClass(Symbol); return(tempSymbol); } else { return(tempSymbol); } return(tempSymbol); }
/// <summary> /// 获取填充符号 /// </summary> /// <param name="Symbol"></param> /// <returns></returns> private ptSymbolClass GetFillSymbolClass(ISymbol Symbol) { ptSymbolClass pSymbolClass = null; if (Symbol is ISimpleFillSymbol) { pSymbolClass = new ptSimpleFillSymbolClass(Symbol); return(pSymbolClass); } else if (Symbol is IMarkerFillSymbol) { pSymbolClass = new ptMarkerFillSymbolClass(Symbol); return(pSymbolClass); } else if (Symbol is ILineFillSymbol) { pSymbolClass = new ptLineFillSymbolClass(Symbol); return(pSymbolClass); } else if (Symbol is IDotDensityFillSymbol) { pSymbolClass = new ptDotDensityFillSymbolClass(Symbol); return(pSymbolClass); } else if (Symbol is IPictureFillSymbol) { pSymbolClass = new ptPictureFillSymbolClass(Symbol); return(pSymbolClass); } else if (Symbol is IGradientFillSymbol) { pSymbolClass = new ptGradientFillSymbolClass(Symbol); return(pSymbolClass); } else if (Symbol is IMultiLayerFillSymbol) { pSymbolClass = new ptMultilayerFillSymbolClass(Symbol); return(pSymbolClass); } return(pSymbolClass); }
/// <summary> /// 获取3D图标符号 /// </summary> /// <param name="Symbol"></param> /// <returns></returns> private ptSymbolClass GetIIIDChartSymbolClass(ISymbol Symbol) { ptSymbolClass pSymbolClass = null; if (Symbol is IBarChartSymbol) { pSymbolClass = new ptBarChartSymbolClass(Symbol); return(pSymbolClass); } else if (Symbol is IPieChartSymbol) { pSymbolClass = new ptPieChartSymbolClass(Symbol); return(pSymbolClass); } else if (Symbol is IStackedChartSymbol) { pSymbolClass = new ptStackedChartSymbolClass(Symbol); return(pSymbolClass); } return(pSymbolClass); }
/// <summary> /// 获取线符号 /// </summary> /// <param name="Symbol"></param> /// <returns></returns> private ptSymbolClass GetLineSymbolClass(ISymbol Symbol) { ptSymbolClass pSymbolClass = null; if (Symbol is ICartographicLineSymbol) { ICartographicLineSymbol ICLS = Symbol as ICartographicLineSymbol; if (ICLS is IHashLineSymbol) { pSymbolClass = new ptHashLineSymbolClass(Symbol); return(pSymbolClass); } else if (ICLS is IMarkerLineSymbol) { pSymbolClass = new ptMarkerLineSymbolClass(Symbol); return(pSymbolClass); } else { pSymbolClass = new ptCartographicLineSymbol(Symbol); return(pSymbolClass); } } else if (Symbol is ISimpleLineSymbol) { pSymbolClass = new ptSimpleLineSymbolClass(Symbol); return(pSymbolClass); } else if (Symbol is IPictureLineSymbol) { pSymbolClass = new ptPictureLineSymbolClass(Symbol); return(pSymbolClass); } else if (Symbol is IMultiLayerLineSymbol) { pSymbolClass = new ptMultilayerLineSymbolClass(Symbol); return(pSymbolClass); } return(pSymbolClass); }
/// <summary> /// 初始化符号信息 /// </summary> protected override void InitialSymbol() { base.InitialSymbol(); IClassBreaksUIProperties objClassBreaksProp = m_pClassBreaksRender as IClassBreaksUIProperties; try { for (int i = 0; i < BreakCount; i++) { double cLowerLimit = objClassBreaksProp.LowBreak[i]; double cUpperLimit = m_pClassBreaksRender.Break[i]; ISymbol pSymbol = m_pClassBreaksRender.get_Symbol(i); ptSymbolFactory pSymbolFac = new ptSymbolFactory(pSymbol); ptSymbolClass pSymbolClass = pSymbolFac.GetSymbolClass(m_pClassBreaksRender.Label[i], new List <string>() , cUpperLimit, cLowerLimit); SymbolList.Add(pSymbolClass); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
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); }
/// <summary> /// 初始化符号信息 /// </summary> protected override void InitialSymbol() { base.InitialSymbol(); if (m_pUniqueRender == null || m_pFeatureLayer == null) { return; } //是否是多个字段 bool bNoSepFieldVal = false; //是否是连接表 bool bIsJoined = false; try { IDisplayTable pDisplayTable = m_pFeatureLayer as IDisplayTable; ITable pTable = pDisplayTable.DisplayTable; IDataset objDataset = m_FeatureClass as IDataset; //是否是关系表 if (pTable is IRelQueryTable) { bIsJoined = true; } if (FieldCount > 1) { bNoSepFieldVal = true; } //唯一值字段有多个 if (bNoSepFieldVal) { //数据源为SHAPE文件 if (objDataset.Workspace.Type == esriWorkspaceType.esriFileSystemWorkspace) { for (int i = 1; i <= FieldCount; i++) { FieldNames.Add(m_pUniqueRender.Field[i - 1].ToLower()); } CommStaticClass.GimmeUniqueValuesFromShape(m_FeatureClass as ITable, FieldNames); } //数据源为其他 else { for (int i = 1; i <= FieldCount; i++) { FieldNames.Add(m_pUniqueRender.Field[i - 1].ToLower()); //属性表有连接表 if (pTable is IRelQueryTable) { IRelQueryTable pRelQueryTable = default(IRelQueryTable); ITable pDestTable = default(ITable); IDataset pDataSet = default(IDataset); IList <string> alJoinedTableNames = new List <string>(); while (pTable is IRelQueryTable) { pRelQueryTable = pTable as IRelQueryTable; pDestTable = pRelQueryTable.DestinationTable; pDataSet = pDestTable as IDataset; pTable = pRelQueryTable.SourceTable; alJoinedTableNames.Add(pDataSet.Name); } CommStaticClass.GimmeUniqeValuesForFieldname(m_FeatureClass as ITable, m_pUniqueRender.Field[i - 1], alJoinedTableNames); pTable = pDisplayTable.DisplayTable; } //属性表没有连接表 else { CommStaticClass.GimmeUniqeValuesForFieldname(m_FeatureClass as ITable, m_pUniqueRender.Field[i - 1]); } } } } //唯一值字段只有一个 else { FieldNames.Add(m_pUniqueRender.Field[FieldCount - 1].ToLower()); } //开始解析符号 for (int j = 0; j <= ValueCount - 1; j++) { ISymbol pSymbol = m_pUniqueRender.get_Symbol(m_pUniqueRender.get_Value(j)); ptSymbolFactory pSymbolFac = new ptSymbolFactory(pSymbol); ptSymbolClass pSymbolClass = pSymbolFac.GetSymbolClass(m_pUniqueRender.Label[m_pUniqueRender.get_Value(j)], CommStaticClass.getUVFieldValues(m_pUniqueRender, j) , 0, 0); SymbolList.Add(pSymbolClass); } } catch (Exception ex) { ptLogManager.WriteMessage(string.Format("方法名称:{0}{1}{2}{3}{4}", "InitialSymbol", Environment.NewLine, ex.Message, Environment.NewLine, ex.StackTrace)); } }