本文整理汇总了C#中IFeatureSet.GetFeature方法的典型用法代码示例。如果您正苦于以下问题:C# IFeatureSet.GetFeature方法的具体用法?C# IFeatureSet.GetFeature怎么用?C# IFeatureSet.GetFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFeatureSet
的用法示例。
在下文中一共展示了IFeatureSet.GetFeature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EraseFeatures
/// <summary>
/// Erase features from one feature set where they are intersected by another feature set.
/// </summary>
/// <param name="TargetFeatures">Features which will be erased in part or whole.</param>
/// <param name="SourceFeatures">Features which represent areas to erase.</param>
/// <param name="cancelProgressHandler">Optional parameter to report progress and cancel entire process if needed.</param>
/// <returns>A point feature set with the randomly created features.</returns>
public static FeatureSet EraseFeatures(IFeatureSet TargetFeatures, IFeatureSet SourceFeatures, ICancelProgressHandler cancelProgressHandler = null)
{
if (TargetFeatures == null || SourceFeatures == null)
{
return null;
}
//Erase features from one feature set where they are intersected by another feature set
//Note: we use the ShapeIndices here rather than for each feature in featureset.features as a memory management technique.
//The current version does not preserve any attribute info.
//Dan Ames 2/27/2013
FeatureSet ResultFeatures = new FeatureSet(); //the resulting featureset
IFeature TF, SF; //a single output feature
ResultFeatures.CopyTableSchema(TargetFeatures); //set up the data table in the new feature set
for (Int16 i = 0; i <= TargetFeatures.ShapeIndices.Count - 1; i++)
{
TF = TargetFeatures.GetFeature(i); //get the full undifferenced feature
for (Int16 j = 0; j <= SourceFeatures.ShapeIndices.Count - 1; j++)
{
SF = SourceFeatures.GetFeature(j);
if (SF.Envelope.Intersects(TF.Envelope))
{
TF = TF.Difference(SF); //clip off any pieces of SF that overlap FR
}
if (TF == null)
{ //sometimes difference leaves nothing left of a feature
break;
}
}
if (TF != null)
{
ResultFeatures.AddFeature(TF).CopyAttributes(TargetFeatures.GetFeature(i)); //add the fully clipped feature to the results
}
if (cancelProgressHandler != null)
{
if (cancelProgressHandler.Cancel) { return null; }
int progress = Convert.ToInt32(i * 100 / TargetFeatures.ShapeIndices.Count);
cancelProgressHandler.Progress(String.Empty, progress, String.Empty);
}
}
return ResultFeatures;
}