Beispiel #1
0
		/// <summary>
		/// 创建空间图层
		/// </summary>
		/// <param name="tableStructureNode">VCT表结构节点</param>
		/// <param name="featureCodeNode">VCT要素编码节点</param>
		private FeatureLayer CreateFeatureLayer(TableStructureNode tableStructureNode, FeatureCodeNode featureCodeNode)
        {
            try
            {
                FeatureLayer featureLayer = null;
                ///获取要素集
                IFeatureDataset featureDataset = m_pIDataset as IFeatureDataset;


                //从配置文件读取图形类型
                string sGeometryType = "";
                Metadata.MetaTable pMetaTalbe = Metadata.MetaDataFile.MetaTabls[tableStructureNode.TableName] as Metadata.MetaTable;
                if (pMetaTalbe != null)
                {
                    sGeometryType = Metadata.MetaDataFile.GraphConfig.GetGraphTypeMark(pMetaTalbe.Type);
                }
                else
                {
                    Logger.WriteLog("未能获取【" + tableStructureNode.TableName + "】的图形类型!");
                    return null;
                }
                ///创建点实体
                if (sGeometryType == "Point")
                {
                    featureLayer = new PointLayer();
                   
                }
                 ///创建线实体
                else if (sGeometryType == "Line")
                {
                    featureLayer = new LineLayer();
                  
                }
                ///创建面实体
                else if (sGeometryType == "Polygon")
                {
                    featureLayer = new PolygonLayer();
                }
                else if (sGeometryType == "Annotation")
                {
                    featureLayer = new AnnotationLayer();
                }

                if (featureLayer != null)
                {
                    featureLayer.StructureNode = tableStructureNode;

                    IFeatureClass pFcls = CreateFeatureClass(featureDataset, tableStructureNode, featureCodeNode);
                    featureLayer.Table = pFcls as ITable;
                    featureLayer.UpdateFieldIndex();
                    return featureLayer;
                }
            }
            catch(Exception ex)
            {
                Logger.WriteErrorLog(ex);
            }
            return null;
        }
