本文整理汇总了C#中ESRI.GetAllProperties方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.GetAllProperties方法的具体用法?C# ESRI.GetAllProperties怎么用?C# ESRI.GetAllProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ESRI
的用法示例。
在下文中一共展示了ESRI.GetAllProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenFeatureClass
public ESRI.ArcGIS.Geodatabase.IFeatureClass OpenFeatureClass(ESRI.ArcGIS.esriSystem.IPropertySet DatabasePropertySet, string FeatureclassName)
{
ESRI.ArcGIS.Geodatabase.IWorkspace sourceWorkspace = null;
ESRI.ArcGIS.Geodatabase.IFeatureWorkspace sourceFeatureWorkspace = null;
try
{
// Establish a Connection to the Geodatabase that houses the Feature Class.
int propertiesCount = DatabasePropertySet.Count;
System.Object[] propNamesArray = new System.Object[1];
System.Object[] propValuesArray = new System.Object[1];
DatabasePropertySet.GetAllProperties(out propNamesArray[0], out propValuesArray[0]);
System.Object[] propertyNames = (System.Object[])propNamesArray[0];
System.Object[] propertyValues = (System.Object[])propValuesArray[0];
bool itsEnterprise = false;
for (int i = 0; i < propertiesCount; i++)
{
if (System.String.Compare("INSTANCE", propertyNames[i].ToString(), System.StringComparison.CurrentCultureIgnoreCase) == 0)
{
if (!System.String.IsNullOrEmpty(propertyValues[i].ToString()))
{
itsEnterprise = true;
}
}
}
if (itsEnterprise)
{
// The Property Set is an Enterprise Geodatabase Property Set, so establish an Enterprise Geodatabase Connection.
sourceWorkspace = EstablishEnterpriseGeoDBConnection(DatabasePropertySet);
}
else
{
// The Property Set is a File Geodatabase Property Set, so establish a File Geodatabase Connection.
sourceWorkspace = EstablishFileGeodatabaseConnection(DatabasePropertySet);
}
// Make sure the Source Workspace was opened successfully.
if (sourceWorkspace == null)
{
// Let the User know that this method failed.
if (ErrorMessage != null)
{
ErrorMessage("Could not establish a connection to the Specified Source Geodatabase. Aborting the MaintTools.FeatureClassUtilities.OpenFeatureClass() Method!");
}
// Return a NULL Pointer to the calling Method to indicate that this Method failed.
return null;
}
// Attempt to open the Feature Class.
sourceFeatureWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)sourceWorkspace;
return sourceFeatureWorkspace.OpenFeatureClass(FeatureclassName);
}
catch (System.Runtime.InteropServices.COMException comException)
{
// Determine the Line Number from which the exception was thrown.
System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(comException, true);
System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount - 1);
int lineNumber = stackFrame.GetFileLineNumber();
// Let the User know that this method failed.
if (ErrorMessage != null)
{
ErrorMessage("The MaintTools.FeatureClassUtilities.OpenFeatureClass() Method failed while opening the Feature Class in the Geodatabase Workspace with COM Exception - " + comException.Message + " (" + comException.ErrorCode + " Line: " + lineNumber.ToString() + ")!");
}
// Return a NULL Pointer to the calling method to indicate that this methdo failed.
return null;
}
catch (System.Exception caught)
{
// Determine the Line Number from which the exception was thrown.
System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(caught, true);
System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount - 1);
int lineNumber = stackFrame.GetFileLineNumber();
// Let the User know that this method failed.
if (ErrorMessage != null)
{
ErrorMessage("The MaintTools.FeatureClassUtilities.OpenFeatureClass() Method failed with error message - " + caught.Message + " (Line: " + lineNumber.ToString() + ")!");
}
// Return a NULL Pointer to the calling Method to indicate that this Method failed.
return null;
}
finally
{
// If the ESRI Source Geodatabase Feature Workspace Object was instantiated, close it.
if (sourceFeatureWorkspace != null)
{
sourceFeatureWorkspace = null;
}
// If the ESRI Source Goedatabase Workspace Object was instantiated, close it.
if (sourceWorkspace != null)
{
sourceWorkspace = null;
//.........这里部分代码省略.........