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


C# SpatialFilterClass.AddField方法代码示例

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


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

示例1: GetCutlineNumber

        /// <summary>
        /// ��ȡ�ַ�ͼ����ָ��Ŀ��ͼ��ķ�Χ��С������ͼ�����ֶε�ֵ
        /// </summary>
        /// <param name="ipFeatrueClass">�ӱ�Ҫ����</param>
        /// <param name="ipBoundFeatureClass">��ΧҪ����</param>
        /// <param name="strTuFuNumFieldName">ͼ�����ֶ���</param>
        /// <param name="ipEnvelope"></param>
        /// <param name="nTuFuFieldIndex"></param>
        /// <param name="aryNumber">ͼ��������</param>
        /// <param name="ipPointCollection"></param>
        /// <returns>�ɹ�����true,���򷵻�false</returns>
        private IEnvelope GetCutlineNumber(IFeatureClass ipFeatrueClass,
                                           IFeatureClass ipBoundFeatureClass,
                                           string strTuFuNumFieldName,
                                           IEnvelope ipEnvelope,
                                           ref int nTuFuFieldIndex, ref List<string> aryNumber,
                                           IPointCollection ipPointCollection)
        {
            try
            {
                if (ipEnvelope == null) return null;

                // //���Դ���
                // BSTR bstrTuFuNum = strTuFuNumFieldName.AllocSysString();
                //ipTable.FindField(bstrTuFuNum,&nIndex);
                //���ͼ�����ֶε�����
                ITable ipTable = (ITable) ipBoundFeatureClass;
                int nIndex = ipTable.FindField(strTuFuNumFieldName);

                if (nIndex == -1)
                {
                    return null;
                }

                IEnvelope ipTuFuMaxEnvelope = new EnvelopeClass();
                nTuFuFieldIndex = nIndex;

                //���ÿռ�����
                ISpatialFilter ipSpatialFilter = new SpatialFilterClass();
                ipSpatialFilter.AddField(strTuFuNumFieldName);
                IGeometry ipGeo = ipEnvelope;
                ipSpatialFilter.Geometry = ipGeo;
                string bstrSharpFieldName = ipBoundFeatureClass.ShapeFieldName;
                ipSpatialFilter.GeometryField = bstrSharpFieldName;
                ipSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;

                //���пռ��ѯ,����ȡ��ͼ�����ֶε�ֵ
                IFeatureCursor ipFeatureCursor = ipBoundFeatureClass.Search(ipSpatialFilter, false);

                if (ipFeatureCursor == null)
                {
                    return null;
                }

                IGeometry ipGeometry;
                IGeometry ipPolygonGeometry;
                IPolygon2 ipPolygon;
                IRing ipRing;

                IFeature ipFeature = ipFeatureCursor.NextFeature();
                IEnvelope ipTuFuEnvelope = ipFeature.Extent;

                double dMinX = 0.0;
                double dMaxX = 0.0;
                double dMinY = 0.0;
                double dMaxY = 0.0;

                double dTMinX = 0.0;
                double dTMaxX = 0.0;
                double dTMinY = 0.0;
                double dTMaxY = 0.0;

                dMinX = ipTuFuEnvelope.XMin;
                dMaxX = ipTuFuEnvelope.XMax;
                dMinY = ipTuFuEnvelope.YMin;
                dMaxY = ipTuFuEnvelope.YMax;

                IPoint ipPoint = new PointClass();

                int nPointCount = 0;
                while (ipFeature != null)
                {
                    object varTuFu = ipFeature.get_Value(nIndex);
                    string str = varTuFu.ToString();
                    aryNumber.Add(str);

                    ipTuFuEnvelope = ipFeature.Extent;
                    dTMinX = ipTuFuEnvelope.XMin;
                    dTMaxX = ipTuFuEnvelope.XMax;
                    dTMinY = ipTuFuEnvelope.YMin;
                    dTMaxY = ipTuFuEnvelope.YMax;

                    if (dTMinX < dMinX)
                        dMinX = dTMinX;
                    if (dTMaxX > dMaxX)
                        dMaxX = dTMaxX;
                    if (dTMinY < dMinY)
                        dMinY = dTMinY;
                    if (dTMaxY > dMaxY)
                        dMaxY = dTMaxY;
//.........这里部分代码省略.........
开发者ID:hy1314200,项目名称:HyDM,代码行数:101,代码来源:RuleJoinSide.cs


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