Exemplo n.º 1
0
        /// <summary>
        /// 将要素类添加到拓扑中,针对针对特殊的要素类检查
        /// </summary>
        /// <param name="pTopo">拓扑</param>
        /// <param name="pFeatureDataset">数据集</param>
        /// <param name="pFeaClsName">图层名</param>
        /// <param name="outError">异常</param>
        public void AddClasstoTopology(ITopology pTopo, IFeatureDataset pFeatureDataset, string pFeaClsName, out Exception outError)
        {
            outError = null;

            try
            {
                ITopologyRuleContainer pTopoRulrContainer = pTopo as ITopologyRuleContainer;
                List <IDataset>        LstDataSet         = ModDBOperator.GetAllFeaCls(pFeatureDataset);
                bool b = false;

                //遍历要素类,将符合条件的要素类添加到拓扑中
                foreach (IDataset pDt in LstDataSet)
                {
                    IFeatureClass pFeaCls = pDt as IFeatureClass;
                    if (pFeaCls == null)
                    {
                        continue;
                    }
                    if (pFeaCls.FeatureType != esriFeatureType.esriFTSimple)
                    {
                        continue;
                    }
                    string pFeaName = pDt.Name.Trim();
                    if (pFeaName.Contains("."))
                    {
                        pFeaName = pFeaName.Substring(pFeaName.IndexOf('.') + 1);
                    }
                    if (pFeaName == pFeaClsName)
                    {
                        pTopo.AddClass(pFeaCls as IClass, 5, 1, 1, false);
                        b = true;
                        break;
                    }
                }
                if (b == false)
                {
                    outError = new Exception("要进行检查的要素类不存在!");
                    ////*********************************************
                    ////guozheng 2010-12-24 平安夜  added 系统异常日志
                    //if (ModData.SysLog == null) ModData.SysLog = new clsWriteSystemFunctionLog();
                    //ModData.SysLog.Write(outError);
                    ////**********************************************
                    return;
                }
            }
            catch (Exception ex)
            {
                ////*********************************************
                ////guozheng 2010-12-24 平安夜  added 系统异常日志
                //if (ModData.SysLog == null) ModData.SysLog = new clsWriteSystemFunctionLog();
                //ModData.SysLog.Write(ex);
                ////**********************************************
                outError = ex;
            }
        }