Пример #1
0
        public WritePolygonNodes(ESRIData.Dataset dataset,TempData.TempFile pTempFile, VCTFile pVCTFile, int nNewEntityID)
        {
            m_dataset = dataset;
            m_pTempFile = pTempFile;
            m_VCTFile = pVCTFile;
            m_nNewEntityID = nNewEntityID;
            m_nLayerCount = m_dataset.GetLayerCount();

            //WriteCommplete = null;
        }
Пример #2
0
        public WritePolygonNodes(ESRIData.Dataset dataset, TempData.TempFile pTempFile, VCTFile pVCTFile, int nNewEntityID)
        {
            m_dataset      = dataset;
            m_pTempFile    = pTempFile;
            m_VCTFile      = pVCTFile;
            m_nNewEntityID = nNewEntityID;
            m_nLayerCount  = m_dataset.GetLayerCount();

            //WriteCommplete = null;
        }
Пример #3
0
/*
        /// <summary>
        /// 处理面实体中引用线对象的标识码
        /// </summary>
        /// <param name="arrLineNode">VCT线实体节点集合</param>
        /// <param name="arrFeatureCode">关联图层要素编码集合</param>
        /// <param name="arrLineNodeEx">VCT面实体中的线实体节点集合</param>
        private void MatchPolygonToLine(ref List<FileData.LineNode> arrLineNode, List<string> arrFeatureCode, ref List<FileData.LineNodeEx> arrLineNodeEx)
        {

            
            if (arrFeatureCode != null && arrFeatureCode.Count > 0)
            {
                List<FileData.LineNode> arrLinkLineNode = new List<FileData.LineNode>();
                for (int i = 0; i < arrLineNode.Count; i++)
                {
                    if (arrFeatureCode.Contains(arrLineNode[i].FeatureCode))
                    {
                        arrLinkLineNode.Add(arrLineNode[i]);
                    }
                }
                if (arrLinkLineNode.Count > 0)
                {
                    //排序
                    arrLinkLineNode.Sort();
                    arrLineNodeEx.Sort();

                    //更新构面线的标识码
                    int j = 0;
                    for (int i = 0; i < arrLinkLineNode.Count; i++)
                    {
                        for (; j < arrLineNodeEx.Count; j++)
                        {
                            //必须是未找到标识码的
                            if (arrLineNodeEx[j].EntityID == -1)
                            {
                                if (arrLinkLineNode[i] == arrLineNodeEx[j])
                                {
                                    arrLineNodeEx[j].IsFromLine = true;
                                    arrLineNodeEx[j].EntityID = arrLinkLineNode[i].EntityID;
                                }
                                else if (arrLinkLineNode[i] > arrLineNodeEx[j])
                                {

                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                    }
                    //反向
                    List<FileData.LineNodeEx> arrLineNodeExReverse = new List<FileData.LineNodeEx>();
                    for (int i = 0; i < arrLineNodeEx.Count; i++)
                    {
                        //必须是未找到标识码的
                        if (arrLineNodeEx[i].EntityID == -1)
                        {
                            FileData.LineNodeEx lineNodeEx = arrLineNodeEx[i];
                            lineNodeEx.Reverse();
                            arrLineNodeExReverse.Add(lineNodeEx);
                        }
                    }
                    arrLineNodeExReverse.Sort();//反向后排序
                    j = 0;
                    for (int i = 0; i < arrLinkLineNode.Count; i++)
                    {
                        for (; j < arrLineNodeExReverse.Count; j++)
                        {
                            if (arrLinkLineNode[i] == arrLineNodeExReverse[j])
                            {
                                arrLineNodeExReverse[j].IsFromLine = true;
                                arrLineNodeExReverse[j].EntityID = arrLinkLineNode[i].EntityID;
                            }
                            else if (arrLinkLineNode[i] > arrLineNodeExReverse[j])
                            {
                            }
                            else
                            {
                                break;
                            }
                        }
                    }

                    arrLineNodeEx.Clear();
                    for (int i = 0; i < arrLineNodeExReverse.Count; i++)
                    {
                        //必须是未找到标识码的
                        if (arrLineNodeExReverse[i].EntityID == -1)
                        {
                            arrLineNodeEx.Add(arrLineNodeExReverse[i]);
                        }
                    }
                }
            }
            return arrLineNodeEx;
        }
*/
        //public FileData.LineNodeEx CloneLineNodeEx(FileData.LineNodeEx lineNodeExSource)
        //{
        //    //m_InitiallyLineNode = this;
            

        //    try
        //    {
        //        MemoryStream stream = new MemoryStream();
        //        BinaryFormatter formatter = new BinaryFormatter();
        //        formatter.Serialize(stream, lineNodeExSource);
        //        stream.Position = 0;

        //        FileData.LineNodeEx lineNodeEx = formatter.Deserialize(stream) as FileData.LineNodeEx;

        //        lineNodeEx.InitiallyLineNode = lineNodeExSource;
        //        return lineNodeEx;
        //    }
        //    catch (Exception ex)
        //    {
        //        LogAPI.WriteErrorLog(ex);
        //    }
        //     /* 
        //    try
        //    {
        //        FileData.LineNodeEx lineNodeEx = new FileData.LineNodeEx();
        //        lineNodeEx.IsReverse = lineNodeExSource.IsReverse;
        //        lineNodeEx.PolygonID = lineNodeExSource.PolygonID;
        //        lineNodeEx.LineIndex = lineNodeExSource.LineIndex;
        //        lineNodeEx.IsFromLine = lineNodeExSource.IsFromLine;

        //        lineNodeEx.LineType = lineNodeExSource.LineType;
        //        lineNodeEx.SegmentNodes = new FileData.SegmentNodes();
        //        for (int i = 0; i < lineNodeExSource.SegmentNodes.Count; i++)
        //        {
        //            lineNodeEx.SegmentNodes.Add(lineNodeExSource.SegmentNodes[i]);
        //            //BrokenLineNode brokenLineNode1 = this.SegmentNodes[i] as BrokenLineNode;
        //            //if (brokenLineNode1 != null)
        //            //{
        //            //    BrokenLineNode brokenLineNode2 = new BrokenLineNode();
        //            //    brokenLineNode2.PointInfoNodes = new PointInfoNodes();
        //            //    for (int j = 0; j < brokenLineNode1.PointInfoNodes.Count; j++)
        //            //    {
        //            //        PointInfoNode pointInfoNode = new PointInfoNode();
        //            //        pointInfoNode.X = brokenLineNode1.PointInfoNodes[j].X;
        //            //        pointInfoNode.Y = brokenLineNode1.PointInfoNodes[j].Y;
        //            //        brokenLineNode2.PointInfoNodes.Add(pointInfoNode);
        //            //    }
        //            //    lineNodeEx.SegmentNodes.Add(brokenLineNode2);
        //            //}
        //        }

        //        lineNodeEx.EntityID = lineNodeExSource.EntityID;
        //        lineNodeEx.FeatureCode = lineNodeExSource.FeatureCode;
        //        lineNodeEx.Representation = lineNodeExSource.Representation;

        //        lineNodeEx.InitiallyLineNode = lineNodeExSource;
        //        return lineNodeEx;
        //    }
        //    catch (Exception ex)
        //    {
        //        LogAPI.WriteErrorLog(ex);
        //    }*/
        //    return null;
        //}

