15 Kasım 2016 Salı

geometry multi_polygon Sınıfı

Giriş
Şu satırları dahil ederiz.
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
Constructor
Şöyle yaparız.
using PointType = boost::geometry::model::d2::point_xy<double>;
using PolygonType = boost::geometry::model::polygon<PointType>;
using MultiPolygonType = boost::geometry::model::multi_polygon<PolygonType>;
MultiPolygonType polygon;
boost::geometry::read_wkt("MULTIPOLYGON(((...)))", polygon);
push_back metodu
Elimizde iki tane polygon olsun.
PolygonType singlePolygon1;
PolygonType singlePolygon2;

boost::geometry::read_wkt("POLYGON((...))", singlePolygon1);
boost::geometry::read_wkt("POLYGON((...))", singlePolygon2);

boost::geometry::correct(singlePolygon1);
boost::geometry::correct(singlePolygon2);
Şöyle yaparız.
MultiPolygonType polygon;
polygon.push_back (singlePolygon1);
polygon.push_back (singlePolygon2);

Hiç yorum yok:

Yorum Gönder