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