Sam*_*Sam 5 c# wpf .net-4.0 pathgeometry
我有两个巨大的(> 100000项)PathGeometry集合我需要使用PathGeometry.Combine进行比较,如下所示:
List<PathGeometry> firstList;
List<PathGeometry> secondList;
[...]
foreach (PathGeometry pg1 in firstList)
foreach (PathGeometry pg2 in secondList)
{
PathGeometry intergeo = PathGeometry.Combine(pg1, pg2, GeometryCombineMode.Intersect, null);
if (intergeo.GetArea() > 0)
{
// do whatever with intergeo.GetArea()
}
}
Run Code Online (Sandbox Code Playgroud)
令我惊讶的是,PathGeometry是GUI的一部分并使用调度程序,它有时会导致问题,因为我的计算在没有GUI的情况下在一些后台线程中运行使用Parallel.ForEach()
所以我正在寻找一种没有连接到GUI的PathGeometry的替代品.
我的数字非常复杂,并为PathGeometry.Figures添加了很多PathFigures.
我自己从一些臃肿的政府xml文件创建那些PathGeometries,所以创建其他东西也没有问题.但是我需要一个函数来创建这些几何中的两个(不是相互添加)的交集,以获得两个几何所覆盖的区域,例如此图中的红色区域:

System.Windows.Media还包含一个类StreamGeometry,它是 的“轻量级替代品” PathGeometry。它不支持数据绑定、动画或修改,但由于它派生自Geometry它,所以应该有一个Combine方法。
| 归档时间: |
|
| 查看次数: |
796 次 |
| 最近记录: |