/*

        /// <summary>
        /// 处理面实体中引用线对象的标识码
        /// </summary>
        /// <param name="arrLineNodeExNew">VCT面实体中的线实体节点集合(需要新建)</param>
        private void MatchPolygonToLine(ref List<FileData.LineNodeEx> arrLineNodeExNew)
        {
            List<FileData.LineNodeEx> arrLineNodeNewClone = new List<VCT.FileData.LineNodeEx>();
            for (int i = 0; i < arrLineNodeExNew.Count; i++)
            {
                //克隆对象,并反向
                FileData.LineNodeEx lineNodeEx = CloneLineNodeEx(arrLineNodeExNew[i]);//.Clone() as FileData.LineNodeEx;
                if (lineNodeEx != null)
                {
                    lineNodeEx.Reverse();
                    arrLineNodeNewClone.Add(lineNodeEx);
                }
            }

            arrLineNodeExNew.Sort();
            arrLineNodeNewClone.Sort();

            int j = 0;
            for (int i = 0; i < arrLineNodeExNew.Count; i++)
            {
                if (arrLineNodeExNew[i].EntityID == -1)
                {
                    //需要创建要素编码
                    arrLineNodeExNew[i].EntityID = this.m_nNewEntityID;
                    ////未做合并处理
                    //m_VCTFile.WritePolygonLineNode(arrLineNodeExNew[i]);
                }
                for (; j < arrLineNodeNewClone.Count; j++)
                {
                    if (arrLineNodeNewClone[j].InitiallyLineNode.EntityID == -1)
                    {
                        if (arrLineNodeExNew[i] == arrLineNodeNewClone[j])
                        {
                            arrLineNodeNewClone[j].InitiallyLineNode.EntityID = arrLineNodeExNew[i].EntityID;
                            arrLineNodeNewClone[j].InitiallyLineNode.Reverse();
                            //arrLineNodeNewClone[j].InitiallyLineNode.IsReverse = arrLineNodeNewClone[j].IsReverse;

                            arrLineNodeNewClone[j].InitiallyLineNode.OtherPolygonLineNode = arrLineNodeExNew[i];
                            arrLineNodeExNew[i].OtherPolygonLineNode = arrLineNodeNewClone[j].InitiallyLineNode;
                        }
                        if (arrLineNodeExNew[i] > arrLineNodeNewClone[j])
                        {
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }



            //for (int i = 0; i < arrLineNodeExNew.Count; i++)
            //{
            //    if ((arrLineNodeExNew[i].InitiallyLineNode == null && arrLineNodeExNew[i].EntityID == -1) ||                      //非克隆对象
            //        (arrLineNodeExNew[i].InitiallyLineNode != null && arrLineNodeExNew[i].InitiallyLineNode.EntityID == -1))      //克隆对象
            //    {
            //        if (i > 0)
            //        {
            //            if (arrLineNodeExNew[i] == arrLineNodeExNew[i - 1])
            //            {
            //                arrLineNodeExNew[i].EntityID = arrLineNodeExNew[i - 1].EntityID;
            //                if (arrLineNodeExNew[i].InitiallyLineNode != null)
            //                {
            //                    //arrLineNodeExNew[i]是克隆对象,需要更新原始对象的标识码和方向标识
            //                    arrLineNodeExNew[i].InitiallyLineNode.EntityID = arrLineNodeExNew[i].EntityID;
            //                    arrLineNodeExNew[i].InitiallyLineNode.IsReverse = arrLineNodeExNew[i].IsReverse;
            //                }



                            
            //                continue;
            //            }
            //        }
            //        //需要创建要素编码
            //        arrLineNodeExNew[i].EntityID = this.NewEntityID;
            //        if (arrLineNodeExNew[i].InitiallyLineNode != null)
            //        {
            //            //arrLineNodeExNew[i]是克隆对象,需要更新原始对象的标识码和方向标识
            //            arrLineNodeExNew[i].InitiallyLineNode.EntityID = arrLineNodeExNew[i].EntityID;
            //            arrLineNodeExNew[i].InitiallyLineNode.IsReverse = arrLineNodeExNew[i].IsReverse;
            //        }
            //        m_VCTFile.WritePolygonLineNode(arrLineNodeExNew[i]);
            //    }
            //}
        }
        */
        ///// <summary>
        ///// 处理面实体中引用线对象的标识码
        ///// </summary>
        ///// <param name="arrLineNode">VCT线实体节点集合</param>
        //private void WritePolygonLineNodes(ref List<FileData.LineNodeEx> arrLineNode)
        //{
        //    ////按标识码、在面的边界线集合中的索引排序
        //    FileData.LineNodeExComparer lineNodeExComparer = new FileData.LineNodeExComparer();
        //    arrLineNode.Sort(lineNodeExComparer);

        //    FileData.LineNodeEx lineNode = null;
        //    for (int i = 0; i < arrLineNode.Count; i++)
        //    {
        //        if (lineNode == null)
        //        {
        //            lineNode = arrLineNode[i];
        //        }
        //        else
        //        {
        //            if (arrLineNode[i].EntityID == lineNode.EntityID)
        //            {
        //                lineNode.SegmentNodes.AddRange(arrLineNode[i].SegmentNodes);
        //            }
        //            else
        //            {
        //                m_VCTFile.WritePolygonLineNode(lineNode);
        //                lineNode = arrLineNode[i];
        //            }

        //            if (i == arrLineNode.Count - 1)
        //            {
        //                m_VCTFile.WritePolygonLineNode(lineNode);
        //            }
        //        }
        //    }
        //}

 



        /// <summary>
        /// 执行转换
        /// </summary>
        public EnumMDB2VCTExchangeInfo Exchange()
        {
            ///指示当前转换的执行位置
            int nExcutePosition = 0;
            ///1.表结构 2.点 3.线 4.面
            try
            {
                //获取PGDB数据集
                m_dataset =  m_MDBFile.GetDataset();
                if (m_dataset != null)
                {
                    //获取当前数据的最大实体标识码
                    this.m_nNewEntityID = m_dataset.GetMaxEntityID() + 1;
                    //获取VCT头节点
                    ESRIData.Projection projection = m_dataset.GetProjection();
                    if (projection != null)
                    {
                        FileData.HeadNode headNode = projection.GetHeadNode();
                        ///生成头文件错误
                        if (headNode == null)
                        {
                            return EnumMDB2VCTExchangeInfo.HEADFILEERROR;
                        }
                        //1、写入VCT头节点
                        m_VCTFile.WriteHeadNode(headNode);

                        //获取图层集合
                        ESRIData.TableLayer tableLayer;
                        m_nLayerCount = m_dataset.GetLayerCount();
                        List<FileData.FeatureCodeNode> arrFeatureCodeNode = new List<FileData.FeatureCodeNode>();
                        List<FileData.TableStructureNode> arrTableStructureNode = new List<FileData.TableStructureNode>();

                        nExcutePosition++;
                        for (int i = 0; i < m_nLayerCount; i++)
                        {
                            //获取图层对象
                            tableLayer = m_dataset.GetFeatureLayerByIndex(i);
                            //获取图层要素参数信息
                            FileData.FeatureCodeNode featureCodeNode = tableLayer.GetFeatureCodeNode();
                            arrFeatureCodeNode.Add(featureCodeNode);
                            //获取图层表结构信息
                            FileData.TableStructureNode tableStructureNode = tableLayer.StructureNode;
                            arrTableStructureNode.Add(tableStructureNode);
                        }
                        //2、写入VCT要素参数节点
                        m_VCTFile.WriteFeatureCodeNodes(arrFeatureCodeNode);
                        //3、写入VCT表结构节点
                        m_VCTFile.WriteTableStructureNode(arrTableStructureNode);

                        ///释放不在使用的对象,减少内存使用率 add by 曾平
                        //m_VCTFile.Flush();
                        arrFeatureCodeNode.Clear();
                        arrTableStructureNode.Clear();

                        nExcutePosition++;

                        //4、写入点实体节点
                        for (int i = 0; i < m_nLayerCount; i++)
                        {
                            //获取图层对象
                            tableLayer = m_dataset.GetFeatureLayerByIndex(i);
                            ESRIData.PointLayer pointLayer = tableLayer as ESRIData.PointLayer;
                            if (pointLayer != null)
                            {
                                if (pointLayer.FeatureEntys != null)
                                {
                                    for (int j = 0; j < pointLayer.FeatureEntys.Count; j++)
                                    {
                                        m_VCTFile.WritePointNode(pointLayer.FeatureEntys[j].GetEntityNode() as FileData.PointNode);
                                    }
                                }
                            }
                        }

                        nExcutePosition++;
                        ////5、写入线实体节点
                        //List<FileData.LineNode> arrLineNode = new List<FileData.LineNode>();
                        for (int i = 0; i < m_nLayerCount; i++)
                        {
                            //获取图层对象
                            tableLayer = m_dataset.GetFeatureLayerByIndex(i);
                            ESRIData.LineLayer lineLayer = tableLayer as ESRIData.LineLayer;
                            if (lineLayer != null)
                            {
                                if (lineLayer.FeatureEntys != null)
                                {
                                    for (int j = 0; j < lineLayer.FeatureEntys.Count; j++)
                                    {
                                        FileData.LineNode lineNode = lineLayer.FeatureEntys[j].GetEntityNode() as FileData.LineNode;
                                        if (lineNode != null)
                                        {
                                            m_VCTFile.WriteLineNode(lineNode);
                                        }
                                    }
                                }
                            }
                        }

                        ////处理面实体中引用线对象的标识码
                        ////List<FileData.PolygonNode> arrPolygonNode = MatchPolygonToLine(dataset, ref arrLineNode);
                        ////6、写入面实体节点
                        nExcutePosition++;
                        WritePolygonNodes pWritePolygonNodes = new WritePolygonNodes(m_dataset, this.m_pTempFile, this.m_VCTFile, this.m_nNewEntityID);
                        //pWritePolygonNodes.WriteCommplete += new WriteCommpleteEventHandler(WritePolygonNodes_WriteCommplete);
                        pWritePolygonNodes.Write();

                        WritePolygonNodes_WriteCommplete(true);
                        return EnumMDB2VCTExchangeInfo.EXCHANGESUCCESS;

                    }
                    else
                    {
                        return EnumMDB2VCTExchangeInfo.PROJCTIONERROR;
                    }
                }
                else
                {
                    return EnumMDB2VCTExchangeInfo.DATASETERROR;
                }

            }
            catch(Exception ex)
            {
                LogAPI.WriteErrorLog(ex);
                EnumMDB2VCTExchangeInfo pInfo = EnumMDB2VCTExchangeInfo.EXCHANGUNKNOWEERROR;
                if (nExcutePosition == 1)
                    pInfo = EnumMDB2VCTExchangeInfo.FEATUREINFOERROR;
                else if (nExcutePosition == 2)
                    pInfo = EnumMDB2VCTExchangeInfo.POINTERROR;
                else if (nExcutePosition == 3)
                    pInfo = EnumMDB2VCTExchangeInfo.LINEERROR;
                else if (nExcutePosition == 4)
                    pInfo = EnumMDB2VCTExchangeInfo.PLOYGONERROR;

                return pInfo;
            }
        }
