如何在 boost::geometry 中提供 IntersectionStrategy

How to provide IntersectionStrategy in boost::geometry

我需要用新版本 (1.66) 替换旧版本的 boost (1.58)。但是自那时起在 boost::geometry 库中发生的重大更改存在问题。我对这个图书馆知之甚少。在我依赖的代码(不是我写的)中使用了函数 self_turns() 。据我了解,它计算自交点。在以前的版本中它需要 4 个参数,但在新版本中它需要 5 个(加上 2 个可选)。新参数是 IntersectionStrategy。我进行了很多搜索,但没有找到任何文档或示例来说明如何做到这一点 defined/used。有谁知道现在应该怎么用吗?

您可以尝试传递这样声明的变量:

typename bg::strategy::intersection::services::default_strategy
   <typename bg::cs_tag<Geometry>::type>::type strategy;

(其中 Geometry 是您的几何类型,bg 是 boost::geometry 的别名)作为缺少的交叉策略

不,目前还没有样本,它本来是 public 未来的功能,但目前还不是(因此界面确实可以改变)。