//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> private LineNode ReadLineNode() { if (this.m_streamReader != null) { string strLine = ""; //��ȡ�������ֻ��� if (m_bFoundLineBegin == false) { strLine = this.ReadLine(true); //������ʵ��ڵ�Ŀ�ʼ��ǡ�LineBegin�� if (strLine.IndexOf("LineBegin", System.StringComparison.OrdinalIgnoreCase) > -1) { m_bFoundLineBegin = true; } } if (m_bFoundLineBegin == true) { strLine = this.ReadLine(true); //������ʵ��ڵ�Ľ�����ǡ�LineEnd�� if (strLine.IndexOf("LineEnd", System.StringComparison.OrdinalIgnoreCase) > -1) return null; else { LineNode lineNode = new LineNodeEx(); ///add by ��ƽ ���ʵ���ʶ��û�л�ȡ�����ж�Ϊ��ȡʧ�� //�Ȼ�ȡ��ʵ���ʶ�� int nEntityID = -1; if (VCTFile.ConvertToInt32(strLine, out nEntityID)) lineNode.EntityID = nEntityID; else { LogAPI.WriteLog("��ȡ��ʵ��ı�ʶ��ʧ�ܣ����������Ƿ���ϱ���"); LogAPI.WriteLog("��ȡ���������������" + m_nReadLineCount + "��"); return null; } //�ٻ�ȡҪ�ر��� lineNode.FeatureCode = this.ReadLine(false); //��ȡͼ�α��ֱ��� lineNode.Representation = this.ReadLine(false); //��ȡ�ߵ��������� int nLineType = -1; if (VCTFile.ConvertToInt32(this.ReadLine(false),out nLineType)) lineNode.LineType = nLineType; else { LogAPI.WriteLog("��ȡ��ʵ�����������ʧ�ܣ����������Ƿ���ϱ���"); LogAPI.WriteLog("��ȡ���������������"+m_nReadLineCount+"��"); return null; } //��ȡ�߶ε����� int nSegmentCount = 0; if(!VCTFile.ConvertToInt32(this.ReadLine(false), out nSegmentCount)) { LogAPI.WriteLog("��ȡ��ʵ��Ľڵ����ʧ�ܣ����������Ƿ���ϱ���"); LogAPI.WriteLog("��ȡ���������������" + m_nReadLineCount + "��"); return null; } SegmentNodes arrSegmentNode = new SegmentNodes(); for (int i = 0; i < nSegmentCount; i++) { //��ȡ�߶����� this.ReadLine(false); //////////////////////////////////////////////////////////////////////////// //Ŀǰֻ�������� BrokenLineNode bokenLineNode = new BrokenLineNode(); PointInfoNodes arrPointInfoNode = new PointInfoNodes(); //��ȡ�����е�ĸ��� int nPointCount = 0; if (!VCTFile.ConvertToInt32(this.ReadLine(false), out nPointCount)) { LogAPI.WriteLog("��ȡ���ߵĽڵ����ʧ�ܣ����������Ƿ���ϱ���"); LogAPI.WriteLog("��ȡ���������������" + m_nReadLineCount + "��"); return null; } for (int j = 0; j < nPointCount; j++) { //��ȡ������� arrPointInfoNode.Add(new PointInfoNode(this.ReadLine(false))); } bokenLineNode.PointInfoNodes = arrPointInfoNode; arrSegmentNode.Add(bokenLineNode); } lineNode.SegmentNodes = arrSegmentNode; return lineNode; } } } return null; }