Пример #4
0
        /*
        /// <summary>
        /// ������ʵ���������߶���ı�ʶ��
        /// </summary>
        /// <param name="arrLineNode">VCT��ʵ��ڵ㼯��</param>
        /// <param name="arrFeatureCode">����ͼ��Ҫ�ر��뼯��</param>
        /// <param name="arrLineNodeEx">VCT��ʵ���е���ʵ��ڵ㼯��</param>
        private void MatchPolygonToLine(ref List<FileData.LineNode> arrLineNode, List<string> arrFeatureCode, ref List<FileData.LineNodeEx> arrLineNodeEx)
        {

            if (arrFeatureCode != null && arrFeatureCode.Count > 0)
            {
                List<FileData.LineNode> arrLinkLineNode = new List<FileData.LineNode>();
                for (int i = 0; i < arrLineNode.Count; i++)
                {
                    if (arrFeatureCode.Contains(arrLineNode[i].FeatureCode))
                    {
                        arrLinkLineNode.Add(arrLineNode[i]);
                    }
                }
                if (arrLinkLineNode.Count > 0)
                {
                    //����
                    arrLinkLineNode.Sort();
                    arrLineNodeEx.Sort();

                    //���¹����ߵı�ʶ��
                    int j = 0;
                    for (int i = 0; i < arrLinkLineNode.Count; i++)
                    {
                        for (; j < arrLineNodeEx.Count; j++)
                        {
                            //������δ�ҵ���ʶ���
                            if (arrLineNodeEx[j].EntityID == -1)
                            {
                                if (arrLinkLineNode[i] == arrLineNodeEx[j])
                                {
                                    arrLineNodeEx[j].IsFromLine = true;
                                    arrLineNodeEx[j].EntityID = arrLinkLineNode[i].EntityID;
                                }
                                else if (arrLinkLineNode[i] > arrLineNodeEx[j])
                                {

                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                    }
                    //����
                    List<FileData.LineNodeEx> arrLineNodeExReverse = new List<FileData.LineNodeEx>();
                    for (int i = 0; i < arrLineNodeEx.Count; i++)
                    {
                        //������δ�ҵ���ʶ���
                        if (arrLineNodeEx[i].EntityID == -1)
                        {
                            FileData.LineNodeEx lineNodeEx = arrLineNodeEx[i];
                            lineNodeEx.Reverse();
                            arrLineNodeExReverse.Add(lineNodeEx);
                        }
                    }
                    arrLineNodeExReverse.Sort();//���������
                    j = 0;
                    for (int i = 0; i < arrLinkLineNode.Count; i++)
                    {
                        for (; j < arrLineNodeExReverse.Count; j++)
                        {
                            if (arrLinkLineNode[i] == arrLineNodeExReverse[j])
                            {
                                arrLineNodeExReverse[j].IsFromLine = true;
                                arrLineNodeExReverse[j].EntityID = arrLinkLineNode[i].EntityID;
                            }
                            else if (arrLinkLineNode[i] > arrLineNodeExReverse[j])
                            {
                            }
                            else
                            {
                                break;
                            }
                        }
                    }

                    arrLineNodeEx.Clear();
                    for (int i = 0; i < arrLineNodeExReverse.Count; i++)
                    {
                        //������δ�ҵ���ʶ���
                        if (arrLineNodeExReverse[i].EntityID == -1)
                        {
                            arrLineNodeEx.Add(arrLineNodeExReverse[i]);
                        }
                    }
                }
            }
            return arrLineNodeEx;
        }
        */
        //public FileData.LineNodeEx CloneLineNodeEx(FileData.LineNodeEx lineNodeExSource)
        //{
        //    //m_InitiallyLineNode = this;
        //    try
        //    {
        //        MemoryStream stream = new MemoryStream();
        //        BinaryFormatter formatter = new BinaryFormatter();
        //        formatter.Serialize(stream, lineNodeExSource);
        //        stream.Position = 0;
        //        FileData.LineNodeEx lineNodeEx = formatter.Deserialize(stream) as FileData.LineNodeEx;
        //        lineNodeEx.InitiallyLineNode = lineNodeExSource;
        //        return lineNodeEx;
        //    }
        //    catch (Exception ex)
        //    {
        //        LogAPI.WriteErrorLog(ex);
        //    }
        //     /*
        //    try
        //    {
        //        FileData.LineNodeEx lineNodeEx = new FileData.LineNodeEx();
        //        lineNodeEx.IsReverse = lineNodeExSource.IsReverse;
        //        lineNodeEx.PolygonID = lineNodeExSource.PolygonID;
        //        lineNodeEx.LineIndex = lineNodeExSource.LineIndex;
        //        lineNodeEx.IsFromLine = lineNodeExSource.IsFromLine;
        //        lineNodeEx.LineType = lineNodeExSource.LineType;
        //        lineNodeEx.SegmentNodes = new FileData.SegmentNodes();
        //        for (int i = 0; i < lineNodeExSource.SegmentNodes.Count; i++)
        //        {
        //            lineNodeEx.SegmentNodes.Add(lineNodeExSource.SegmentNodes[i]);
        //            //BrokenLineNode brokenLineNode1 = this.SegmentNodes[i] as BrokenLineNode;
        //            //if (brokenLineNode1 != null)
        //            //{
        //            //    BrokenLineNode brokenLineNode2 = new BrokenLineNode();
        //            //    brokenLineNode2.PointInfoNodes = new PointInfoNodes();
        //            //    for (int j = 0; j < brokenLineNode1.PointInfoNodes.Count; j++)
        //            //    {
        //            //        PointInfoNode pointInfoNode = new PointInfoNode();
        //            //        pointInfoNode.X = brokenLineNode1.PointInfoNodes[j].X;
        //            //        pointInfoNode.Y = brokenLineNode1.PointInfoNodes[j].Y;
        //            //        brokenLineNode2.PointInfoNodes.Add(pointInfoNode);
        //            //    }
        //            //    lineNodeEx.SegmentNodes.Add(brokenLineNode2);
        //            //}
        //        }
        //        lineNodeEx.EntityID = lineNodeExSource.EntityID;
        //        lineNodeEx.FeatureCode = lineNodeExSource.FeatureCode;
        //        lineNodeEx.Representation = lineNodeExSource.Representation;
        //        lineNodeEx.InitiallyLineNode = lineNodeExSource;
        //        return lineNodeEx;
        //    }
        //    catch (Exception ex)
        //    {
        //        LogAPI.WriteErrorLog(ex);
        //    }*/
        //    return null;
        //}
        /*

        /// <summary>
        /// ������ʵ���������߶���ı�ʶ��
        /// </summary>
        /// <param name="arrLineNodeExNew">VCT��ʵ���е���ʵ��ڵ㼯�ϣ���Ҫ�½���</param>
        private void MatchPolygonToLine(ref List<FileData.LineNodeEx> arrLineNodeExNew)
        {
            List<FileData.LineNodeEx> arrLineNodeNewClone = new List<VCT.FileData.LineNodeEx>();
            for (int i = 0; i < arrLineNodeExNew.Count; i++)
            {
                //��¡���󣬲�����
                FileData.LineNodeEx lineNodeEx = CloneLineNodeEx(arrLineNodeExNew[i]);//.Clone() as FileData.LineNodeEx;
                if (lineNodeEx != null)
                {
                    lineNodeEx.Reverse();
                    arrLineNodeNewClone.Add(lineNodeEx);
                }
            }

            arrLineNodeExNew.Sort();
            arrLineNodeNewClone.Sort();

            int j = 0;
            for (int i = 0; i < arrLineNodeExNew.Count; i++)
            {
                if (arrLineNodeExNew[i].EntityID == -1)
                {
                    //��Ҫ����Ҫ�ر���
                    arrLineNodeExNew[i].EntityID = this.m_nNewEntityID;
                    ////δ���ϲ�����
                    //m_VCTFile.WritePolygonLineNode(arrLineNodeExNew[i]);
                }
                for (; j < arrLineNodeNewClone.Count; j++)
                {
                    if (arrLineNodeNewClone[j].InitiallyLineNode.EntityID == -1)
                    {
                        if (arrLineNodeExNew[i] == arrLineNodeNewClone[j])
                        {
                            arrLineNodeNewClone[j].InitiallyLineNode.EntityID = arrLineNodeExNew[i].EntityID;
                            arrLineNodeNewClone[j].InitiallyLineNode.Reverse();
                            //arrLineNodeNewClone[j].InitiallyLineNode.IsReverse = arrLineNodeNewClone[j].IsReverse;

                            arrLineNodeNewClone[j].InitiallyLineNode.OtherPolygonLineNode = arrLineNodeExNew[i];
                            arrLineNodeExNew[i].OtherPolygonLineNode = arrLineNodeNewClone[j].InitiallyLineNode;
                        }
                        if (arrLineNodeExNew[i] > arrLineNodeNewClone[j])
                        {
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }

            //for (int i = 0; i < arrLineNodeExNew.Count; i++)
            //{
            //    if ((arrLineNodeExNew[i].InitiallyLineNode == null && arrLineNodeExNew[i].EntityID == -1) ||                      //�ǿ�¡����
            //        (arrLineNodeExNew[i].InitiallyLineNode != null && arrLineNodeExNew[i].InitiallyLineNode.EntityID == -1))      //��¡����
            //    {
            //        if (i > 0)
            //        {
            //            if (arrLineNodeExNew[i] == arrLineNodeExNew[i - 1])
            //            {
            //                arrLineNodeExNew[i].EntityID = arrLineNodeExNew[i - 1].EntityID;
            //                if (arrLineNodeExNew[i].InitiallyLineNode != null)
            //                {
            //                    //arrLineNodeExNew[i]�ǿ�¡������Ҫ����ԭʼ����ı�ʶ��ͷ����ʶ
            //                    arrLineNodeExNew[i].InitiallyLineNode.EntityID = arrLineNodeExNew[i].EntityID;
            //                    arrLineNodeExNew[i].InitiallyLineNode.IsReverse = arrLineNodeExNew[i].IsReverse;
            //                }

            //                continue;
            //            }
            //        }
            //        //��Ҫ����Ҫ�ر���
            //        arrLineNodeExNew[i].EntityID = this.NewEntityID;
            //        if (arrLineNodeExNew[i].InitiallyLineNode != null)
            //        {
            //            //arrLineNodeExNew[i]�ǿ�¡������Ҫ����ԭʼ����ı�ʶ��ͷ����ʶ
            //            arrLineNodeExNew[i].InitiallyLineNode.EntityID = arrLineNodeExNew[i].EntityID;
            //            arrLineNodeExNew[i].InitiallyLineNode.IsReverse = arrLineNodeExNew[i].IsReverse;
            //        }
            //        m_VCTFile.WritePolygonLineNode(arrLineNodeExNew[i]);
            //    }
            //}
        }
        */
        ///// <summary>
        ///// ������ʵ���������߶���ı�ʶ��
        ///// </summary>
        ///// <param name="arrLineNode">VCT��ʵ��ڵ㼯��</param>
        //private void WritePolygonLineNodes(ref List<FileData.LineNodeEx> arrLineNode)
        //{
        //    ////����ʶ�롢����ı߽��߼����е���������
        //    FileData.LineNodeExComparer lineNodeExComparer = new FileData.LineNodeExComparer();
        //    arrLineNode.Sort(lineNodeExComparer);
        //    FileData.LineNodeEx lineNode = null;
        //    for (int i = 0; i < arrLineNode.Count; i++)
        //    {
        //        if (lineNode == null)
        //        {
        //            lineNode = arrLineNode[i];
        //        }
        //        else
        //        {
        //            if (arrLineNode[i].EntityID == lineNode.EntityID)
        //            {
        //                lineNode.SegmentNodes.AddRange(arrLineNode[i].SegmentNodes);
        //            }
        //            else
        //            {
        //                m_VCTFile.WritePolygonLineNode(lineNode);
        //                lineNode = arrLineNode[i];
        //            }
        //            if (i == arrLineNode.Count - 1)
        //            {
        //                m_VCTFile.WritePolygonLineNode(lineNode);
        //            }
        //        }
        //    }
        //}
        /// <summary>
        /// ִ��ת��
        /// </summary>
        public EnumMDB2VCTExchangeInfo Exchange()
        {
            ///ָʾ��ǰת����ִ��λ��
            int nExcutePosition = 0;
            ///1.��ṹ 2.�� 3.�� 4.��
            try
            {
                //��ȡPGDB���ݼ�
                m_dataset =  m_MDBFile.GetDataset();
                if (m_dataset != null)
                {
                    //��ȡ��ǰ���ݵ����ʵ���ʶ��
                    this.m_nNewEntityID = m_dataset.GetMaxEntityID() + 1;
                    //��ȡVCTͷ�ڵ�
                    ESRIData.Projection projection = m_dataset.GetProjection();
                    if (projection != null)
                    {
                        FileData.HeadNode headNode = projection.GetHeadNode();
                        ///����ͷ�ļ�����
                        if (headNode == null)
                        {
                            return EnumMDB2VCTExchangeInfo.HEADFILEERROR;
                        }
                        //1��д��VCTͷ�ڵ�
                        m_VCTFile.WriteHeadNode(headNode);

                        //��ȡͼ�㼯��
                        ESRIData.TableLayer tableLayer;
                        m_nLayerCount = m_dataset.GetLayerCount();
                        List<FileData.FeatureCodeNode> arrFeatureCodeNode = new List<FileData.FeatureCodeNode>();
                        List<FileData.TableStructureNode> arrTableStructureNode = new List<FileData.TableStructureNode>();

                        nExcutePosition++;
                        for (int i = 0; i < m_nLayerCount; i++)
                        {
                            //��ȡͼ�����
                            tableLayer = m_dataset.GetFeatureLayerByIndex(i);
                            //��ȡͼ��Ҫ�ز�����Ϣ
                            FileData.FeatureCodeNode featureCodeNode = tableLayer.GetFeatureCodeNode();
                            arrFeatureCodeNode.Add(featureCodeNode);
                            //��ȡͼ���ṹ��Ϣ
                            FileData.TableStructureNode tableStructureNode = tableLayer.StructureNode;
                            arrTableStructureNode.Add(tableStructureNode);
                        }
                        //2��д��VCTҪ�ز����ڵ�
                        m_VCTFile.WriteFeatureCodeNodes(arrFeatureCodeNode);
                        //3��д��VCT��ṹ�ڵ�
                        m_VCTFile.WriteTableStructureNode(arrTableStructureNode);

                        ///�ͷŲ���ʹ�õĶ��󣬼����ڴ�ʹ���� add by ��ƽ
                        //m_VCTFile.Flush();
                        arrFeatureCodeNode.Clear();
                        arrTableStructureNode.Clear();

                        nExcutePosition++;

                        //4��д���ʵ��ڵ�
                        for (int i = 0; i < m_nLayerCount; i++)
                        {
                            //��ȡͼ�����
                            tableLayer = m_dataset.GetFeatureLayerByIndex(i);
                            ESRIData.PointLayer pointLayer = tableLayer as ESRIData.PointLayer;
                            if (pointLayer != null)
                            {
                                if (pointLayer.FeatureEntys != null)
                                {
                                    for (int j = 0; j < pointLayer.FeatureEntys.Count; j++)
                                    {
                                        m_VCTFile.WritePointNode(pointLayer.FeatureEntys[j].GetEntityNode() as FileData.PointNode);
                                    }
                                }
                            }
                        }

                        nExcutePosition++;
                        ////5��д����ʵ��ڵ�
                        //List<FileData.LineNode> arrLineNode = new List<FileData.LineNode>();
                        for (int i = 0; i < m_nLayerCount; i++)
                        {
                            //��ȡͼ�����
                            tableLayer = m_dataset.GetFeatureLayerByIndex(i);
                            ESRIData.LineLayer lineLayer = tableLayer as ESRIData.LineLayer;
                            if (lineLayer != null)
                            {
                                if (lineLayer.FeatureEntys != null)
                                {
                                    for (int j = 0; j < lineLayer.FeatureEntys.Count; j++)
                                    {
                                        FileData.LineNode lineNode = lineLayer.FeatureEntys[j].GetEntityNode() as FileData.LineNode;
                                        if (lineNode != null)
                                        {
                                            m_VCTFile.WriteLineNode(lineNode);
                                        }
                                    }
                                }
                            }
                        }

                        ////������ʵ���������߶���ı�ʶ��
                        ////List<FileData.PolygonNode> arrPolygonNode = MatchPolygonToLine(dataset, ref arrLineNode);
                        ////6��д����ʵ��ڵ�
                        nExcutePosition++;
                        WritePolygonNodes pWritePolygonNodes = new WritePolygonNodes(m_dataset, this.m_pTempFile, this.m_VCTFile, this.m_nNewEntityID);
                        //pWritePolygonNodes.WriteCommplete += new WriteCommpleteEventHandler(WritePolygonNodes_WriteCommplete);
                        pWritePolygonNodes.Write();

                        WritePolygonNodes_WriteCommplete(true);
                        return EnumMDB2VCTExchangeInfo.EXCHANGESUCCESS;

                    }
                    else
                    {
                        return EnumMDB2VCTExchangeInfo.PROJCTIONERROR;
                    }
                }
                else
                {
                    return EnumMDB2VCTExchangeInfo.DATASETERROR;
                }

            }
            catch(Exception ex)
            {
                Logger.WriteErrorLog(ex);
                EnumMDB2VCTExchangeInfo pInfo = EnumMDB2VCTExchangeInfo.EXCHANGUNKNOWEERROR;
                if (nExcutePosition == 1)
                    pInfo = EnumMDB2VCTExchangeInfo.FEATUREINFOERROR;
                else if (nExcutePosition == 2)
                    pInfo = EnumMDB2VCTExchangeInfo.POINTERROR;
                else if (nExcutePosition == 3)
                    pInfo = EnumMDB2VCTExchangeInfo.LINEERROR;
                else if (nExcutePosition == 4)
                    pInfo = EnumMDB2VCTExchangeInfo.PLOYGONERROR;

                return pInfo;
            }
        }