Beispiel #2
0
        /// <summary>
        /// ��mdb��vctת��ʱ����ʼ��ͼ���б�
        /// </summary>
        private bool InitialFeatureList()
        {
            try
            {
                if (m_pIDataset == null)
                    return false;
                m_FeatureList = new List<TableLayer>();
                IEnumDataset pEnumDataset = m_pIDataset.Subsets;
                IDataset pSet = pEnumDataset.Next();
                while (pSet != null)
                {
                    FeatureLayer pFeatureLayer = null;
                    IFeatureClass pFeatureCls = pSet as IFeatureClass;

                    string sGeometryType = "";
                    ///�������ļ���ȡҪ������
                    Metadata.MetaTable pMetaTable = Metadata.MetaDataFile.MetaTabls[pSet.Name] as Metadata.MetaTable;
                    if (pMetaTable != null)
                    {
                        sGeometryType = pMetaTable.Type;
                    }
                    else
                    {
                        ///��������ڱ�׼�������򲻴���
                        pSet = pEnumDataset.Next();
                        continue;
                    }
                    ///����Ҫ�����ʹ���vct�ռ����ݽڵ�
                    esriGeometryType pFeatureType = pFeatureCls.ShapeType;
                    if (pFeatureType == esriGeometryType.esriGeometryLine
                        || pFeatureType == esriGeometryType.esriGeometryPolyline)
                    {
                        ///�����߽ڵ�
                        pFeatureLayer = new LineLayer();
                        if (sGeometryType == "")
                            sGeometryType = "Line";
                    }
                    else if (pFeatureType == esriGeometryType.esriGeometryPolygon)
                    {
                        //������ڵ�
                        pFeatureLayer = new PolygonLayer();
                          if (sGeometryType == "")
                            sGeometryType = "Polygon";
                    }
                    else if (pFeatureType == esriGeometryType.esriGeometryPoint)
                    {
                        pFeatureLayer = new PointLayer();
                        if (sGeometryType == "")
                            sGeometryType = "Point";
                    }

                    ////ע��ͼ��
                    if (pFeatureCls.FeatureType == esriFeatureType.esriFTAnnotation)
                    {
                        pFeatureLayer = new AnnotationLayer();
                        pFeatureLayer.GeometryType = "Annotation";
                    }

                    pFeatureLayer.CutGeometry =m_cutGeometry;
                    //�ҽӿռ����ݱ�
                    pFeatureLayer.Table = pSet as ITable;
                    pFeatureLayer.GeometryType = sGeometryType;
                    pFeatureLayer.IsCut = m_bCut;
                    pFeatureLayer.FeatureCode = MetaDataFile.GetFeatureCodeByName(pSet.Name);
                    pFeatureLayer.UpdateFieldIndex();

                    m_FeatureList.Add(pFeatureLayer);
                    pSet = pEnumDataset.Next();
                }

                ///�������Ա����
                IEnumDataset pAttriTalbelDataSet=  m_pIWorkspace.get_Datasets(esriDatasetType.esriDTTable);
                IDataset pAttriDataset = pAttriTalbelDataSet.Next();
                while (pAttriDataset != null)
                 {
                        TableLayer pAttributeTalbe = new TableLayer();

                        ///�������ļ���ȡҪ������
                        Metadata.MetaTable pMetaTable = Metadata.MetaDataFile.MetaTabls[pAttriDataset.Name] as Metadata.MetaTable;
                        if (pMetaTable != null)
                        {
                            pAttributeTalbe.GeometryType = pMetaTable.Type;
                            pAttributeTalbe.Table = pAttriDataset as ITable;
                            pAttributeTalbe.UpdateFieldIndex();
                            m_FeatureList.Add(pAttributeTalbe);
                        }
                     pAttriDataset = pAttriTalbelDataSet.Next();
                 }
                return true;
            }
            catch (Exception ex)
            {
                LogAPI.WriteErrorLog(ex);
                return false;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 从mdb到vct转换时,初始化图层列表
        /// </summary>
        private bool InitialFeatureList()
        {
            try
            {
                if (m_pIDataset == null)
                    return false;
                m_FeatureList = new List<TableLayer>();
                IEnumDataset pEnumDataset = m_pIDataset.Subsets;
                IDataset pSet = pEnumDataset.Next();
                while (pSet != null)
                {
                    FeatureLayer pFeatureLayer = null;
                    IFeatureClass pFeatureCls = pSet as IFeatureClass;


                    string sGeometryType = "";
                    ///从配置文件获取要素类型
                    Metadata.MetaTable pMetaTable = Metadata.MetaDataFile.MetaTabls[pSet.Name] as Metadata.MetaTable;
                    if (pMetaTable != null)
                    {
                        sGeometryType = pMetaTable.Type;
                    }
                    else
                    {
                        ///如果不属于标准的数据则不处理
                        pSet = pEnumDataset.Next();
                        continue;
                    }
                    ///根据要素类型创建vct空间数据节点
                    esriGeometryType pFeatureType = pFeatureCls.ShapeType;
                    if (pFeatureType == esriGeometryType.esriGeometryLine
                        || pFeatureType == esriGeometryType.esriGeometryPolyline)
                    {
                        ///构造线节点
                        pFeatureLayer = new LineLayer();
                        if (sGeometryType == "")
                            sGeometryType = "Line";
                    }
                    else if (pFeatureType == esriGeometryType.esriGeometryPolygon)
                    {
                        //构造面节点
                        pFeatureLayer = new PolygonLayer();
                          if (sGeometryType == "")
                            sGeometryType = "Polygon"; 
                    }
                    else if (pFeatureType == esriGeometryType.esriGeometryPoint)
                    {
                        pFeatureLayer = new PointLayer();
                        if (sGeometryType == "")
                            sGeometryType = "Point"; 
                    }
                   
                    ////注记图层
                    if (pFeatureCls.FeatureType == esriFeatureType.esriFTAnnotation)
                    {
                        pFeatureLayer = new AnnotationLayer();
                        pFeatureLayer.GeometryType = "Annotation";
                    }

                    pFeatureLayer.CutGeometry =m_cutGeometry;
                    //挂接空间数据表
                    pFeatureLayer.Table = pSet as ITable;
                    pFeatureLayer.GeometryType = sGeometryType;
                    pFeatureLayer.IsCut = m_bCut;
                    pFeatureLayer.FeatureCode = MetaDataFile.GetFeatureCodeByName(pSet.Name);
                    pFeatureLayer.UpdateFieldIndex();

                    m_FeatureList.Add(pFeatureLayer);
                    pSet = pEnumDataset.Next();
                }

                ///处理属性表集合
                IEnumDataset pAttriTalbelDataSet=  m_pIWorkspace.get_Datasets(esriDatasetType.esriDTTable);
                IDataset pAttriDataset = pAttriTalbelDataSet.Next();
                while (pAttriDataset != null)
                 {
                        TableLayer pAttributeTalbe = new TableLayer();

                        ///从配置文件获取要素类型
                        Metadata.MetaTable pMetaTable = Metadata.MetaDataFile.MetaTabls[pAttriDataset.Name] as Metadata.MetaTable;
                        if (pMetaTable != null)
                        {
                            pAttributeTalbe.GeometryType = pMetaTable.Type;
                            pAttributeTalbe.Table = pAttriDataset as ITable;
                            pAttributeTalbe.UpdateFieldIndex();
                            m_FeatureList.Add(pAttributeTalbe);
                        }
                     pAttriDataset = pAttriTalbelDataSet.Next();
                 }
                return true;
            }
            catch (Exception ex)
            {
                LogAPI.WriteErrorLog(ex);
                return false;
            }
        }
Beispiel #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)
            {
                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;
            }
        }
Beispiel #5
0
        /// <summary>
        /// �����ռ�ͼ��
        /// </summary>
        /// <param name="tableStructureNode">VCT��ṹ�ڵ�</param>
        /// <param name="featureCodeNode">VCTҪ�ر���ڵ�</param>
        private FeatureLayer CreateFeatureLayer(TableStructureNode tableStructureNode, FeatureCodeNode featureCodeNode)
        {
            try
            {
                FeatureLayer featureLayer = null;
                ///��ȡҪ�ؼ�
                IFeatureDataset featureDataset = m_pIDataset as IFeatureDataset;

                //�������ļ���ȡͼ������
                string sGeometryType = "";
                Metadata.MetaTable pMetaTalbe = Metadata.MetaDataFile.MetaTabls[tableStructureNode.TableName] as Metadata.MetaTable;
                if (pMetaTalbe != null)
                {
                    sGeometryType = Metadata.MetaDataFile.GraphConfig.GetGraphTypeMark(pMetaTalbe.Type);
                }
                else
                {
                    LogAPI.WriteLog("δ�ܻ�ȡ��" + tableStructureNode.TableName + "����ͼ�����ͣ�");
                    return null;
                }
                ///������ʵ��
                if (sGeometryType == "Point")
                {
                    featureLayer = new PointLayer();

                }
                 ///������ʵ��
                else if (sGeometryType == "Line")
                {
                    featureLayer = new LineLayer();

                }
                ///������ʵ��
                else if (sGeometryType == "Polygon")
                {
                    featureLayer = new PolygonLayer();
                }
                else if (sGeometryType == "Annotation")
                {
                    featureLayer = new AnnotationLayer();
                }

                if (featureLayer != null)
                {
                    featureLayer.StructureNode = tableStructureNode;

                    IFeatureClass pFcls = CreateFeatureClass(featureDataset, tableStructureNode, featureCodeNode);
                    featureLayer.Table = pFcls as ITable;
                    featureLayer.UpdateFieldIndex();
                    return featureLayer;
                }
            }
            catch(Exception ex)
            {
                LogAPI.WriteErrorLog(ex);
            }
            return null;
        }