2 3   4    Y 5    c:adFile 6     从空间数据库中删除所有拓扑对象 - 11GX
首页 > 从空间数据库中删除所有拓扑对象

从空间数据库中删除所有拓扑对象

  1. /// 
  2.         /// //从空间数据库中删除所有拓扑对象
  3.         /// 
  4.         /// 
  5.         public bool DeleteALLTopolgyFromGISDB()
  6.         {
  7.             bool rbc = true;
  8.             try
  9.             {
  10.                 IWorkspace ws = this.DefaultWorkSpace;
  11.                 if (ws != null)
  12.                 {
  13.                     //读取所有拓扑
  14.                     IEnumDataset topEnumDataset = this.getEnumDataset(ws);
  15.                     if (topEnumDataset != null)
  16.                     {
  17.                         topEnumDataset.Reset();
  18.                         IDataset ds = topEnumDataset.Next();
  19.                         while (ds != null)
  20.                         {
  21.                             switch (ds.Type)
  22.                             {
  23.                                 case esriDatasetType.esriDTFeatureDataset:
  24.                                     if (ds is ITopologyContainer)
  25.                                     {
  26.                                         ITopologyContainer topContainer = ds as ITopologyContainer;
  27.                                         ISchemaLock schemaLock = (ISchemaLock)ds;
  28.                                         try
  29.                                         {
  30.                                             schemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
  31.                                             int tc = topContainer.TopologyCount;
  32.                                             for (int i = tc - 1; i >= 0; i--)
  33.                                             {
  34.                                                 ITopology top = topContainer.get_Topology(i);
  35.                                                 if (top != null && top is IDataset)
  36.                                                 {
  37.                                                     //delete top's ITopologyRuleContainer 
  38.                                                     ITopologyRuleContainer topruleList = top as ITopologyRuleContainer;
  39.                                                     IEnumRule ER = topruleList.Rules;
  40.                                                     ER.Reset();
  41.                                                     IRule r = ER.Next();
  42.                                                     while (r != null && r is ITopologyRule)
  43.                                                     {
  44.                                                         topruleList.DeleteRule(r as ITopologyRule);
  45.                                                         r = ER.Next();
  46.                                                     }
  47.                                                     //delete top's featureclass
  48.                                                     IFeatureClassContainer topFcList = top as IFeatureClassContainer;
  49.                                                     for (int d = topFcList.ClassCount - 1; d >= 0; d--)
  50.                                                     {
  51.                                                         top.RemoveClass(topFcList.get_Class(d) as IClass);
  52.                                                     }
  53.                                                     //delete top object
  54.                                                     (top as IDataset).Delete();
  55.                                                     rbc = true;
  56.                                                 }
  57.                                             }
  58.                                         }
  59.                                         catch (Exception ex)
  60.                                         {
  61.                                             AppLogErrWrite.WriteErrLog(ex.ToString());
  62.                                         }
  63.                                         finally 
  64.                                         {
  65.                                             schemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
  66.                                         }
  67.                                     }
  68.                                     break;
  69.                                 case esriDatasetType.esriDTFeatureClass:
  70.                                     break;
  71.                             }
  72.                             System.Runtime.InteropServices.Marshal.ReleaseComObject(ds);
  73.                             ds = topEnumDataset.Next();
  74.                         }
  75.                         System.Runtime.InteropServices.Marshal.ReleaseComObject(topEnumDataset);
  76.                     }//
  77.                 } //end ws!=null
  78.             }
  79.             catch (Exception ee)
  80.             {
  81.                 rbc = false;
  82.                 AppLogErrWrite.WriteErrLog(ee.ToString());
  83.             }
  84.             return rbc;
  85.         }

转载于:https://www.cnblogs.com/sqlite3/archive/2008/09/17/2566996.html

更多相关:

  • shell脚本在系统启动时推后台自动执行,发现其中/usr/bin/top -n 1 -c -b -u ceph 命令并无输出 但是系统启动之后手动执行脚本,&推后台脚本中的top仍然能够正常输出,仅仅是系统发生重启,该功能就不生效了 stackoverflow 推荐增加 -w 参数 即/usr/bin/top -n 1 -c -...

  •     最近一直在学习三层架构,前些天同样也写了一篇同样的博客,今天主要是通过一个登录的实例给大家讲解每部分的作用和相应代码的实现。     先将实现三层架构的UML图给大家,帮助大家更好的理解三层。               1. UI作用 (1) 向用户展示特定业务数据 (2) 采集用户的输入信息和操作 Publ...

  •  经常看见MOP上有人贴那种动态的图片,就是把一个字符串作为参数传给一个动态网页,就会生成一个带有这个字符串的图片,这个叫做文字水印。像什么原来的熊猫系列,还有后来的大树和金条,都挺有意思。这东西看着挺好玩的,想做个玩玩。查了查资料,发现用.net来做这个是很容易的,就用Asp.net写了一个非常简单的。全部的代码如下: <%@...

  • 那天去了达内,试听了2个小时的课,刚好讲的他们的当当网项目,讲hibernate表关系映射这段来了,不过也够呛,投影仪看的眼睛点都不舒服,当时讲的也没认真听,听了个大概,就记住那个老师一句话了,说是有经验的人用的,一般人不告诉,就是说这个join fetch 用法,回来查了一下,用起来比较爽,今晚突然来了兴致,小记一下。 join f...

  •           这两天在和斌做后台中的报表,暂定使用水晶报表,目前还只是处于对水晶报表的初级应用阶段,也就是知道如何 汇个总、写个函数、传个参数。           问题总是层出不穷,在最后整合报表,进行报表显示测试的时候,发现每次更新数据显示(除第一次)时都会蹦出一个“登录数据库的信息提示界面”很是苦闷,并且这肯�...

  •  1 2 3   4    Y 5    c:adFile 6