This sample demonstrates that by usage of concepts, external geometries can be handled by GGL, just calling by a one-line registration macro. In this case for the Qt Widget Library.
The example, code shown below, results in this window-output:
#include <sstream>
#include <QtGui>
#include <boost/geometry/geometry.hpp>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPolygonF polygon;
polygon
<< QPointF(10, 20) << QPointF(20, 30)
<< QPointF(30, 20) << QPointF(20, 10)
<< QPointF(10, 20);
std::ostringstream out;
QPointF p(20,20);
out << "Qt contains: "
<< (polygon.containsPoint(p, Qt::WindingFill) ? "yes" : "no")
<< std::endl
<< "Boost.Geometry within: "
<< std::endl;
QPolygonF::const_iterator it;
for (it = polygon.begin(); it != polygon.end(); ++it)
{
out << boost::geometry::dsv(*it) << std::endl;
}
out << boost::geometry::dsv(polygon) << std::endl;
QLabel label(out.str().c_str());
label.show();
return app.exec();
}