本文整理汇总了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;
}