boost_geometry_correct icon indicating copy to clipboard operation
boost_geometry_correct copied to clipboard

Visual studio compilaton error

Open Vishnu-C opened this issue 2 years ago • 9 comments

On implementation in a VS project a compilation error is thrown, any suggestions?

Code


#include <correct.hpp>
#include <boost/assign.hpp>

typedef boost::geometry::model::d2::point_xy<double> point;
typedef boost::geometry::model::polygon<point> polygon;
typedef boost::geometry::model::multi_polygon<polygon> multi_polygon;

void CRegion::CorrectPolyline(PolylineClass myPolyLine)
{
	std::vector<point> points;
	for (int p = 0;p < myPolyLine->GetNumberOfPoints();p++)
	{
		double pnt[3];
		myPolyLine->GetPoint(p, pnt);
		points.push_back(point(pnt[0], pnt[1]));
	}
	// Create a polygon object and assign the points to it.
	polygon aPolygon;
	boost::geometry::assign_points(aPolygon, points);

	multi_polygon input;
	input.push_back(aPolygon);
	multi_polygon result;
	double remove_spike_threshold = 1E-12;
	geometry::correct(input, result, remove_spike_threshold);

	for (auto const& poly : result) {
		std::cout << "Polygon area: " << boost::geometry::area(poly) << std::endl;
	}
}

Error

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\xtree(1599,1): error C3848: expression having type 'const geometry::impl::compare_point_less<point_t>' would lose some const-volatile qualifiers in order to call 'bool geometry::impl::compare_point_less<point_t>::operator ()(const point_t &,const point_t &)' 1> with 1> [ 1> point_t=boost::geometry::model::d2::point_xy<double,boost::geometry::cs::cartesian> 1> ]

Vishnu-C avatar May 27 '22 09:05 Vishnu-C