/// <summary> /// 获取VCT注记实体节点 /// </summary> public override EntityNode GetEntityNode() { try { AnnotationNode pAnnotationNode = new AnnotationNode(); //特征类型统一设置为单点注记 pAnnotationNode.AnnotationType = Convert.ToInt32(Metadata.MetaDataFile.GraphConfig.GetGraphSymbol("ANNOTATIONFEATURETYPE", "SingPointAnnotation")); IFeature pFeature = this.Feature as IFeature; if (pFeature != null) { ///标识码赋值 int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) pAnnotationNode.EntityID = Convert.ToInt32(this.Feature.get_Value(dBSMIndex)); ///要素代码赋值 pAnnotationNode.FeatureCode = this.FeatureCode; ///图形表现赋值 //pAnnotationNode.Representation = pFeature.Class.AliasName; ///注记坐标赋值 IGeometry5 pArea = pFeature.Shape as IGeometry5; if (pArea != null) { PointInfoNode pPTInfoNode = new PointInfoNode(pArea.CentroidEx.X, pArea.CentroidEx.Y); pAnnotationNode.PointLocation = pPTInfoNode; } m_AnnotationNode = pAnnotationNode; return pAnnotationNode; } return null; } catch (Exception ex) { Logger.WriteErrorLog(ex); return null; } }
//public override void GetEntityNodeByDataRow(DataRow dataRow, ref EntityNode entityNode) //{ // GetLineNodeByDataRow(dataRow, entityNode, false); //} public void GetLineNodeByDataRow(DataRow dataRow, ref LineNode lineNode, bool bReverse) { if (dataRow != null) { EntityNode entityNode = lineNode as EntityNode; base.GetEntityNodeByDataRow(dataRow, ref entityNode); lineNode.IndexID = dataRow[FieldName_LineNodeID] == System.DBNull.Value ? -1 : Convert.ToInt32(dataRow[FieldName_LineNodeID]); //lineNode.EntityID = dataRow[FieldName_EntityID] == null ? -1 : Convert.ToInt32(dataRow[FieldName_EntityID]); //lineNode.FeatureCode = dataRow[FieldName_FeatureCode] == null ? "" : dataRow[FieldName_FeatureCode].ToString(); lineNode.LineType = dataRow[FieldName_LineType] == System.DBNull.Value ? -1 : Convert.ToInt32(dataRow[FieldName_LineType]); //lineNode.Representation = dataRow[FieldName_Representation] == null ? "" : dataRow[FieldName_Representation].ToString(); if (entityNode.EntityID != 0) { SegmentNodes segmentNodes = new SegmentNodes(); BrokenLineNode brokenLineNode = new BrokenLineNode(); PointInfoNodes pointInfoNodes = new PointInfoNodes(); double dX1 = dataRow[FieldName_X1] == DBNull.Value ? 0.0 : Convert.ToDouble(dataRow[FieldName_X1]); double dY1 = dataRow[FieldName_Y1] == DBNull.Value ? 0.0 : Convert.ToDouble(dataRow[FieldName_Y1]); PointInfoNode pointInfoNode1 = new PointInfoNode(dX1, dY1); double dX2 = dataRow[FieldName_X2] == DBNull.Value ? 0.0 : Convert.ToDouble(dataRow[FieldName_X2]); double dY2 = dataRow[FieldName_Y2] == DBNull.Value ? 0.0 : Convert.ToDouble(dataRow[FieldName_Y2]); PointInfoNode pointInfoNode2 = new PointInfoNode(dX2, dY2); if (bReverse == true) { pointInfoNodes.Add(pointInfoNode2); pointInfoNodes.Add(pointInfoNode1); } else { pointInfoNodes.Add(pointInfoNode1); pointInfoNodes.Add(pointInfoNode2); } brokenLineNode.PointInfoNodes = pointInfoNodes; segmentNodes.Add(brokenLineNode); lineNode.SegmentNodes = segmentNodes; } } }
/// <summary> /// 获取VCT点实体节点 /// </summary> public override EntityNode GetEntityNode() { try { m_PointNode = new PointNode(); IFeature pFeature = this.Feature as IFeature; ///标识码赋值 int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) m_PointNode.EntityID=Convert.ToInt32( this.Feature.get_Value(dBSMIndex)); ///要素代码赋值 //int dSYDMIndex = -1; //dSYDMIndex = this.Feature.Fields.FindField("YSDM"); //if (dSYDMIndex != -1) // m_PointNode.FeatureCode = this.Feature.get_Value(dSYDMIndex).ToString(); //string sAttriTableName = (pFeature.Class as IDataset).Name; //m_PointNode.FeatureCode = MetaDataFile.GetFeatureCodeByName(sAttriTableName); m_PointNode.FeatureCode = this.FeatureCode; ///点数、点类型和图形表现编码赋值 m_PointNode.PointCount = 1; //通过配置设置点类型(现标准统一设置为独立点) m_PointNode.PointType =Convert.ToInt32( Metadata.MetaDataFile.GraphConfig.GetGraphSymbol("POINTFEATURETYPE", "SinglePoint")); //m_PointNode.Representation = pFeature.Class.AliasName; //获取空间数据坐标值 IPoint pPoint = pFeature.Shape as IPoint; PointInfoNode pInfoNode =new PointInfoNode(pPoint.X,pPoint.Y); m_PointNode.PointInfoNode = pInfoNode; return m_PointNode; } catch(Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }
public void GetEntityNodeByDataRow(DataRow dataRow, ref PolygonNode polygonNode) { if (dataRow != null) { if (polygonNode != null) { EntityNode entityNode = polygonNode as EntityNode; base.GetEntityNodeByDataRow(dataRow, ref entityNode); polygonNode.PolygonType = dataRow[FieldName_PolygonType] == System.DBNull.Value ? -1 : Convert.ToInt32(dataRow[FieldName_PolygonType]); double dX = dataRow[FieldName_X] == System.DBNull.Value ? 0.0 : Convert.ToDouble(dataRow[FieldName_X]); double dY = dataRow[FieldName_Y] == System.DBNull.Value ? 0.0 : Convert.ToDouble(dataRow[FieldName_Y]); PointInfoNode pointInfoNode = new PointInfoNode(dX, dY); polygonNode.LablePointInfoNode = pointInfoNode; polygonNode.LineNodes = new System.Collections.Generic.List<LineNodeEx>(); //polygonNode.ComposeType = dataRow[FieldName_ComposeType] == null ? -1 : Convert.ToInt32(dataRow[FieldName_ComposeType]); } } }
public void GetEntityNodeByDataRow(DataRow dataRow, ref PolygonNodeSimple polygonNode) { if (dataRow != null) { if (polygonNode != null) { EntityNode entityNode = polygonNode as EntityNode; base.GetEntityNodeByDataRow(dataRow, ref entityNode); polygonNode.PolygonType = dataRow[FieldName_PolygonType] == System.DBNull.Value ? -1 : Convert.ToInt32(dataRow[FieldName_PolygonType]); double dX = dataRow[FieldName_X] == System.DBNull.Value ? 0.0 : Convert.ToDouble(dataRow[FieldName_X]); double dY = dataRow[FieldName_Y] == System.DBNull.Value ? 0.0 : Convert.ToDouble(dataRow[FieldName_Y]); PointInfoNode pointInfoNode = new PointInfoNode(dX, dY); polygonNode.LablePointInfoNode = pointInfoNode; polygonNode.LineNodes = new System.Collections.Generic.List <int>(); //polygonNode.ComposeType = dataRow[FieldName_ComposeType] == null ? -1 : Convert.ToInt32(dataRow[FieldName_ComposeType]); } } }
/// <summary> /// 根据vct线段获取点集合 /// </summary> /// <param name="pLineNodeEx"></param> /// <returns></returns> private IPointCollection GetPointCollection(LineNodeEx pLineNodeEx, IPoint pPrePoint) { //沈迎志修改,注意线的方向 try { IPointCollection pPtCollection = new PolylineClass(); if (pLineNodeEx.IsReverse == false) { for (int i = 0; i < pLineNodeEx.SegmentNodes.Count; i++) { BrokenLineNode pBLineNode = pLineNodeEx.SegmentNodes[i] as BrokenLineNode; if (pBLineNode != null) { for (int j = 0; j < pBLineNode.PointInfoNodes.Count; j++) { if (i == 0 && j == 0 && pPrePoint != null) continue; PointInfoNode itemInfoNode = pBLineNode.PointInfoNodes[j]; IPoint pPoint = new PointClass(); pPoint.PutCoords(itemInfoNode.X, itemInfoNode.Y); object objTypemissing = Type.Missing; pPtCollection.AddPoint(pPoint, ref objTypemissing, ref objTypemissing); } } } } else { for (int i = pLineNodeEx.SegmentNodes.Count - 1; i >= 0; i--) { BrokenLineNode pBLineNode = pLineNodeEx.SegmentNodes[i] as BrokenLineNode; if (pBLineNode != null) { for (int j = pBLineNode.PointInfoNodes.Count - 1; j >= 0; j--) { if (i == pLineNodeEx.SegmentNodes.Count - 1 && j == pBLineNode.PointInfoNodes.Count - 1 && pPrePoint != null) continue; PointInfoNode itemInfoNode = pBLineNode.PointInfoNodes[j]; IPoint pPoint = new PointClass(); pPoint.PutCoords(itemInfoNode.X, itemInfoNode.Y); object objTypemissing = Type.Missing; pPtCollection.AddPoint(pPoint, ref objTypemissing, ref objTypemissing); } } } } /* ///构造线段 for (int j = 0; j < pLineNodeEx.SegmentNodes.Count; j++) { BrokenLineNode pBLineNode = pLineNodeEx.SegmentNodes[j] as BrokenLineNode; bool bNewBeginPoint = true;///表示正在处理折线的起点 foreach (PointInfoNode itemInfoNode in pBLineNode.PointInfoNodes) { if (bNewBeginPoint&&pPrePoint != null && itemInfoNode.X == pPrePoint.X &&itemInfoNode.Y==pPrePoint.Y) { ///如果是前一个线段终点和后一个线段起点相同则不添加到构面点集合中 continue; } ///将点添加到构线集合中 IPoint pPoint = new PointClass(); pPoint.PutCoords(itemInfoNode.X, itemInfoNode.Y); object objTypemissing = Type.Missing; pPtCollection.AddPoint(pPoint, ref objTypemissing, ref objTypemissing); } bNewBeginPoint = false;///当前的起点处理完成 } if (pLineNodeEx.IsReverse) { ///方向构造闭合环 object objTypeMissing = Type.Missing; IPointCollection pPtReserveCollection = new RingClass(); ///反向添加点集合数据 for (int k = pPtCollection.PointCount; k >= 0; k--) { pPtReserveCollection.AddPoint(pPtCollection.get_Point(k), ref objTypeMissing, ref objTypeMissing); } return pPtReserveCollection; } */ return pPtCollection; } catch(Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }
/// <summary> /// ��ȡVCT��ʵ��ڵ� /// </summary> private PointNode ReadPointNode() { if (this.m_streamReader != null) { string strLine = ""; //��ȡ�������ֻ��� if (m_bFoundPointBegin == false) { strLine = this.ReadLine(true); //���ҵ�ʵ��ڵ�Ŀ�ʼ��ǡ�PointBegin�� if (strLine.IndexOf("PointBegin", System.StringComparison.OrdinalIgnoreCase) > -1) { m_bFoundPointBegin = true; } } if (m_bFoundPointBegin == true) { strLine = this.ReadLine(true); //���ҵ�ʵ��ڵ�Ľ�����ǡ�PointEnd�� if (strLine.IndexOf("PointEnd", System.StringComparison.OrdinalIgnoreCase) > -1) return null; else { PointNode pointNode = new PointNode(); //�Ȼ�ȡ��ʵ���ʶ�� int nEntityID = -1; if (VCTFile.ConvertToInt32(strLine, out nEntityID)) pointNode.EntityID = nEntityID; else { LogAPI.WriteLog("��ȡ��ʵ��ı�ʶ��ʧ�ܣ����������Ƿ���ϱ���"); LogAPI.WriteLog("��ȡ���������������" + m_nReadLineCount + "��"); return null; } //�ٻ�ȡҪ�ر��� pointNode.FeatureCode = this.ReadLine(false); //��ȡͼ�α��ֱ��� pointNode.Representation = this.ReadLine(false); //��ȡ����������� int nPointType = -1; if (VCTFile.ConvertToInt32(this.ReadLine(false),out nPointType)) pointNode.PointType = nPointType; else { LogAPI.WriteLog("��ȡ��ʵ�����������ʧ�ܣ����������Ƿ���ϱ���"); LogAPI.WriteLog("��ȡ���������������" + m_nReadLineCount + "��"); return null; } //��ȡ��ĸ��� this.ReadLine(false); //��ȡ������� PointInfoNode pointInfoNode = new PointInfoNode(this.ReadLine(false)); pointNode.PointInfoNode = pointInfoNode; return pointNode; } } } return null; }
/// <summary> /// ��ȡVCT��ʵ��ڵ� /// </summary> public override EntityNode GetEntityNode() { try { LineNode pLineNode = new LineNode(); pLineNode.SegmentNodes = new SegmentNodes(); IFeature pFeature = this.Feature as IFeature; //��������ͳһ����Ϊ1 pLineNode.LineType = 1; ///��ʶ�븳ֵ int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) pLineNode.EntityID = Convert.ToInt32(this.Feature.get_Value(dBSMIndex)); ///Ҫ�ش��븳ֵ //int dSYDMIndex = -1; //dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField); //if (dSYDMIndex != -1) // pLineNode.FeatureCode = this.Feature.get_Value(dSYDMIndex).ToString(); //string sAttriTableName = (pFeature.Class as IDataset).Name; //pLineNode.FeatureCode = MetaDataFile.GetFeatureCodeByName(sAttriTableName); pLineNode.FeatureCode = this.FeatureCode; ///ͼ�α��ֱ��� //pLineNode.Representation = pFeature.Class.AliasName; ///add by ��ƽ 2011-9-7 ��Ӳ��� IGeometry pFeatureGeometry = null; if (m_bCut) { pFeatureGeometry = GetSubGeometry(); if (pFeatureGeometry == null) { pFeatureGeometry = pFeature.Shape; } } else { pFeatureGeometry = pFeature.Shape; } IPolyline pPolygon =pFeatureGeometry as IPolyline; ///����ڵ����� IPointCollection pPointCollection = pPolygon as IPointCollection; BrokenLineNode pBLineNode = new BrokenLineNode(); pBLineNode.PointInfoNodes = new PointInfoNodes(); for (int i = 0; i < pPointCollection.PointCount; i++) { IPoint pPoint = pPointCollection.get_Point(i); PointInfoNode pInfoNode1 = new PointInfoNode(pPoint.X, pPoint.Y); pBLineNode.PointInfoNodes.Add(pInfoNode1); } pLineNode.SegmentNodes.Add(pBLineNode); return pLineNode; } catch (Exception ex) { Logger.WriteErrorLog(ex); return null; } }
public bool SetValue(string strVariantName, string strValue) { strVariantName = Metadata.MetaDataFile.HeadConfig.GetHeadMark(strVariantName).ToLower(); int nValue = -1; strValue= strValue.Trim(); switch (strVariantName) { case "datamark": { this.m_strDatamark = strValue; break; } case "version": { this.m_strVersion = strValue; break; } case "coordinatesystemType": { this.m_strCoordinateSystemType = strValue; break; } case "dim": { if (VCTFile.ConvertToInt32(strValue,out nValue)) this.m_nDim = nValue; break; } case "xaxisdirection": { this.m_strXAxisDirection = strValue; break; } case "yaxisdirection": { this.m_strYAxisDirection = strValue; break; } case "unit": { this.m_strUnit = strValue; break; } case "projection": { this.m_strProjection = strValue; break; } case "spheroid": { this.m_strSpheroid = strValue; break; } case "primemeridian": { this.m_strPrimeMeridian = strValue; break; } case "parameters": { GetParameter( strValue); break; } case "vertical": { this.m_strVertical = strValue; break; } case "temporalreferencesystem": { this.m_strTemporalReferenceSystem = strValue; break; } case "majormin": { this.m_MajorMin = new PointInfoNode(strValue); break; } case "majormax": { this.m_MajorMax = new PointInfoNode(strValue); break; } case "scale": { m_strScale = strValue; break; } case "excursion": { this.m_strExcursion = strValue; break; } case "date": { this.m_strDate = strValue; break; } case "separator": { HeadNode.m_cSeparator = strValue[0]; break; } } return true; }
/// <summary> /// ��ȡVCTע��ʵ��ڵ� /// </summary> public override EntityNode GetEntityNode() { try { AnnotationNode pAnnotationNode = new AnnotationNode(); //��������ͳһ����Ϊ����ע�� pAnnotationNode.AnnotationType = Convert.ToInt32(Metadata.MetaDataFile.GraphConfig.GetGraphSymbol("ANNOTATIONFEATURETYPE", "SingPointAnnotation")); IFeature pFeature = this.Feature as IFeature; if (pFeature != null) { ///��ʶ�븳ֵ int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) pAnnotationNode.EntityID = Convert.ToInt32(this.Feature.get_Value(dBSMIndex)); ///Ҫ�ش��븳ֵ pAnnotationNode.FeatureCode = this.FeatureCode; ///ͼ�α��ָ�ֵ //pAnnotationNode.Representation = pFeature.Class.AliasName; ///ע�����긳ֵ IGeometry5 pArea = pFeature.Shape as IGeometry5; if (pArea != null) { PointInfoNode pPTInfoNode = new PointInfoNode(pArea.CentroidEx.X, pArea.CentroidEx.Y); pAnnotationNode.PointLocation = pPTInfoNode; } m_AnnotationNode = pAnnotationNode; return pAnnotationNode; } return null; } catch (Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }
/// <summary> /// 获取VCT线实体节点 /// </summary> public override EntityNode GetEntityNode() { try { LineNode pLineNode = new LineNode(); pLineNode.SegmentNodes = new SegmentNodes(); IFeature pFeature = this.Feature as IFeature; //特征类型统一设置为1 pLineNode.LineType = 1; ///标识码赋值 int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) pLineNode.EntityID = Convert.ToInt32(this.Feature.get_Value(dBSMIndex)); ///要素代码赋值 //int dSYDMIndex = -1; //dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField); //if (dSYDMIndex != -1) // pLineNode.FeatureCode = this.Feature.get_Value(dSYDMIndex).ToString(); //string sAttriTableName = (pFeature.Class as IDataset).Name; //pLineNode.FeatureCode = MetaDataFile.GetFeatureCodeByName(sAttriTableName); pLineNode.FeatureCode = this.FeatureCode; ///图形表现编码 //pLineNode.Representation = pFeature.Class.AliasName; ///add by 曾平 2011-9-7 添加裁切 IGeometry pFeatureGeometry = null; if (m_bCut) { pFeatureGeometry = GetSubGeometry(); if (pFeatureGeometry == null) { pFeatureGeometry = pFeature.Shape; } } else { pFeatureGeometry = pFeature.Shape; } IPolyline pPolygon =pFeatureGeometry as IPolyline; ///构造节点数据 IPointCollection pPointCollection = pPolygon as IPointCollection; BrokenLineNode pBLineNode = new BrokenLineNode(); pBLineNode.PointInfoNodes = new PointInfoNodes(); for (int i = 0; i < pPointCollection.PointCount; i++) { IPoint pPoint = pPointCollection.get_Point(i); PointInfoNode pInfoNode1 = new PointInfoNode(pPoint.X, pPoint.Y); pBLineNode.PointInfoNodes.Add(pInfoNode1); } pLineNode.SegmentNodes.Add(pBLineNode); return pLineNode; } catch (Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }
/// <summary> /// ��ȡVCT��ʵ��ڵ� /// </summary> public override EntityNode GetEntityNode() { try { m_PointNode = new PointNode(); IFeature pFeature = this.Feature as IFeature; ///��ʶ�븳ֵ int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) m_PointNode.EntityID=Convert.ToInt32( this.Feature.get_Value(dBSMIndex)); ///Ҫ�ش��븳ֵ //int dSYDMIndex = -1; //dSYDMIndex = this.Feature.Fields.FindField("YSDM"); //if (dSYDMIndex != -1) // m_PointNode.FeatureCode = this.Feature.get_Value(dSYDMIndex).ToString(); //string sAttriTableName = (pFeature.Class as IDataset).Name; //m_PointNode.FeatureCode = MetaDataFile.GetFeatureCodeByName(sAttriTableName); m_PointNode.FeatureCode = this.FeatureCode; ///�����������ͺ�ͼ�α��ֱ��븳ֵ m_PointNode.PointCount = 1; //ͨ���������õ����ͣ��ֱ�ͳһ����Ϊ�����㣩 m_PointNode.PointType =Convert.ToInt32( Metadata.MetaDataFile.GraphConfig.GetGraphSymbol("POINTFEATURETYPE", "SinglePoint")); //m_PointNode.Representation = pFeature.Class.AliasName; //��ȡ�ռ���������ֵ IPoint pPoint = pFeature.Shape as IPoint; PointInfoNode pInfoNode =new PointInfoNode(pPoint.X,pPoint.Y); m_PointNode.PointInfoNode = pInfoNode; return m_PointNode; } catch(Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }