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


C# ESRI.get_RelationshipClasses方法代码示例

本文整理汇总了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;
        }
开发者ID:rkBiswal,项目名称:utilities-telecom-desktop-addins,代码行数:44,代码来源:ConfigUtil.cs


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