当前位置: 首页>>代码示例>>C#>>正文


C# Utilities.StopEditing方法代码示例

本文整理汇总了C#中Utilities.StopEditing方法的典型用法代码示例。如果您正苦于以下问题:C# Utilities.StopEditing方法的具体用法?C# Utilities.StopEditing怎么用?C# Utilities.StopEditing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utilities的用法示例。


在下文中一共展示了Utilities.StopEditing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnClick

        protected override void OnClick()
        {
            IApplication pApp;
              ICadastralFabric m_pCadaFab;
              IQueryFilter m_pQF;

              #region Get Fabric

              pApp = (IApplication)ArcMap.Application;
              if (pApp == null)
            //if the app is null then could be running from ArcCatalog
            pApp = (IApplication)ArcCatalog.Application;

              if (pApp == null)
              {
            MessageBox.Show("Could not access the application.", "No Application found");
            return;
              }

              IGxApplication pGXApp = (IGxApplication)pApp;
              stdole.IUnknown pUnk = null;
              try
              {
            pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
              }
              catch (COMException ex)
              {
            if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
            ex.ErrorCode == -2147220944)
              MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
            else
              MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
            return;
              }

              if (pUnk is ICadastralFabric)
            m_pCadaFab = (ICadastralFabric)pUnk;
              else
              {
            MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
            return;
              }
              #endregion

              IFeatureClass pFabricPointClass = (IFeatureClass)m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTPoints);
              IDataset pDS = (IDataset)pFabricPointClass;
              IWorkspace pWS = pDS.Workspace;

              bool bIsFileBasedGDB = true;
              bool bIsUnVersioned = true;
              Utilities FabricUTILS = new Utilities();
              FabricUTILS.GetFabricPlatform(pWS, m_pCadaFab, out bIsFileBasedGDB,
            out bIsUnVersioned);

              if (!FabricUTILS.StartEditing(pWS, bIsUnVersioned))
            return;
              m_pQF = new QueryFilterClass();
              m_pQF.WhereClause = "";
              int iChangePointCount = 0;
              try
              {
            //next need to use an in clause to update the points, ...
            ICadastralFabricSchemaEdit2 pSchemaEd = (ICadastralFabricSchemaEdit2)m_pCadaFab;
            pSchemaEd.ReleaseReadOnlyFields((ITable)pFabricPointClass, esriCadastralFabricTable.esriCFTPoints);

            IGeoDataset pGeoDS = (IGeoDataset)pFabricPointClass;
            ISpatialReferenceTolerance pSRTol = (ISpatialReferenceTolerance)pGeoDS.SpatialReference;
            double dTolerance = pSRTol.XYTolerance;

            if (!UpdatePointXYFromGeometry((ITable)pFabricPointClass, m_pQF, (bIsUnVersioned || bIsFileBasedGDB), dTolerance, out iChangePointCount))
            {
              FabricUTILS.AbortEditing(pWS);
              return;
            }

            FabricUTILS.StopEditing(pWS);
            pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTPoints);

            MessageBox.Show("Updated " + iChangePointCount.ToString() + " points that had coordinates different" + Environment.NewLine +"from their geometry by more than " +
              dTolerance.ToString("0.00000000").TrimEnd('0'),"Coordinate Inverse", MessageBoxButtons.OK, MessageBoxIcon.Information);
              }
              catch (Exception ex)
              {
            MessageBox.Show(ex.Message);
            FabricUTILS.AbortEditing(pWS);
              }
              finally
              {
              }
        }
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:90,代码来源:CoordinateInverse.cs


注:本文中的Utilities.StopEditing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。