Subject: [Boost-bugs] [Boost C++ Libraries] #12342: boost rtree and polygon with adapted point type doesn't compile
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-07-22 08:14:19
#12342: boost rtree and polygon with adapted point type doesn't compile
----------------------------------+---------------------------
Reporter: soldevelopment1234@⦠| Owner: barendgehrels
Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
Version: Boost 1.61.0 | Severity: Problem
Keywords: rtree |
----------------------------------+---------------------------
I am using boost 1.61
Compiling with VS2015
The following code won't compile. I expect it to --- I think it is the use
of the adapter BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET that is upsetting
things.
{{{
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <vector>
#include <boost/geometry/geometries/register/point.hpp>
class wxPoint
{
public:
wxPoint(double x, double y)
: m_x(x),
m_y(y)
{
}
wxPoint() {}
double getx() const
{
return m_x;
}
double gety() const
{
return m_y;
}
void setx(double in)
{
m_x = in;
}
void sety(double in)
{
m_y = in;
}
private:
double m_x;
double m_y;
};
BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET(
wxPoint,
double,
boost::geometry::cs::geographic<boost::geometry::degree>,
wxPoint::getx,
wxPoint::gety,
wxPoint::setx,
wxPoint::sety)
typedef std::pair<wxPoint, unsigned> value;
int main()
{
boost::geometry::index::rtree< value,
boost::geometry::index::quadratic<16> > rtree;
wxPoint p(4, 1);
rtree.insert(std::make_pair(p, 1));
std::vector<value> result_s;
typedef boost::geometry::model::polygon<wxPoint> polygon_type;
polygon_type poly;
boost::geometry::read_wkt(
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3
2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"
"(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))", poly);
rtree.query(boost::geometry::index::within(poly),
std::back_inserter(result_s));
return 0;
}
}}}
compiler output attached as a file
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12342> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC