本文整理汇总了C#中ESRI.get_RelationshipClasses方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.get_RelationshipClasses方法的具体用法?C# ESRI.get_RelationshipClasses怎么用?C# ESRI.get_RelationshipClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ESRI
的用法示例。
在下文中一共展示了ESRI.get_RelationshipClasses方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPortRelationship
/// <summary>
/// Finds the Device to Port relationship class for a given device feature class
/// </summary>
/// <param name="deviceClass">device feature class</param>
/// <returns>ESRI.ArcGIS.Geodatabase.IRelationshipClass</returns>
public static ESRI.ArcGIS.Geodatabase.IRelationshipClass GetPortRelationship(ESRI.ArcGIS.Geodatabase.IFeatureClass deviceClass)
{
// TODO: Currently returns the first relationship class found whose name ends with "Ports". Should probably make the relationship classes part of the configuration
ESRI.ArcGIS.Geodatabase.IRelationshipClass result = null;
if (null == deviceClass)
{
throw new ArgumentNullException("deviceClass");
}
using (ESRI.ArcGIS.ADF.ComReleaser releaser = new ESRI.ArcGIS.ADF.ComReleaser())
{
ESRI.ArcGIS.Geodatabase.IEnumRelationshipClass relClasses = deviceClass.get_RelationshipClasses(ESRI.ArcGIS.Geodatabase.esriRelRole.esriRelRoleOrigin);
releaser.ManageLifetime(relClasses);
relClasses.Reset();
result = relClasses.Next();
while (null != result)
{
ESRI.ArcGIS.Geodatabase.IDataset relationshipDataset = result as ESRI.ArcGIS.Geodatabase.IDataset;
if (relationshipDataset.Name.EndsWith("Ports", StringComparison.CurrentCultureIgnoreCase))
{
break;
}
result = relClasses.Next();
}
}
if (null == result)
{
throw new Exception("Relationship class from device to port was not found.");
}
return result;
}