c++ - Boost::geometry::buffer 不适用于地理坐标系
问题描述
我在 VisualStudio 2015 中使用 boost 1.69.0。我想做的是在使用地理坐标系的几何图形周围创建一个缓冲区:
#include <boost/geometry.hpp>
int main()
{
// using point_type = boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>;
using point_type = boost::geometry::model::point<double, 2, boost::geometry::cs::geographic<boost::geometry::degree>>;
using polygon_type = boost::geometry::model::polygon<point_type>;
std::vector<point_type> v1{{0,0}, {0,10}, {10,10}, {10,0}, {0,0}};
polygon_type poly1;
boost::geometry::assign_points(poly1, v1);
boost::geometry::correct(poly1);
const double buffer_distance = 1;
const int points_per_circle = 18;
boost::geometry::strategy::buffer::distance_symmetric<double> distance_strategy(buffer_distance);
boost::geometry::strategy::buffer::join_round join_strategy(points_per_circle);
boost::geometry::strategy::buffer::end_round end_strategy(points_per_circle);
boost::geometry::strategy::buffer::point_circle circle_strategy(points_per_circle);
boost::geometry::strategy::buffer::side_straight side_strategy;
boost::geometry::model::multi_polygon<polygon_type> poly2;
boost::geometry::buffer(poly1, poly2, distance_strategy, side_strategy, join_strategy, end_strategy,
circle_strategy);
return 0;
}
此示例代码适用于笛卡尔坐标系。当我使用地理(或球面赤道)时,会出现这种编译错误:
include\boost/geometry/strategies/cartesian/side_of_intersection.hpp(58): error C2338: boost::is_integral::value include\boost/geometry/strategies/cartesian/side_of_intersection.hpp(158):注意:请参阅使用 [ T=coordinate_type 编译的类模板实例化 'boost::geometry::strategy::side::detail::multiplicable_integral' 的引用] include\boost/geometry/strategies/cartesian/side_of_intersection.hpp(212): 注意:参见函数模板实例化 'int boost::geometry::strategy::side::side_of_intersection::sign_of_compare(const T &,const T &,const T &,const T &)' 正在使用 [ T=coordinate_type ] 编译 include\boost/geometry/strategies/cartesian/side_of_intersection.hpp(321):注意:请参阅对函数模板实例化的参考 'int boost::几何::策略::边::side_of_intersection::sign_of_addition_of_two_products(const T &,const T &,const T &,const T &)' 使用 [ T=coordinate_type ] 编译
我可以理解编译器为双精度实现了未实现的方法,但问题是为什么它适用于笛卡尔的双精度,而不适用于地理坐标系的双精度?有谁知道解决这个问题的方法?
解决方案
推荐阅读
- ios - 访问静息心率
- mysql - VB.net - 打印datagridView横向模式
- three.js - ThreeJS triangulateShape 返回 null
- ios - 可选类型“UIImage?”的值 未拆封;你的意思是用'!' 或者 '?'?插入 '!'
- reactjs - 样式化组件 - 如何防止道具被传递给扩展组件?
- android - gradle 库中的混淆接口参数名称
- javascript - Google Map API - 当地图处于模态时,方向服务不会自动缩放
- c# - C# 中的房间管理程序
- html - 引导缩略图仅在 Internet Explorer 中具有固定高度
- python - 为什么我在 python 中收到此错误消息?IndentationError:需要一个缩进块