本文整理汇总了C#中IFeatureSet.Intersection方法的典型用法代码示例。如果您正苦于以下问题:C# IFeatureSet.Intersection方法的具体用法?C# IFeatureSet.Intersection怎么用?C# IFeatureSet.Intersection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFeatureSet
的用法示例。
在下文中一共展示了IFeatureSet.Intersection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Executes the ClipPolygonWithPolygon tool with programatic input
/// </summary>
/// <param name="input">The input feature set to clip</param>
/// <param name="input2">The input polygon feature set to clip with</param>
/// <param name="output">The output feature set</param>
/// <param name="cancelProgressHandler">The progress handler for progress message updates</param>
/// <returns></returns>
/// Ping delete "static" for external testing
public bool Execute(
IFeatureSet input, IFeatureSet input2, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
{
// Validates the input and output data
if (input == null || input2 == null || output == null)
{
cancelProgressHandler.Progress(string.Empty, 100, TextStrings.Oneparameterinnull);
return false;
}
if (input2.FeatureType != FeatureType.Polygon)
{
cancelProgressHandler.Progress(string.Empty, 100, TextStrings.secondinputlayer);
return false;
}
output.FeatureType = input.FeatureType;
// we add all the old features to output
IFeatureSet tempoutput = input.Intersection(input2, FieldJoinType.LocalOnly, cancelProgressHandler);
// We add all the fields
foreach (DataColumn inputColumn in tempoutput.DataTable.Columns)
{
output.DataTable.Columns.Add(new DataColumn(inputColumn.ColumnName, inputColumn.DataType));
}
foreach (var fe in tempoutput.Features)
{
output.Features.Add(fe);
}
output.SaveAs(output.Filename, true);
return true;
}
示例2: Execute
/// <summary>
/// Executes the Union Opaeration tool programaticaly
/// </summary>
/// <param name="self">The input are feature set</param>
/// <param name="other">The second input feature set</param>
/// <param name="output">The output feature set</param>
/// <param name="cancelProgressHandler">The progress handler</param>
/// <returns></returns>
public bool Execute(
IFeatureSet self, IFeatureSet other, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
{
// Validates the input and output data
if (self == null || other == null || output == null)
{
return false;
}
IFeatureSet tempOutput = self.Intersection(other, FieldJoinType.All, null);
IFeatureSet tempFeatureSet = self.CombinedFields(other);
int previous = 0;
int max = self.Features.Count;
// Take (Self-Intersect Featureset)
List<IFeature> intersectList;
for (int i = 0; i < self.Features.Count; i++)
{
intersectList = other.Select(self.Features[i].Envelope.ToExtent());
foreach (IFeature feat in intersectList)
{
if (cancelProgressHandler.Cancel)
{
return false;
}
self.Features[i].Difference(feat, tempFeatureSet, FieldJoinType.LocalOnly);
}
if (Math.Round(i * 40D / max) <= previous)
{
continue;
}
previous = Convert.ToInt32(Math.Round(i * 40D / max));
cancelProgressHandler.Progress(string.Empty, previous, previous + TextStrings.progresscompleted);
}
max = other.Features.Count;
// Take (Other-Intersect Featureset)
for (int i = 0; i < other.Features.Count; i++)
{
intersectList = self.Select(other.Features[i].Envelope.ToExtent());
foreach (IFeature feat in intersectList)
{
if (cancelProgressHandler.Cancel)
{
return false;
}
other.Features[i].Difference(feat, tempFeatureSet, FieldJoinType.LocalOnly);
}
if (Math.Round((i * 40D / max) + 40D) <= previous)
{
continue;
}
previous = Convert.ToInt32(Math.Round((i * 40D / max) + 40D));
cancelProgressHandler.Progress(string.Empty, previous, previous + TextStrings.progresscompleted);
}
max = tempFeatureSet.Features.Count;
output.CopyTableSchema(tempFeatureSet);
// Add the individual feature to output
for (int i = 0; i < tempFeatureSet.Features.Count; i++)
{
output.Features.Add(tempFeatureSet.Features[i]);
if (Math.Round((i * 10D / max) + 80D) <= previous)
{
continue;
}
previous = Convert.ToInt32(Math.Round((i * 10D / max) + 80D));
if (cancelProgressHandler.Cancel)
{
return false;
}
cancelProgressHandler.Progress(string.Empty, previous, previous + TextStrings.progresscompleted);
}
max = tempOutput.Features.Count;
// Add the Intersect feature to output
for (int i = 0; i < tempOutput.Features.Count; i++)
{
output.Features.Add(tempOutput.Features[i]);
if (cancelProgressHandler.Cancel)
//.........这里部分代码省略.........