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


C# IFeatureSet.SelectByAttribute方法代码示例

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


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

示例1: Execute

        /// <summary>
        /// Executes the Erase Opaeration tool programaticaly.
        /// Ping deleted static for external testing 01/2010
        /// </summary>
        /// <param name="input1">The input FeatureSet.</param>
        /// <param name="input2">The input Expression string to select features to Delete.</param>
        /// <param name="output">The output FeatureSet.</param>
        /// <param name="cancelProgressHandler">The progress handler.</param>
        /// <returns></returns>
        public bool Execute(
            IFeatureSet input1, string input2, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
        {
            // Validates the input and output data
            if (input1 == null || input2 == null || output == null)
            {
                return false;
            }

            if (cancelProgressHandler.Cancel)
            {
                return false;
            }

            int previous = 0;
            List<IFeature> fetList = input1.SelectByAttribute(input2);
            int noOfFeaturesToDelete = fetList.Count;
            int noOfFeatures = input1.Features.Count;
            output.FeatureType = input1.FeatureType;
            foreach (IFeature f in input1.Features)
            {
                output.Features.Add(f);
            }

            // Go through every item in the list
            for (int i = 0; i < noOfFeaturesToDelete; i++)
            {
                int current = Convert.ToInt32(Math.Round(i * 100D / noOfFeaturesToDelete));

                // only update when increment in percentage
                if (current > previous)
                {
                    cancelProgressHandler.Progress(string.Empty, current, current + TextStrings.progresscompleted);
                }

                previous = current;

                // loop through every item in the list
                for (int j = 0; j < noOfFeatures; j++)
                {
                    // Select the Feature from Feature set to detlete
                    if (fetList[i] == input1.Features[j])
                    {
                        output.Features.Remove(input1.Features[j]);
                    }
                }
            }

            output.SaveAs(output.Filename, true);
            return true;
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:60,代码来源:DeleteFeatures.cs


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