and finaly, rename 'new_geometry' namespace to 'geometry'

This commit is contained in:
artemp 2015-03-24 14:21:28 +01:00
parent 7e03d41606
commit 4389c80d84
91 changed files with 603 additions and 604 deletions

View file

@ -93,7 +93,7 @@ public:
unsigned cmd; unsigned cmd;
double x,y; double x,y;
clipped.rewind(0); clipped.rewind(0);
mapnik::geometry_type geom2(mapnik::new_geometry::geometry_types::Polygon); mapnik::geometry_type geom2(mapnik::geometry::geometry_types::Polygon);
while ((cmd = clipped.vertex(&x, &y)) != mapnik::SEG_END) { while ((cmd = clipped.vertex(&x, &y)) != mapnik::SEG_END) {
geom2.push_vertex(x,y,(mapnik::CommandType)cmd); geom2.push_vertex(x,y,(mapnik::CommandType)cmd);
} }
@ -191,7 +191,7 @@ public:
clipped.rewind(0); clipped.rewind(0);
unsigned cmd; unsigned cmd;
double x,y; double x,y;
mapnik::geometry_type geom2(mapnik::new_geometry::geometry_types::Polygon); mapnik::geometry_type geom2(mapnik::geometry::geometry_types::Polygon);
while ((cmd = clipped.vertex(&x, &y)) != mapnik::SEG_END) { while ((cmd = clipped.vertex(&x, &y)) != mapnik::SEG_END) {
geom2.push_vertex(x,y,(mapnik::CommandType)cmd); geom2.push_vertex(x,y,(mapnik::CommandType)cmd);
} }
@ -280,7 +280,7 @@ public:
poly_clipper clipped(extent_, va); poly_clipper clipped(extent_, va);
unsigned cmd; unsigned cmd;
double x,y; double x,y;
mapnik::geometry_type geom2(mapnik::new_geometry::geometry_types::Polygon); mapnik::geometry_type geom2(mapnik::geometry::geometry_types::Polygon);
while ((cmd = clipped.vertex(&x, &y)) != mapnik::SEG_END) { while ((cmd = clipped.vertex(&x, &y)) != mapnik::SEG_END) {
geom2.push_vertex(x,y,(mapnik::CommandType)cmd); geom2.push_vertex(x,y,(mapnik::CommandType)cmd);
} }

View file

@ -60,9 +60,9 @@
namespace { namespace {
std::shared_ptr<mapnik::new_geometry::geometry> from_wkb_impl(std::string const& wkb) std::shared_ptr<mapnik::geometry::geometry> from_wkb_impl(std::string const& wkb)
{ {
std::shared_ptr<mapnik::new_geometry::geometry> geom = std::make_shared<mapnik::new_geometry::geometry>(); std::shared_ptr<mapnik::geometry::geometry> geom = std::make_shared<mapnik::geometry::geometry>();
try try
{ {
*geom = std::move(mapnik::geometry_utils::from_wkb(wkb.c_str(), wkb.size())); *geom = std::move(mapnik::geometry_utils::from_wkb(wkb.c_str(), wkb.size()));
@ -74,17 +74,17 @@ std::shared_ptr<mapnik::new_geometry::geometry> from_wkb_impl(std::string const&
return geom; return geom;
} }
std::shared_ptr<mapnik::new_geometry::geometry> from_wkt_impl(std::string const& wkt) std::shared_ptr<mapnik::geometry::geometry> from_wkt_impl(std::string const& wkt)
{ {
std::shared_ptr<mapnik::new_geometry::geometry> geom = std::make_shared<mapnik::new_geometry::geometry>(); std::shared_ptr<mapnik::geometry::geometry> geom = std::make_shared<mapnik::geometry::geometry>();
if (!mapnik::from_wkt(wkt, *geom)) if (!mapnik::from_wkt(wkt, *geom))
throw std::runtime_error("Failed to parse WKT geometry"); throw std::runtime_error("Failed to parse WKT geometry");
return geom; return geom;
} }
std::shared_ptr<mapnik::new_geometry::geometry> from_geojson_impl(std::string const& json) std::shared_ptr<mapnik::geometry::geometry> from_geojson_impl(std::string const& json)
{ {
std::shared_ptr<mapnik::new_geometry::geometry> geom = std::make_shared<mapnik::new_geometry::geometry>(); std::shared_ptr<mapnik::geometry::geometry> geom = std::make_shared<mapnik::geometry::geometry>();
if (!mapnik::json::from_geojson(json, *geom)) if (!mapnik::json::from_geojson(json, *geom))
throw std::runtime_error("Failed to parse geojson geometry"); throw std::runtime_error("Failed to parse geojson geometry");
return geom; return geom;
@ -99,7 +99,7 @@ inline std::string boost_version()
return s.str(); return s.str();
} }
PyObject* to_wkb_impl(mapnik::new_geometry::geometry const& geom, mapnik::wkbByteOrder byte_order) PyObject* to_wkb_impl(mapnik::geometry::geometry const& geom, mapnik::wkbByteOrder byte_order)
{ {
mapnik::util::wkb_buffer_ptr wkb = mapnik::util::to_wkb(geom,byte_order); mapnik::util::wkb_buffer_ptr wkb = mapnik::util::to_wkb(geom,byte_order);
if (wkb) if (wkb)
@ -118,7 +118,7 @@ PyObject* to_wkb_impl(mapnik::new_geometry::geometry const& geom, mapnik::wkbByt
} }
} }
std::string to_geojson_impl(mapnik::new_geometry::geometry const& geom) std::string to_geojson_impl(mapnik::geometry::geometry const& geom)
{ {
std::string wkt; std::string wkt;
if (!mapnik::util::to_geojson(wkt, geom)) if (!mapnik::util::to_geojson(wkt, geom))
@ -128,7 +128,7 @@ std::string to_geojson_impl(mapnik::new_geometry::geometry const& geom)
return wkt; return wkt;
} }
std::string to_wkt_impl(mapnik::new_geometry::geometry const& geom) std::string to_wkt_impl(mapnik::geometry::geometry const& geom)
{ {
std::string wkt; std::string wkt;
if (!mapnik::to_wkt(wkt,geom)) if (!mapnik::to_wkt(wkt,geom))
@ -138,45 +138,45 @@ std::string to_wkt_impl(mapnik::new_geometry::geometry const& geom)
return wkt; return wkt;
} }
mapnik::new_geometry::geometry_types geometry_type_impl(mapnik::new_geometry::geometry const& geom) mapnik::geometry::geometry_types geometry_type_impl(mapnik::geometry::geometry const& geom)
{ {
return mapnik::new_geometry::geometry_type(geom); return mapnik::geometry::geometry_type(geom);
} }
mapnik::box2d<double> geometry_envelope_impl(mapnik::new_geometry::geometry const& geom) mapnik::box2d<double> geometry_envelope_impl(mapnik::geometry::geometry const& geom)
{ {
return mapnik::new_geometry::envelope(geom); return mapnik::geometry::envelope(geom);
} }
bool geometry_is_valid_impl(mapnik::new_geometry::geometry const& geom) bool geometry_is_valid_impl(mapnik::geometry::geometry const& geom)
{ {
return mapnik::new_geometry::is_valid(geom); return mapnik::geometry::is_valid(geom);
} }
bool geometry_is_simple_impl(mapnik::new_geometry::geometry const& geom) bool geometry_is_simple_impl(mapnik::geometry::geometry const& geom)
{ {
return mapnik::new_geometry::is_simple(geom); return mapnik::geometry::is_simple(geom);
} }
void geometry_correct_impl(mapnik::new_geometry::geometry & geom) void geometry_correct_impl(mapnik::geometry::geometry & geom)
{ {
mapnik::new_geometry::correct(geom); mapnik::geometry::correct(geom);
} }
void polygon_set_exterior_impl(mapnik::new_geometry::polygon & poly, mapnik::new_geometry::linear_ring const& ring) void polygon_set_exterior_impl(mapnik::geometry::polygon & poly, mapnik::geometry::linear_ring const& ring)
{ {
poly.exterior_ring = ring; // copy poly.exterior_ring = ring; // copy
} }
void polygon_add_hole_impl(mapnik::new_geometry::polygon & poly, mapnik::new_geometry::linear_ring const& ring) void polygon_add_hole_impl(mapnik::geometry::polygon & poly, mapnik::geometry::linear_ring const& ring)
{ {
poly.interior_rings.push_back(ring); // copy poly.interior_rings.push_back(ring); // copy
} }
mapnik::new_geometry::point geometry_centroid_impl(mapnik::new_geometry::geometry const& geom) mapnik::geometry::point geometry_centroid_impl(mapnik::geometry::geometry const& geom)
{ {
mapnik::new_geometry::point pt; mapnik::geometry::point pt;
mapnik::new_geometry::centroid(geom, pt); mapnik::geometry::centroid(geom, pt);
return pt; return pt;
} }
@ -185,18 +185,18 @@ void export_geometry()
{ {
using namespace boost::python; using namespace boost::python;
implicitly_convertible<mapnik::new_geometry::point, mapnik::new_geometry::geometry>(); implicitly_convertible<mapnik::geometry::point, mapnik::geometry::geometry>();
implicitly_convertible<mapnik::new_geometry::line_string, mapnik::new_geometry::geometry>(); implicitly_convertible<mapnik::geometry::line_string, mapnik::geometry::geometry>();
implicitly_convertible<mapnik::new_geometry::polygon, mapnik::new_geometry::geometry>(); implicitly_convertible<mapnik::geometry::polygon, mapnik::geometry::geometry>();
enum_<mapnik::new_geometry::geometry_types>("GeometryType") enum_<mapnik::geometry::geometry_types>("GeometryType")
.value("Unknown",mapnik::new_geometry::geometry_types::Unknown) .value("Unknown",mapnik::geometry::geometry_types::Unknown)
.value("Point",mapnik::new_geometry::geometry_types::Point) .value("Point",mapnik::geometry::geometry_types::Point)
.value("LineString",mapnik::new_geometry::geometry_types::LineString) .value("LineString",mapnik::geometry::geometry_types::LineString)
.value("Polygon",mapnik::new_geometry::geometry_types::Polygon) .value("Polygon",mapnik::geometry::geometry_types::Polygon)
.value("MultiPoint",mapnik::new_geometry::geometry_types::MultiPoint) .value("MultiPoint",mapnik::geometry::geometry_types::MultiPoint)
.value("MultiLineString",mapnik::new_geometry::geometry_types::MultiLineString) .value("MultiLineString",mapnik::geometry::geometry_types::MultiLineString)
.value("MultiPolygon",mapnik::new_geometry::geometry_types::MultiPolygon) .value("MultiPolygon",mapnik::geometry::geometry_types::MultiPolygon)
.value("GeometryCollection",mapnik::new_geometry::geometry_types::GeometryCollection) .value("GeometryCollection",mapnik::geometry::geometry_types::GeometryCollection)
; ;
enum_<mapnik::wkbByteOrder>("wkbByteOrder") enum_<mapnik::wkbByteOrder>("wkbByteOrder")
@ -204,11 +204,11 @@ void export_geometry()
.value("NDR",mapnik::wkbNDR) .value("NDR",mapnik::wkbNDR)
; ;
using mapnik::new_geometry::geometry; using mapnik::geometry::geometry;
using mapnik::new_geometry::point; using mapnik::geometry::point;
using mapnik::new_geometry::line_string; using mapnik::geometry::line_string;
using mapnik::new_geometry::linear_ring; using mapnik::geometry::linear_ring;
using mapnik::new_geometry::polygon; using mapnik::geometry::polygon;
class_<point>("Point", init<double, double>((arg("x"), arg("y")), class_<point>("Point", init<double, double>((arg("x"), arg("y")),
"Constructs a new Point object\n")) "Constructs a new Point object\n"))

View file

@ -105,7 +105,7 @@ public:
: id_(id), : id_(id),
ctx_(ctx), ctx_(ctx),
data_(ctx_->mapping_.size()), data_(ctx_->mapping_.size()),
geom_(new_geometry::geometry_empty()), geom_(geometry::geometry_empty()),
raster_() {} raster_() {}
inline mapnik::value_integer id() const { return id_;} inline mapnik::value_integer id() const { return id_;}
@ -195,24 +195,24 @@ public:
return ctx_; return ctx_;
} }
inline void set_geometry(new_geometry::geometry && geom) inline void set_geometry(geometry::geometry && geom)
{ {
geom_ = std::move(geom); geom_ = std::move(geom);
} }
inline void set_geometry_copy(new_geometry::geometry const& geom) inline void set_geometry_copy(geometry::geometry const& geom)
{ {
geom_ = geom; geom_ = geom;
} }
inline new_geometry::geometry const& get_geometry() const inline geometry::geometry const& get_geometry() const
{ {
return geom_; return geom_;
} }
inline box2d<double> envelope() const inline box2d<double> envelope() const
{ {
return mapnik::new_geometry::envelope(geom_); return mapnik::geometry::envelope(geom_);
} }
inline raster_ptr const& get_raster() const inline raster_ptr const& get_raster() const
@ -262,7 +262,7 @@ private:
mapnik::value_integer id_; mapnik::value_integer id_;
context_ptr ctx_; context_ptr ctx_;
cont_type data_; cont_type data_;
new_geometry::geometry geom_; geometry::geometry geom_;
raster_ptr raster_; raster_ptr raster_;
}; };

View file

@ -462,7 +462,7 @@ bool hit_test(PathType & path, double x, double y, double tol)
return false; return false;
} }
unsigned count = 0; unsigned count = 0;
mapnik::new_geometry::geometry_types geom_type = static_cast<mapnik::new_geometry::geometry_types>(path.type()); mapnik::geometry::geometry_types geom_type = static_cast<mapnik::geometry::geometry_types>(path.type());
while (SEG_END != (command = path.vertex(&x1, &y1))) while (SEG_END != (command = path.vertex(&x1, &y1)))
{ {
if (command == SEG_CLOSE) if (command == SEG_CLOSE)
@ -478,7 +478,7 @@ bool hit_test(PathType & path, double x, double y, double tol)
} }
switch(geom_type) switch(geom_type)
{ {
case mapnik::new_geometry::geometry_types::Polygon: case mapnik::geometry::geometry_types::Polygon:
{ {
if ((((y1 <= y) && (y < y0)) || if ((((y1 <= y) && (y < y0)) ||
((y0 <= y) && (y < y1))) && ((y0 <= y) && (y < y1))) &&
@ -486,7 +486,7 @@ bool hit_test(PathType & path, double x, double y, double tol)
inside=!inside; inside=!inside;
break; break;
} }
case mapnik::new_geometry::geometry_types::LineString: case mapnik::geometry::geometry_types::LineString:
{ {
double distance = point_to_segment_distance(x,y,x0,y0,x1,y1); double distance = point_to_segment_distance(x,y,x0,y0,x1,y1);
if (distance < tol) if (distance < tol)

View file

@ -36,7 +36,7 @@
#include <cstddef> #include <cstddef>
#include <utility> #include <utility>
namespace mapnik { namespace new_geometry { namespace mapnik { namespace geometry {
struct point struct point
{ {

View file

@ -34,155 +34,155 @@
#include <boost/geometry/core/tags.hpp> #include <boost/geometry/core/tags.hpp>
// register point // register point
BOOST_GEOMETRY_REGISTER_POINT_2D (mapnik::new_geometry::point, double, cs::cartesian, x, y) BOOST_GEOMETRY_REGISTER_POINT_2D (mapnik::geometry::point, double, cs::cartesian, x, y)
// ring // ring
BOOST_GEOMETRY_REGISTER_RING(mapnik::new_geometry::linear_ring) BOOST_GEOMETRY_REGISTER_RING(mapnik::geometry::linear_ring)
namespace boost { namespace boost {
template <> template <>
struct range_iterator<mapnik::new_geometry::line_string> struct range_iterator<mapnik::geometry::line_string>
{ {
using type = mapnik::new_geometry::line_string::iterator; using type = mapnik::geometry::line_string::iterator;
}; };
template <> template <>
struct range_const_iterator<mapnik::new_geometry::line_string> struct range_const_iterator<mapnik::geometry::line_string>
{ {
using type = mapnik::new_geometry::line_string::const_iterator; using type = mapnik::geometry::line_string::const_iterator;
}; };
inline mapnik::new_geometry::line_string::iterator inline mapnik::geometry::line_string::iterator
range_begin(mapnik::new_geometry::line_string & line) {return line.begin();} range_begin(mapnik::geometry::line_string & line) {return line.begin();}
inline mapnik::new_geometry::line_string::iterator inline mapnik::geometry::line_string::iterator
range_end(mapnik::new_geometry::line_string & line) {return line.end();} range_end(mapnik::geometry::line_string & line) {return line.end();}
inline mapnik::new_geometry::line_string::const_iterator inline mapnik::geometry::line_string::const_iterator
range_begin(mapnik::new_geometry::line_string const& line) {return line.begin();} range_begin(mapnik::geometry::line_string const& line) {return line.begin();}
inline mapnik::new_geometry::line_string::const_iterator inline mapnik::geometry::line_string::const_iterator
range_end(mapnik::new_geometry::line_string const& line) {return line.end();} range_end(mapnik::geometry::line_string const& line) {return line.end();}
namespace geometry { namespace traits { namespace geometry { namespace traits {
template<> struct tag<mapnik::new_geometry::bounding_box> { using type = box_tag; }; template<> struct tag<mapnik::geometry::bounding_box> { using type = box_tag; };
template<> struct point_type<mapnik::new_geometry::bounding_box> { using type = mapnik::new_geometry::point; }; template<> struct point_type<mapnik::geometry::bounding_box> { using type = mapnik::geometry::point; };
template <> template <>
struct indexed_access<mapnik::new_geometry::bounding_box, min_corner, 0> struct indexed_access<mapnik::geometry::bounding_box, min_corner, 0>
{ {
static inline double get(mapnik::new_geometry::bounding_box const& b) { return b.p0.x;} static inline double get(mapnik::geometry::bounding_box const& b) { return b.p0.x;}
static inline void set(mapnik::new_geometry::bounding_box& b, double value) { b.p0.x = value; } static inline void set(mapnik::geometry::bounding_box& b, double value) { b.p0.x = value; }
}; };
template <> template <>
struct indexed_access<mapnik::new_geometry::bounding_box, min_corner, 1> struct indexed_access<mapnik::geometry::bounding_box, min_corner, 1>
{ {
static inline double get(mapnik::new_geometry::bounding_box const& b) { return b.p0.y;} static inline double get(mapnik::geometry::bounding_box const& b) { return b.p0.y;}
static inline void set(mapnik::new_geometry::bounding_box& b, double value) { b.p0.y = value; } static inline void set(mapnik::geometry::bounding_box& b, double value) { b.p0.y = value; }
}; };
template <> template <>
struct indexed_access<mapnik::new_geometry::bounding_box, max_corner, 0> struct indexed_access<mapnik::geometry::bounding_box, max_corner, 0>
{ {
static inline double get(mapnik::new_geometry::bounding_box const& b) { return b.p1.x;} static inline double get(mapnik::geometry::bounding_box const& b) { return b.p1.x;}
static inline void set(mapnik::new_geometry::bounding_box& b, double value) { b.p1.x = value; } static inline void set(mapnik::geometry::bounding_box& b, double value) { b.p1.x = value; }
}; };
template <> template <>
struct indexed_access<mapnik::new_geometry::bounding_box, max_corner, 1> struct indexed_access<mapnik::geometry::bounding_box, max_corner, 1>
{ {
static inline double get(mapnik::new_geometry::bounding_box const& b) { return b.p1.y;} static inline double get(mapnik::geometry::bounding_box const& b) { return b.p1.y;}
static inline void set(mapnik::new_geometry::bounding_box& b, double value) { b.p1.y = value; } static inline void set(mapnik::geometry::bounding_box& b, double value) { b.p1.y = value; }
}; };
template<> template<>
struct tag<mapnik::new_geometry::line_string> struct tag<mapnik::geometry::line_string>
{ {
using type = linestring_tag; using type = linestring_tag;
}; };
// mapnik::new_geometry::polygon // mapnik::geometry::polygon
template<> template<>
struct tag<mapnik::new_geometry::polygon> struct tag<mapnik::geometry::polygon>
{ {
using type = polygon_tag; using type = polygon_tag;
}; };
template <> template <>
struct point_order<mapnik::new_geometry::linear_ring> struct point_order<mapnik::geometry::linear_ring>
{ {
static const order_selector value = counterclockwise; static const order_selector value = counterclockwise;
}; };
template<> template<>
struct tag<mapnik::new_geometry::multi_point> struct tag<mapnik::geometry::multi_point>
{ {
using type = multi_point_tag; using type = multi_point_tag;
}; };
template<> template<>
struct tag<mapnik::new_geometry::multi_line_string> struct tag<mapnik::geometry::multi_line_string>
{ {
using type = multi_linestring_tag; using type = multi_linestring_tag;
}; };
template<> struct tag<mapnik::new_geometry::multi_polygon> template<> struct tag<mapnik::geometry::multi_polygon>
{ {
using type = multi_polygon_tag; using type = multi_polygon_tag;
}; };
// ring // ring
template<> struct ring_const_type<mapnik::new_geometry::polygon> template<> struct ring_const_type<mapnik::geometry::polygon>
{ {
using type = mapnik::new_geometry::linear_ring const&; using type = mapnik::geometry::linear_ring const&;
}; };
template<> struct ring_mutable_type<mapnik::new_geometry::polygon> template<> struct ring_mutable_type<mapnik::geometry::polygon>
{ {
using type = mapnik::new_geometry::linear_ring&; using type = mapnik::geometry::linear_ring&;
}; };
// interior // interior
template<> struct interior_const_type<mapnik::new_geometry::polygon> template<> struct interior_const_type<mapnik::geometry::polygon>
{ {
using type = std::vector<mapnik::new_geometry::linear_ring> const&; using type = std::vector<mapnik::geometry::linear_ring> const&;
}; };
template<> struct interior_mutable_type<mapnik::new_geometry::polygon> template<> struct interior_mutable_type<mapnik::geometry::polygon>
{ {
using type = std::vector<mapnik::new_geometry::linear_ring>&; using type = std::vector<mapnik::geometry::linear_ring>&;
}; };
// exterior // exterior
template<> template<>
struct exterior_ring<mapnik::new_geometry::polygon> struct exterior_ring<mapnik::geometry::polygon>
{ {
static mapnik::new_geometry::linear_ring& get(mapnik::new_geometry::polygon & p) static mapnik::geometry::linear_ring& get(mapnik::geometry::polygon & p)
{ {
return p.exterior_ring; return p.exterior_ring;
} }
static mapnik::new_geometry::linear_ring const& get(mapnik::new_geometry::polygon const& p) static mapnik::geometry::linear_ring const& get(mapnik::geometry::polygon const& p)
{ {
return p.exterior_ring; return p.exterior_ring;
} }
}; };
template<> template<>
struct interior_rings<mapnik::new_geometry::polygon> struct interior_rings<mapnik::geometry::polygon>
{ {
using holes_type = std::vector<mapnik::new_geometry::linear_ring>; using holes_type = std::vector<mapnik::geometry::linear_ring>;
static holes_type& get(mapnik::new_geometry::polygon & p) static holes_type& get(mapnik::geometry::polygon & p)
{ {
return p.interior_rings; return p.interior_rings;
} }
static holes_type const& get(mapnik::new_geometry::polygon const& p) static holes_type const& get(mapnik::geometry::polygon const& p)
{ {
return p.interior_rings; return p.interior_rings;
} }

View file

@ -27,7 +27,7 @@
#include <mapnik/geometry_adapters.hpp> #include <mapnik/geometry_adapters.hpp>
#include <boost/geometry/algorithms/centroid.hpp> #include <boost/geometry/algorithms/centroid.hpp>
namespace mapnik { namespace new_geometry { namespace mapnik { namespace geometry {
namespace detail { namespace detail {
@ -62,7 +62,7 @@ struct geometry_centroid
} }
inline bool centroid(mapnik::new_geometry::geometry const& geom, point & pt) inline bool centroid(mapnik::geometry::geometry const& geom, point & pt)
{ {
return detail::geometry_centroid(pt) (geom); return detail::geometry_centroid(pt) (geom);
} }

View file

@ -27,7 +27,7 @@
#include <mapnik/geometry_adapters.hpp> #include <mapnik/geometry_adapters.hpp>
#include <boost/geometry/algorithms/correct.hpp> #include <boost/geometry/algorithms/correct.hpp>
namespace mapnik { namespace new_geometry { namespace mapnik { namespace geometry {
namespace detail { namespace detail {
@ -62,7 +62,7 @@ struct geometry_correct
} }
inline void correct(mapnik::new_geometry::geometry & geom) inline void correct(mapnik::geometry::geometry & geom)
{ {
return mapnik::util::apply_visitor(detail::geometry_correct(), geom); return mapnik::util::apply_visitor(detail::geometry_correct(), geom);
} }

View file

@ -25,48 +25,48 @@
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
namespace mapnik { namespace new_geometry { namespace mapnik { namespace geometry {
namespace detail { namespace detail {
struct geometry_empty struct geometry_empty
{ {
bool operator() (mapnik::new_geometry::geometry const& geom) const bool operator() (mapnik::geometry::geometry const& geom) const
{ {
return mapnik::util::apply_visitor(*this, geom); return mapnik::util::apply_visitor(*this, geom);
} }
bool operator() (mapnik::new_geometry::point const&) const bool operator() (mapnik::geometry::point const&) const
{ {
return false; return false;
} }
bool operator() (mapnik::new_geometry::line_string const& geom) const bool operator() (mapnik::geometry::line_string const& geom) const
{ {
return geom.empty(); return geom.empty();
} }
bool operator() (mapnik::new_geometry::polygon const& geom) const bool operator() (mapnik::geometry::polygon const& geom) const
{ {
return geom.empty(); return geom.empty();
} }
bool operator() (mapnik::new_geometry::multi_point const& geom) const bool operator() (mapnik::geometry::multi_point const& geom) const
{ {
return geom.empty(); return geom.empty();
} }
bool operator() (mapnik::new_geometry::multi_line_string const& geom) const bool operator() (mapnik::geometry::multi_line_string const& geom) const
{ {
return geom.empty(); return geom.empty();
} }
bool operator() (mapnik::new_geometry::multi_polygon const& geom) const bool operator() (mapnik::geometry::multi_polygon const& geom) const
{ {
return geom.empty(); return geom.empty();
} }
bool operator() (mapnik::new_geometry::geometry_collection const& geom) const bool operator() (mapnik::geometry::geometry_collection const& geom) const
{ {
return geom.empty(); return geom.empty();
} }
@ -74,7 +74,7 @@ struct geometry_empty
} }
inline bool empty(mapnik::new_geometry::geometry const& geom) inline bool empty(mapnik::geometry::geometry const& geom)
{ {
return detail::geometry_empty()(geom); return detail::geometry_empty()(geom);
} }

View file

@ -26,7 +26,7 @@
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
namespace mapnik { namespace new_geometry { namespace mapnik { namespace geometry {
namespace detail { namespace detail {
@ -34,22 +34,22 @@ struct geometry_envelope
{ {
using bbox_type = box2d<double>; using bbox_type = box2d<double>;
bbox_type operator() (mapnik::new_geometry::geometry const& geom) const bbox_type operator() (mapnik::geometry::geometry const& geom) const
{ {
return mapnik::util::apply_visitor(*this, geom); return mapnik::util::apply_visitor(*this, geom);
} }
bbox_type operator() (mapnik::new_geometry::geometry_empty const&) const bbox_type operator() (mapnik::geometry::geometry_empty const&) const
{ {
return mapnik::box2d<double>(); return mapnik::box2d<double>();
} }
bbox_type operator() (mapnik::new_geometry::point const& pt) const bbox_type operator() (mapnik::geometry::point const& pt) const
{ {
return mapnik::box2d<double>(pt.x, pt.y, pt.x, pt.y); return mapnik::box2d<double>(pt.x, pt.y, pt.x, pt.y);
} }
bbox_type operator() (mapnik::new_geometry::line_string const& line) const bbox_type operator() (mapnik::geometry::line_string const& line) const
{ {
bbox_type bbox; bbox_type bbox;
for (auto const& pt : line) for (auto const& pt : line)
@ -60,17 +60,17 @@ struct geometry_envelope
return bbox; return bbox;
} }
bbox_type operator() (mapnik::new_geometry::polygon const& poly) const bbox_type operator() (mapnik::geometry::polygon const& poly) const
{ {
return (*this) (static_cast<mapnik::new_geometry::line_string>(poly.exterior_ring)); return (*this) (static_cast<mapnik::geometry::line_string>(poly.exterior_ring));
} }
bbox_type operator() (mapnik::new_geometry::multi_point const& multi_point) const bbox_type operator() (mapnik::geometry::multi_point const& multi_point) const
{ {
return (*this) (static_cast<mapnik::new_geometry::line_string>(multi_point)); return (*this) (static_cast<mapnik::geometry::line_string>(multi_point));
} }
bbox_type operator() (mapnik::new_geometry::multi_line_string const& multi_line) const bbox_type operator() (mapnik::geometry::multi_line_string const& multi_line) const
{ {
bbox_type bbox; bbox_type bbox;
for (auto const& line : multi_line) for (auto const& line : multi_line)
@ -81,7 +81,7 @@ struct geometry_envelope
return bbox; return bbox;
} }
bbox_type operator() (mapnik::new_geometry::multi_polygon const& multi_poly) const bbox_type operator() (mapnik::geometry::multi_polygon const& multi_poly) const
{ {
bbox_type bbox; bbox_type bbox;
for (auto const& poly : multi_poly) for (auto const& poly : multi_poly)
@ -92,7 +92,7 @@ struct geometry_envelope
return bbox; return bbox;
} }
bbox_type operator() (mapnik::new_geometry::geometry_collection const& collection) const bbox_type operator() (mapnik::geometry::geometry_collection const& collection) const
{ {
bbox_type bbox; bbox_type bbox;
for (auto const& geom : collection) for (auto const& geom : collection)
@ -106,7 +106,7 @@ struct geometry_envelope
} }
inline mapnik::box2d<double> envelope(mapnik::new_geometry::geometry const& geom) inline mapnik::box2d<double> envelope(mapnik::geometry::geometry const& geom)
{ {
return detail::geometry_envelope() (geom); return detail::geometry_envelope() (geom);
} }

View file

@ -27,14 +27,14 @@
#include <boost/fusion/include/adapt_struct.hpp> #include <boost/fusion/include/adapt_struct.hpp>
BOOST_FUSION_ADAPT_STRUCT( BOOST_FUSION_ADAPT_STRUCT(
mapnik::new_geometry::point, mapnik::geometry::point,
(double, x) (double, x)
(double, y) (double, y)
) )
BOOST_FUSION_ADAPT_STRUCT( BOOST_FUSION_ADAPT_STRUCT(
mapnik::new_geometry::polygon, mapnik::geometry::polygon,
(mapnik::new_geometry::linear_ring const&, exterior_ring) (mapnik::geometry::linear_ring const&, exterior_ring)
(std::vector<mapnik::new_geometry::linear_ring> const& , interior_rings)) (std::vector<mapnik::geometry::linear_ring> const& , interior_rings))
#endif // MAPNIK_GEOMETRY_FUSION_ADAPTED_HPP #endif // MAPNIK_GEOMETRY_FUSION_ADAPTED_HPP

View file

@ -27,7 +27,7 @@
#include <mapnik/geometry_adapters.hpp> #include <mapnik/geometry_adapters.hpp>
#include <boost/geometry/algorithms/is_simple.hpp> #include <boost/geometry/algorithms/is_simple.hpp>
namespace mapnik { namespace new_geometry { namespace mapnik { namespace geometry {
namespace detail { namespace detail {
@ -63,7 +63,7 @@ struct geometry_is_simple
} }
inline bool is_simple(mapnik::new_geometry::geometry const& geom) inline bool is_simple(mapnik::geometry::geometry const& geom)
{ {
return detail::geometry_is_simple() (geom); return detail::geometry_is_simple() (geom);
} }

View file

@ -27,7 +27,7 @@
#include <mapnik/geometry_adapters.hpp> #include <mapnik/geometry_adapters.hpp>
#include <boost/geometry/algorithms/is_valid.hpp> #include <boost/geometry/algorithms/is_valid.hpp>
namespace mapnik { namespace new_geometry { namespace mapnik { namespace geometry {
namespace detail { namespace detail {
@ -63,7 +63,7 @@ struct geometry_is_valid
} }
inline bool is_valid(mapnik::new_geometry::geometry const& geom) inline bool is_valid(mapnik::geometry::geometry const& geom)
{ {
return detail::geometry_is_valid() (geom); return detail::geometry_is_valid() (geom);
} }

View file

@ -27,58 +27,58 @@
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_types.hpp> #include <mapnik/geometry_types.hpp>
namespace mapnik { namespace new_geometry { namespace detail { namespace mapnik { namespace geometry { namespace detail {
struct geometry_type struct geometry_type
{ {
mapnik::new_geometry::geometry_types operator () (mapnik::new_geometry::geometry const& geom) const mapnik::geometry::geometry_types operator () (mapnik::geometry::geometry const& geom) const
{ {
return mapnik::util::apply_visitor(*this, geom); return mapnik::util::apply_visitor(*this, geom);
} }
mapnik::new_geometry::geometry_types operator() (geometry_empty const& ) const mapnik::geometry::geometry_types operator() (geometry_empty const& ) const
{ {
return mapnik::new_geometry::geometry_types::Unknown; return mapnik::geometry::geometry_types::Unknown;
} }
mapnik::new_geometry::geometry_types operator () (mapnik::new_geometry::point const&) const mapnik::geometry::geometry_types operator () (mapnik::geometry::point const&) const
{ {
return mapnik::new_geometry::geometry_types::Point; return mapnik::geometry::geometry_types::Point;
} }
mapnik::new_geometry::geometry_types operator () (mapnik::new_geometry::line_string const&) const mapnik::geometry::geometry_types operator () (mapnik::geometry::line_string const&) const
{ {
return mapnik::new_geometry::geometry_types::LineString; return mapnik::geometry::geometry_types::LineString;
} }
mapnik::new_geometry::geometry_types operator () (mapnik::new_geometry::polygon const&) const mapnik::geometry::geometry_types operator () (mapnik::geometry::polygon const&) const
{ {
return mapnik::new_geometry::geometry_types::Polygon; return mapnik::geometry::geometry_types::Polygon;
} }
mapnik::new_geometry::geometry_types operator () (mapnik::new_geometry::multi_point const&) const mapnik::geometry::geometry_types operator () (mapnik::geometry::multi_point const&) const
{ {
return mapnik::new_geometry::geometry_types::MultiPoint; return mapnik::geometry::geometry_types::MultiPoint;
} }
mapnik::new_geometry::geometry_types operator () (mapnik::new_geometry::multi_line_string const&) const mapnik::geometry::geometry_types operator () (mapnik::geometry::multi_line_string const&) const
{ {
return mapnik::new_geometry::geometry_types::MultiLineString; return mapnik::geometry::geometry_types::MultiLineString;
} }
mapnik::new_geometry::geometry_types operator () (mapnik::new_geometry::multi_polygon const&) const mapnik::geometry::geometry_types operator () (mapnik::geometry::multi_polygon const&) const
{ {
return mapnik::new_geometry::geometry_types::MultiPolygon; return mapnik::geometry::geometry_types::MultiPolygon;
} }
mapnik::new_geometry::geometry_types operator () (mapnik::new_geometry::geometry_collection const&) const mapnik::geometry::geometry_types operator () (mapnik::geometry::geometry_collection const&) const
{ {
return mapnik::new_geometry::geometry_types::GeometryCollection; return mapnik::geometry::geometry_types::GeometryCollection;
} }
}; };
} // detail } // detail
static inline mapnik::new_geometry::geometry_types geometry_type(mapnik::new_geometry::geometry const& geom) static inline mapnik::geometry::geometry_types geometry_type(mapnik::geometry::geometry const& geom)
{ {
return detail::geometry_type()(geom); return detail::geometry_type()(geom);
} }

View file

@ -23,7 +23,7 @@
#ifndef MAPNIK_GEOMETRY_TYPES_HPP #ifndef MAPNIK_GEOMETRY_TYPES_HPP
#define MAPNIK_GEOMETRY_TYPES_HPP #define MAPNIK_GEOMETRY_TYPES_HPP
namespace mapnik { namespace new_geometry { namespace mapnik { namespace geometry {
// OGC compatible types // OGC compatible types
enum geometry_types : std::uint8_t enum geometry_types : std::uint8_t

View file

@ -49,16 +49,16 @@ struct hit_test_visitor
y_(y), y_(y),
tol_(tol) {} tol_(tol) {}
bool operator() (new_geometry::geometry_empty const& ) const bool operator() (geometry::geometry_empty const& ) const
{ {
return false; return false;
} }
bool operator() (new_geometry::point const& geom) const bool operator() (geometry::point const& geom) const
{ {
return distance(geom.x, geom.y, x_, y_) <= tol_; return distance(geom.x, geom.y, x_, y_) <= tol_;
} }
bool operator() (new_geometry::multi_point const& geom) const bool operator() (geometry::multi_point const& geom) const
{ {
for (auto const& pt : geom) for (auto const& pt : geom)
{ {
@ -66,7 +66,7 @@ struct hit_test_visitor
} }
return false; return false;
} }
bool operator() (new_geometry::line_string const& geom) const bool operator() (geometry::line_string const& geom) const
{ {
std::size_t num_points = geom.num_points(); std::size_t num_points = geom.num_points();
if (num_points > 1) if (num_points > 1)
@ -81,7 +81,7 @@ struct hit_test_visitor
} }
return false; return false;
} }
bool operator() (new_geometry::multi_line_string const& geom) const bool operator() (geometry::multi_line_string const& geom) const
{ {
for (auto const& line: geom) for (auto const& line: geom)
{ {
@ -89,7 +89,7 @@ struct hit_test_visitor
} }
return false; return false;
} }
bool operator() (new_geometry::polygon const& geom) const bool operator() (geometry::polygon const& geom) const
{ {
auto const& exterior = geom.exterior_ring; auto const& exterior = geom.exterior_ring;
std::size_t num_points = exterior.num_points(); std::size_t num_points = exterior.num_points();
@ -124,7 +124,7 @@ struct hit_test_visitor
} }
return inside; return inside;
} }
bool operator() (new_geometry::multi_polygon const& geom) const bool operator() (geometry::multi_polygon const& geom) const
{ {
for (auto const& poly: geom) for (auto const& poly: geom)
{ {
@ -132,7 +132,7 @@ struct hit_test_visitor
} }
return false; return false;
} }
bool operator() (new_geometry::geometry_collection const& collection) const bool operator() (geometry::geometry_collection const& collection) const
{ {
for (auto const& geom: collection) for (auto const& geom: collection)
{ {
@ -148,7 +148,7 @@ struct hit_test_visitor
} }
inline bool hit_test(mapnik::new_geometry::geometry const& geom, double x, double y, double tol) inline bool hit_test(mapnik::geometry::geometry const& geom, double x, double y, double tol)
{ {
return mapnik::util::apply_visitor(detail::hit_test_visitor(x,y,tol), geom); return mapnik::util::apply_visitor(detail::hit_test_visitor(x,y,tol), geom);
} }

View file

@ -42,7 +42,7 @@
namespace mapnik { namespace json { namespace mapnik { namespace json {
using position = mapnik::new_geometry::point; using position = mapnik::geometry::point;
using boxes = std::vector<std::pair<box2d<double>, std::pair<std::size_t, std::size_t>>>; using boxes = std::vector<std::pair<box2d<double>, std::pair<std::size_t, std::size_t>>>;
namespace qi = boost::spirit::qi; namespace qi = boost::spirit::qi;

View file

@ -65,9 +65,9 @@ struct end_container<mapnik::feature_impl const>
template <> template <>
struct transform_attribute<const boost::fusion::cons<mapnik::feature_impl const&, boost::fusion::nil>, struct transform_attribute<const boost::fusion::cons<mapnik::feature_impl const&, boost::fusion::nil>,
mapnik::new_geometry::geometry const& , karma::domain> mapnik::geometry::geometry const& , karma::domain>
{ {
using type = mapnik::new_geometry::geometry const&; using type = mapnik::geometry::geometry const&;
static type pre(const boost::fusion::cons<mapnik::feature_impl const&, boost::fusion::nil>& f) static type pre(const boost::fusion::cons<mapnik::feature_impl const&, boost::fusion::nil>& f)
{ {
return boost::fusion::at<mpl::int_<0> >(f).get_geometry(); return boost::fusion::at<mpl::int_<0> >(f).get_geometry();
@ -98,7 +98,7 @@ struct feature_generator_grammar :
{ {
feature_generator_grammar(); feature_generator_grammar();
karma::rule<OutputIterator, FeatureType const&()> feature; karma::rule<OutputIterator, FeatureType const&()> feature;
geometry_generator_grammar<OutputIterator, mapnik::new_geometry::geometry> geometry; geometry_generator_grammar<OutputIterator, mapnik::geometry::geometry> geometry;
properties_generator_grammar<OutputIterator, FeatureType> properties; properties_generator_grammar<OutputIterator, FeatureType> properties;
boost::phoenix::function<get_id<FeatureType> > id_; boost::phoenix::function<get_id<FeatureType> > id_;
}; };

View file

@ -47,11 +47,11 @@ namespace detail {
template <typename Geometry> template <typename Geometry>
struct get_type struct get_type
{ {
using result_type = mapnik::new_geometry::geometry_types; using result_type = mapnik::geometry::geometry_types;
template <typename T> template <typename T>
result_type operator() (T const& geom) const result_type operator() (T const& geom) const
{ {
auto type = mapnik::new_geometry::geometry_type(geom); auto type = mapnik::geometry::geometry_type(geom);
return type; return type;
} }
}; };
@ -93,23 +93,23 @@ struct geometry_generator_grammar :
{ {
geometry_generator_grammar(); geometry_generator_grammar();
karma::rule<OutputIterator, Geometry const&()> geometry; karma::rule<OutputIterator, Geometry const&()> geometry;
karma::rule<OutputIterator, karma::locals<mapnik::new_geometry::geometry_types>, Geometry const&() > geometry_dispatch; karma::rule<OutputIterator, karma::locals<mapnik::geometry::geometry_types>, Geometry const&() > geometry_dispatch;
karma::rule<OutputIterator, new_geometry::geometry const&()> point; karma::rule<OutputIterator, geometry::geometry const&()> point;
karma::rule<OutputIterator, new_geometry::point const&()> point_coord; karma::rule<OutputIterator, geometry::point const&()> point_coord;
karma::rule<OutputIterator, new_geometry::geometry const&()> linestring; karma::rule<OutputIterator, geometry::geometry const&()> linestring;
karma::rule<OutputIterator, new_geometry::line_string const&()> linestring_coord; karma::rule<OutputIterator, geometry::line_string const&()> linestring_coord;
karma::rule<OutputIterator, new_geometry::geometry const&()> polygon; karma::rule<OutputIterator, geometry::geometry const&()> polygon;
karma::rule<OutputIterator, new_geometry::polygon const&()> polygon_coord; karma::rule<OutputIterator, geometry::polygon const&()> polygon_coord;
karma::rule<OutputIterator, new_geometry::linear_ring const&()> exterior_ring_coord; karma::rule<OutputIterator, geometry::linear_ring const&()> exterior_ring_coord;
karma::rule<OutputIterator, std::vector<new_geometry::linear_ring> const&()> interior_ring_coord; karma::rule<OutputIterator, std::vector<geometry::linear_ring> const&()> interior_ring_coord;
karma::rule<OutputIterator, new_geometry::geometry const& ()> multi_point; karma::rule<OutputIterator, geometry::geometry const& ()> multi_point;
karma::rule<OutputIterator, new_geometry::multi_point const& ()> multi_point_coord; karma::rule<OutputIterator, geometry::multi_point const& ()> multi_point_coord;
karma::rule<OutputIterator, new_geometry::geometry const& ()> multi_linestring; karma::rule<OutputIterator, geometry::geometry const& ()> multi_linestring;
karma::rule<OutputIterator, new_geometry::multi_line_string const& ()> multi_linestring_coord; karma::rule<OutputIterator, geometry::multi_line_string const& ()> multi_linestring_coord;
karma::rule<OutputIterator, new_geometry::geometry const& ()> multi_polygon; karma::rule<OutputIterator, geometry::geometry const& ()> multi_polygon;
karma::rule<OutputIterator, new_geometry::multi_polygon const& ()> multi_polygon_coord; karma::rule<OutputIterator, geometry::multi_polygon const& ()> multi_polygon_coord;
karma::rule<OutputIterator, new_geometry::geometry const& ()> geometry_collection; karma::rule<OutputIterator, geometry::geometry const& ()> geometry_collection;
karma::rule<OutputIterator, new_geometry::geometry_collection const& ()> geometries; karma::rule<OutputIterator, geometry::geometry_collection const& ()> geometries;
boost::phoenix::function<detail::get_type<Geometry> > geometry_type; boost::phoenix::function<detail::get_type<Geometry> > geometry_type;
karma::real_generator<double, detail::json_coordinate_policy<double> > coordinate; karma::real_generator<double, detail::json_coordinate_policy<double> > coordinate;

View file

@ -51,25 +51,25 @@ geometry_generator_grammar<OutputIterator, Geometry>::geometry_generator_grammar
; ;
geometry_dispatch = eps[_a = geometry_type(_val)] << geometry_dispatch = eps[_a = geometry_type(_val)] <<
(&uint_(new_geometry::geometry_types::Point)[_1 = _a] (&uint_(geometry::geometry_types::Point)[_1 = _a]
<< (point | lit("null"))) << (point | lit("null")))
| |
(&uint_(new_geometry::geometry_types::LineString)[_1 = _a] (&uint_(geometry::geometry_types::LineString)[_1 = _a]
<< (linestring | lit("null"))) << (linestring | lit("null")))
| |
(&uint_(new_geometry::geometry_types::Polygon)[_1 = _a] (&uint_(geometry::geometry_types::Polygon)[_1 = _a]
<< (polygon | lit("null"))) << (polygon | lit("null")))
| |
(&uint_(new_geometry::geometry_types::MultiPoint)[_1 = _a] (&uint_(geometry::geometry_types::MultiPoint)[_1 = _a]
<< (multi_point | lit("null"))) << (multi_point | lit("null")))
| |
(&uint_(new_geometry::geometry_types::MultiLineString)[_1 = _a] (&uint_(geometry::geometry_types::MultiLineString)[_1 = _a]
<< (multi_linestring | lit("null"))) << (multi_linestring | lit("null")))
| |
(&uint_(new_geometry::geometry_types::MultiPolygon)[_1 = _a] (&uint_(geometry::geometry_types::MultiPolygon)[_1 = _a]
<< (multi_polygon | lit("null"))) << (multi_polygon | lit("null")))
| |
(&uint_(new_geometry::geometry_types::GeometryCollection)[_1 = _a] (&uint_(geometry::geometry_types::GeometryCollection)[_1 = _a]
<< (geometry_collection | lit("null"))) << (geometry_collection | lit("null")))
| |
lit("null") lit("null")

View file

@ -40,13 +40,13 @@ namespace qi = boost::spirit::qi;
template <typename Iterator, typename ErrorHandler = error_handler<Iterator> > template <typename Iterator, typename ErrorHandler = error_handler<Iterator> >
struct geometry_grammar : struct geometry_grammar :
qi::grammar<Iterator, mapnik::new_geometry::geometry() ,space_type> qi::grammar<Iterator, mapnik::geometry::geometry() ,space_type>
{ {
geometry_grammar(); geometry_grammar();
qi::rule<Iterator, mapnik::new_geometry::geometry(), space_type> start; qi::rule<Iterator, mapnik::geometry::geometry(), space_type> start;
qi::rule<Iterator, qi::locals<int, mapnik::json::coordinates>, mapnik::new_geometry::geometry(), space_type> geometry; qi::rule<Iterator, qi::locals<int, mapnik::json::coordinates>, mapnik::geometry::geometry(), space_type> geometry;
qi::symbols<char, int> geometry_type_dispatch; qi::symbols<char, int> geometry_type_dispatch;
qi::rule<Iterator, mapnik::new_geometry::geometry_collection(), space_type> geometry_collection; qi::rule<Iterator, mapnik::geometry::geometry_collection(), space_type> geometry_collection;
positions_grammar<Iterator> coordinates; positions_grammar<Iterator> coordinates;
boost::phoenix::function<create_geometry_impl> create_geometry; boost::phoenix::function<create_geometry_impl> create_geometry;
// error handler // error handler

View file

@ -34,7 +34,7 @@
namespace mapnik { namespace json { namespace mapnik { namespace json {
inline bool from_geojson(std::string const& json, mapnik::new_geometry::geometry & geom) inline bool from_geojson(std::string const& json, mapnik::geometry::geometry & geom)
{ {
using namespace boost::spirit; using namespace boost::spirit;
static const geometry_grammar<char const*> g; static const geometry_grammar<char const*> g;

View file

@ -39,7 +39,7 @@ struct create_point
void operator() (position const& pos) const void operator() (position const& pos) const
{ {
mapnik::new_geometry::point point(pos.x, pos.y); mapnik::geometry::point point(pos.x, pos.y);
geom_ = std::move(point); geom_ = std::move(point);
} }
@ -59,7 +59,7 @@ struct create_linestring
std::size_t size = ring.size(); std::size_t size = ring.size();
if (size > 1) if (size > 1)
{ {
mapnik::new_geometry::line_string line; mapnik::geometry::line_string line;
line.reserve(size); line.reserve(size);
for (auto && pt : ring) for (auto && pt : ring)
{ {
@ -83,7 +83,7 @@ struct create_polygon
void operator() (std::vector<positions> const& rings) const void operator() (std::vector<positions> const& rings) const
{ {
mapnik::new_geometry::polygon poly; mapnik::geometry::polygon poly;
std::size_t num_rings = rings.size(); std::size_t num_rings = rings.size();
if (num_rings > 1) if (num_rings > 1)
poly.interior_rings.reserve(num_rings - 1); poly.interior_rings.reserve(num_rings - 1);
@ -91,7 +91,7 @@ struct create_polygon
for ( std::size_t i = 0; i < num_rings; ++i) for ( std::size_t i = 0; i < num_rings; ++i)
{ {
std::size_t size = rings[i].size(); std::size_t size = rings[i].size();
mapnik::new_geometry::linear_ring ring; mapnik::geometry::linear_ring ring;
ring.reserve(size); ring.reserve(size);
for ( auto && pt : rings[i]) for ( auto && pt : rings[i])
{ {
@ -120,7 +120,7 @@ struct create_multipoint
void operator() (positions const& points) const void operator() (positions const& points) const
{ {
mapnik::new_geometry::multi_point multi_point; mapnik::geometry::multi_point multi_point;
multi_point.reserve(points.size()); multi_point.reserve(points.size());
for (auto && pos : points) for (auto && pos : points)
{ {
@ -143,12 +143,12 @@ struct create_multilinestring
void operator() (std::vector<positions> const& rings) const void operator() (std::vector<positions> const& rings) const
{ {
mapnik::new_geometry::multi_line_string multi_line; mapnik::geometry::multi_line_string multi_line;
multi_line.reserve(rings.size()); multi_line.reserve(rings.size());
for (auto const& ring : rings) for (auto const& ring : rings)
{ {
mapnik::new_geometry::line_string line; mapnik::geometry::line_string line;
line.reserve(ring.size()); line.reserve(ring.size());
for (auto && pt : ring) for (auto && pt : ring)
{ {
@ -173,11 +173,11 @@ struct create_multipolygon
void operator()(std::vector<std::vector<positions> > const& rings_array) const void operator()(std::vector<std::vector<positions> > const& rings_array) const
{ {
mapnik::new_geometry::multi_polygon multi_poly; mapnik::geometry::multi_polygon multi_poly;
multi_poly.reserve(rings_array.size()); multi_poly.reserve(rings_array.size());
for (auto const& rings : rings_array) for (auto const& rings : rings_array)
{ {
mapnik::new_geometry::polygon poly; mapnik::geometry::polygon poly;
std::size_t num_rings = rings.size(); std::size_t num_rings = rings.size();
if ( num_rings > 1) if ( num_rings > 1)
poly.interior_rings.reserve(num_rings - 1); poly.interior_rings.reserve(num_rings - 1);
@ -185,7 +185,7 @@ struct create_multipolygon
for ( std::size_t i = 0; i < num_rings; ++i) for ( std::size_t i = 0; i < num_rings; ++i)
{ {
std::size_t size = rings[i].size(); std::size_t size = rings[i].size();
mapnik::new_geometry::linear_ring ring; mapnik::geometry::linear_ring ring;
ring.reserve(size); ring.reserve(size);
for ( auto && pt : rings[i]) for ( auto && pt : rings[i])
{ {

View file

@ -45,7 +45,7 @@ namespace mapnik { namespace json {
struct empty {}; struct empty {};
using position = mapnik::new_geometry::point; using position = mapnik::geometry::point;
using positions = std::vector<position>; using positions = std::vector<position>;
using coordinates = util::variant<empty, position, positions, std::vector<positions>, std::vector<std::vector<positions> > > ; using coordinates = util::variant<empty, position, positions, std::vector<positions>, std::vector<std::vector<positions> > > ;

View file

@ -197,19 +197,19 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
{ {
using vertex_converter_type = Converter; using vertex_converter_type = Converter;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
auto const& geom = feature.get_geometry(); auto const& geom = feature.get_geometry();
new_geometry::geometry_types type = new_geometry::geometry_type(geom); geometry::geometry_types type = geometry::geometry_type(geom);
if (type == new_geometry::geometry_types::Point if (type == geometry::geometry_types::Point
|| type == new_geometry::geometry_types::LineString || type == geometry::geometry_types::LineString
|| type == new_geometry::geometry_types::Polygon) || type == geometry::geometry_types::Polygon)
{ {
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply), geom); mapnik::util::apply_visitor(vertex_processor_type(apply), geom);
} }
else //if (type != new_geometry::geometry_types::GeometryCollection) // multi geometries/collection else //if (type != geometry::geometry_types::GeometryCollection) // multi geometries/collection
{ {
marker_multi_policy_enum multi_policy = get<marker_multi_policy_enum, keys::markers_multipolicy>(sym, feature, vars); marker_multi_policy_enum multi_policy = get<marker_multi_policy_enum, keys::markers_multipolicy>(sym, feature, vars);
@ -218,12 +218,12 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
if (placement == MARKER_POINT_PLACEMENT && if (placement == MARKER_POINT_PLACEMENT &&
multi_policy == MARKER_WHOLE_MULTI) multi_policy == MARKER_WHOLE_MULTI)
{ {
new_geometry::point pt; geometry::point pt;
if (new_geometry::centroid(geom, pt)) if (geometry::centroid(geom, pt))
{ {
// unset any clipping since we're now dealing with a point // unset any clipping since we're now dealing with a point
converter.template unset<clip_poly_tag>(); converter.template unset<clip_poly_tag>();
new_geometry::point_vertex_adapter va(pt); geometry::point_vertex_adapter va(pt);
converter.apply(va); converter.apply(va);
} }
} }
@ -232,15 +232,15 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
{ {
// Only apply to path with largest envelope area // Only apply to path with largest envelope area
// TODO: consider using true area for polygon types // TODO: consider using true area for polygon types
if (type == new_geometry::geometry_types::MultiPolygon) if (type == geometry::geometry_types::MultiPolygon)
{ {
new_geometry::multi_polygon const& multi_poly = mapnik::util::get<new_geometry::multi_polygon>(geom); geometry::multi_polygon const& multi_poly = mapnik::util::get<geometry::multi_polygon>(geom);
double maxarea = 0; double maxarea = 0;
new_geometry::polygon const* largest = 0; geometry::polygon const* largest = 0;
for (new_geometry::polygon const& poly : multi_poly) for (geometry::polygon const& poly : multi_poly)
{ {
box2d<double> bbox = new_geometry::envelope(poly); box2d<double> bbox = geometry::envelope(poly);
new_geometry::polygon_vertex_adapter va(poly); geometry::polygon_vertex_adapter va(poly);
double area = bbox.width() * bbox.height(); double area = bbox.width() * bbox.height();
if (area > maxarea) if (area > maxarea)
{ {
@ -250,21 +250,21 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
} }
if (largest) if (largest)
{ {
new_geometry::polygon_vertex_adapter va(*largest); geometry::polygon_vertex_adapter va(*largest);
converter.apply(va); converter.apply(va);
} }
} }
} }
else if (type == new_geometry::geometry_types::MultiPolygon) else if (type == geometry::geometry_types::MultiPolygon)
{ {
if (multi_policy != MARKER_EACH_MULTI && placement != MARKER_POINT_PLACEMENT) if (multi_policy != MARKER_EACH_MULTI && placement != MARKER_POINT_PLACEMENT)
{ {
MAPNIK_LOG_WARN(marker_symbolizer) << "marker_multi_policy != 'each' has no effect with marker_placement != 'point'"; MAPNIK_LOG_WARN(marker_symbolizer) << "marker_multi_policy != 'each' has no effect with marker_placement != 'point'";
} }
new_geometry::multi_polygon const& multi_poly = mapnik::util::get<new_geometry::multi_polygon>(geom); geometry::multi_polygon const& multi_poly = mapnik::util::get<geometry::multi_polygon>(geom);
for (auto const& poly : multi_poly) for (auto const& poly : multi_poly)
{ {
new_geometry::polygon_vertex_adapter va(poly); geometry::polygon_vertex_adapter va(poly);
converter.apply(va); converter.apply(va);
} }
} }

View file

@ -49,12 +49,12 @@ public:
return false; return false;
} }
if (this->locator_.type() == new_geometry::geometry_types::Point) if (this->locator_.type() == geometry::geometry_types::Point)
{ {
return markers_point_placement<Locator, Detector>::get_point(x, y, angle, ignore_placement); return markers_point_placement<Locator, Detector>::get_point(x, y, angle, ignore_placement);
} }
if (this->locator_.type() == new_geometry::geometry_types::LineString) if (this->locator_.type() == geometry::geometry_types::LineString)
{ {
if (!label::middle_point(this->locator_, x, y)) if (!label::middle_point(this->locator_, x, y))
{ {

View file

@ -68,7 +68,7 @@ public:
return false; return false;
} }
if (this->locator_.type() == new_geometry::geometry_types::Point) if (this->locator_.type() == geometry::geometry_types::Point)
{ {
return markers_point_placement<Locator, Detector>::get_point(x, y, angle, ignore_placement); return markers_point_placement<Locator, Detector>::get_point(x, y, angle, ignore_placement);
} }

View file

@ -79,7 +79,7 @@ public:
return false; return false;
} }
if (locator_.type() == new_geometry::geometry_types::LineString) if (locator_.type() == geometry::geometry_types::LineString)
{ {
if (!label::middle_point(locator_, x, y)) if (!label::middle_point(locator_, x, y))
{ {

View file

@ -47,7 +47,7 @@ public:
return false; return false;
} }
if (this->locator_.type() == mapnik::new_geometry::geometry_types::Point) if (this->locator_.type() == mapnik::geometry::geometry_types::Point)
{ {
return markers_point_placement<Locator, Detector>::get_point(x, y, angle, ignore_placement); return markers_point_placement<Locator, Detector>::get_point(x, y, angle, ignore_placement);
} }

View file

@ -78,8 +78,8 @@ public:
} }
else else
{ {
new_geometry::geometry const& geom = (*pos_)->get_geometry(); geometry::geometry const& geom = (*pos_)->get_geometry();
if (bbox_.intersects(new_geometry::envelope(geom))) if (bbox_.intersects(geometry::envelope(geom)))
{ {
return *pos_++; return *pos_++;
} }

View file

@ -40,9 +40,9 @@ struct apply_local_alignment
x_(x), x_(x),
y_(y) {} y_(y) {}
void operator() (new_geometry::polygon_vertex_adapter & va) void operator() (geometry::polygon_vertex_adapter & va)
{ {
using clipped_geometry_type = agg::conv_clip_polygon<new_geometry::polygon_vertex_adapter>; using clipped_geometry_type = agg::conv_clip_polygon<geometry::polygon_vertex_adapter>;
using path_type = transform_path_adapter<view_transform,clipped_geometry_type>; using path_type = transform_path_adapter<view_transform,clipped_geometry_type>;
clipped_geometry_type clipped(va); clipped_geometry_type clipped(va);
clipped.clip_box(clip_box_.minx(),clip_box_.miny(),clip_box_.maxx(),clip_box_.maxy()); clipped.clip_box(clip_box_.minx(),clip_box_.miny(),clip_box_.maxx(),clip_box_.maxy());

View file

@ -36,7 +36,7 @@ namespace mapnik {
namespace detail { namespace detail {
template <typename F1, typename F2, typename F3> template <typename F1, typename F2, typename F3>
void make_building(new_geometry::polygon const& poly, double height, F1 const& face_func, F2 const& frame_func, F3 const& roof_func) void make_building(geometry::polygon const& poly, double height, F1 const& face_func, F2 const& frame_func, F3 const& roof_func)
{ {
const std::unique_ptr<path_type> frame(new path_type(path_type::types::LineString)); const std::unique_ptr<path_type> frame(new path_type(path_type::types::LineString));
const std::unique_ptr<path_type> roof(new path_type(path_type::types::Polygon)); const std::unique_ptr<path_type> roof(new path_type(path_type::types::Polygon));
@ -44,7 +44,7 @@ void make_building(new_geometry::polygon const& poly, double height, F1 const& f
double x0 = 0; double x0 = 0;
double y0 = 0; double y0 = 0;
double x,y; double x,y;
new_geometry::polygon_vertex_adapter va(poly); geometry::polygon_vertex_adapter va(poly);
va.rewind(0); va.rewind(0);
for (unsigned cm = va.vertex(&x, &y); cm != SEG_END; for (unsigned cm = va.vertex(&x, &y); cm != SEG_END;
cm = va.vertex(&x, &y)) cm = va.vertex(&x, &y))
@ -115,14 +115,14 @@ void render_building_symbolizer(mapnik::feature_impl const& feature,
{ {
auto const& geom = feature.get_geometry(); auto const& geom = feature.get_geometry();
if (geom.is<new_geometry::polygon>()) if (geom.is<geometry::polygon>())
{ {
auto const& poly = geom.get<new_geometry::polygon>(); auto const& poly = geom.get<geometry::polygon>();
detail::make_building(poly, height, face_func, frame_func, roof_func); detail::make_building(poly, height, face_func, frame_func, roof_func);
} }
else if (geom.is<new_geometry::multi_polygon>()) else if (geom.is<geometry::multi_polygon>())
{ {
auto const& multi_poly = geom.get<new_geometry::multi_polygon>(); auto const& multi_poly = geom.get<geometry::multi_polygon>();
for (auto const& poly : multi_poly) for (auto const& poly : multi_poly)
{ {
detail::make_building(poly, height, face_func, frame_func, roof_func); detail::make_building(poly, height, face_func, frame_func, roof_func);

View file

@ -343,7 +343,7 @@ void render_group_symbolizer(group_symbolizer const& sym,
// try to ensure that we don't get edge artefacts due to any // try to ensure that we don't get edge artefacts due to any
// symbolizers with avoid-edges set: only the avoid-edges of // symbolizers with avoid-edges set: only the avoid-edges of
// the group symbolizer itself should matter. // the group symbolizer itself should matter.
new_geometry::point origin_pt(x,y); geometry::point origin_pt(x,y);
sub_feature->set_geometry(origin_pt); sub_feature->set_geometry(origin_pt);
// get the layout for this set of properties // get the layout for this set of properties
for (auto const& rule : props->get_rules()) for (auto const& rule : props->get_rules())

View file

@ -117,10 +117,10 @@ struct render_marker_symbolizer_visitor
common_.scale_factor_); common_.scale_factor_);
if (clip) // optional clip (default: true) if (clip) // optional clip (default: true)
{ {
new_geometry::geometry_types type = new_geometry::geometry_type(feature_.get_geometry()); geometry::geometry_types type = geometry::geometry_type(feature_.get_geometry());
if (type == new_geometry::geometry_types::Polygon) if (type == geometry::geometry_types::Polygon)
converter.template set<clip_poly_tag>(); converter.template set<clip_poly_tag>();
else if (type == new_geometry::geometry_types::LineString) else if (type == geometry::geometry_types::LineString)
converter.template set<clip_line_tag>(); converter.template set<clip_line_tag>();
} }
@ -170,10 +170,10 @@ struct render_marker_symbolizer_visitor
common_.scale_factor_); common_.scale_factor_);
if (clip) // optional clip (default: true) if (clip) // optional clip (default: true)
{ {
new_geometry::geometry_types type = new_geometry::geometry_type(feature_.get_geometry()); geometry::geometry_types type = geometry::geometry_type(feature_.get_geometry());
if (type == new_geometry::geometry_types::Polygon) if (type == geometry::geometry_types::Polygon)
converter.template set<clip_poly_tag>(); converter.template set<clip_poly_tag>();
else if (type == new_geometry::geometry_types::LineString) else if (type == geometry::geometry_types::LineString)
converter.template set<clip_line_tag>(); converter.template set<clip_line_tag>();
} }
@ -235,10 +235,10 @@ struct render_marker_symbolizer_visitor
if (clip) // optional clip (default: true) if (clip) // optional clip (default: true)
{ {
new_geometry::geometry_types type = new_geometry::geometry_type(feature_.get_geometry()); geometry::geometry_types type = geometry::geometry_type(feature_.get_geometry());
if (type == new_geometry::geometry_types::Polygon) if (type == geometry::geometry_types::Polygon)
converter.template set<clip_poly_tag>(); converter.template set<clip_poly_tag>();
else if (type == new_geometry::geometry_types::LineString) else if (type == geometry::geometry_types::LineString)
converter.template set<clip_line_tag>(); converter.template set<clip_line_tag>();
} }
converter.template set<transform_tag>(); //always transform converter.template set<transform_tag>(); //always transform

View file

@ -63,11 +63,11 @@ void render_point_symbolizer(point_symbolizer const &sym,
agg::trans_affine recenter_tr = recenter * tr; agg::trans_affine recenter_tr = recenter * tr;
box2d<double> label_ext = bbox * recenter_tr * agg::trans_affine_scaling(common.scale_factor_); box2d<double> label_ext = bbox * recenter_tr * agg::trans_affine_scaling(common.scale_factor_);
mapnik::new_geometry::geometry const& geometry = feature.get_geometry(); mapnik::geometry::geometry const& geometry = feature.get_geometry();
mapnik::new_geometry::point pt; mapnik::geometry::point pt;
if (placement == CENTROID_POINT_PLACEMENT) if (placement == CENTROID_POINT_PLACEMENT)
{ {
if (!new_geometry::centroid(geometry, pt)) return; if (!geometry::centroid(geometry, pt)) return;
} }
//else //else
//{ //{

View file

@ -61,7 +61,7 @@ void render_polygon_symbolizer(polygon_symbolizer const &sym,
if (smooth > 0.0) converter.template set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.template set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());

View file

@ -43,7 +43,7 @@ namespace mapnik { namespace svg {
svg = point | linestring | polygon svg = point | linestring | polygon
; ;
point = &uint_(mapnik::new_geometry::geometry_types::Point)[_1 = _type(_val)] point = &uint_(mapnik::geometry::geometry_types::Point)[_1 = _type(_val)]
<< svg_point [_1 = _first(_val)] << svg_point [_1 = _first(_val)]
; ;
@ -53,11 +53,11 @@ namespace mapnik { namespace svg {
<< lit('\"') << lit('\"')
; ;
linestring = &uint_(mapnik::new_geometry::geometry_types::LineString)[_1 = _type(_val)] linestring = &uint_(mapnik::geometry::geometry_types::LineString)[_1 = _type(_val)]
<< lit("d=\"") << svg_path << lit("\"") << lit("d=\"") << svg_path << lit("\"")
; ;
polygon = &uint_(mapnik::new_geometry::geometry_types::Polygon)[_1 = _type(_val)] polygon = &uint_(mapnik::geometry::geometry_types::Polygon)[_1 = _type(_val)]
<< lit("d=\"") << svg_path << lit("\"") << lit("d=\"") << svg_path << lit("\"")
; ;

View file

@ -88,11 +88,11 @@ protected:
//Processing //Processing
// Using list instead of vector, because we delete random elements and need iterators to stay valid. // Using list instead of vector, because we delete random elements and need iterators to stay valid.
// Remaining geometries to be processed. // Remaining geometries to be processed.
mutable std::list<new_geometry::geometry*> geometries_to_process_; mutable std::list<geometry::geometry*> geometries_to_process_;
// Remaining points to be processed. // Remaining points to be processed.
mutable std::list<pixel_position> points_; mutable std::list<pixel_position> points_;
// Geometry currently being processed. // Geometry currently being processed.
mutable std::list<new_geometry::geometry*>::iterator geo_itr_; mutable std::list<geometry::geometry*>::iterator geo_itr_;
// Point currently being processed. // Point currently being processed.
mutable std::list<pixel_position>::iterator point_itr_; mutable std::list<pixel_position>::iterator point_itr_;
// Use point placement. Otherwise line placement is used. // Use point placement. Otherwise line placement is used.

View file

@ -37,49 +37,49 @@ namespace detail {
struct datasource_geometry_type struct datasource_geometry_type
{ {
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::geometry_empty const&) const mapnik::datasource_geometry_t operator () (mapnik::geometry::geometry_empty const&) const
{ {
return mapnik::datasource_geometry_t::Unknown; return mapnik::datasource_geometry_t::Unknown;
} }
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::point const&) const mapnik::datasource_geometry_t operator () (mapnik::geometry::point const&) const
{ {
return mapnik::datasource_geometry_t::Point; return mapnik::datasource_geometry_t::Point;
} }
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::line_string const&) const mapnik::datasource_geometry_t operator () (mapnik::geometry::line_string const&) const
{ {
return mapnik::datasource_geometry_t::LineString; return mapnik::datasource_geometry_t::LineString;
} }
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::polygon const&) const mapnik::datasource_geometry_t operator () (mapnik::geometry::polygon const&) const
{ {
return mapnik::datasource_geometry_t::Polygon; return mapnik::datasource_geometry_t::Polygon;
} }
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::multi_point const&) const mapnik::datasource_geometry_t operator () (mapnik::geometry::multi_point const&) const
{ {
return mapnik::datasource_geometry_t::Point; return mapnik::datasource_geometry_t::Point;
} }
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::multi_line_string const&) const mapnik::datasource_geometry_t operator () (mapnik::geometry::multi_line_string const&) const
{ {
return mapnik::datasource_geometry_t::LineString; return mapnik::datasource_geometry_t::LineString;
} }
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::multi_polygon const&) const mapnik::datasource_geometry_t operator () (mapnik::geometry::multi_polygon const&) const
{ {
return mapnik::datasource_geometry_t::Polygon; return mapnik::datasource_geometry_t::Polygon;
} }
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::geometry_collection const&) const mapnik::datasource_geometry_t operator () (mapnik::geometry::geometry_collection const&) const
{ {
return mapnik::datasource_geometry_t::Collection; return mapnik::datasource_geometry_t::Collection;
} }
}; };
} // detail } // detail
static inline mapnik::datasource_geometry_t to_ds_type(mapnik::new_geometry::geometry const& geom) static inline mapnik::datasource_geometry_t to_ds_type(mapnik::geometry::geometry const& geom)
{ {
return util::apply_visitor(detail::datasource_geometry_type(), geom); return util::apply_visitor(detail::datasource_geometry_type(), geom);
} }

View file

@ -29,10 +29,10 @@
namespace mapnik { namespace util { namespace mapnik { namespace util {
inline bool to_geojson(std::string & json, mapnik::new_geometry::geometry const& geom) inline bool to_geojson(std::string & json, mapnik::geometry::geometry const& geom)
{ {
using sink_type = std::back_insert_iterator<std::string>; using sink_type = std::back_insert_iterator<std::string>;
static const mapnik::json::geometry_generator_grammar<sink_type, mapnik::new_geometry::geometry> grammar; static const mapnik::json::geometry_generator_grammar<sink_type, mapnik::geometry::geometry> grammar;
sink_type sink(json); sink_type sink(json);
return boost::spirit::karma::generate(sink, grammar, geom); return boost::spirit::karma::generate(sink, grammar, geom);
} }

View file

@ -131,20 +131,20 @@ struct wkb_buffer
using wkb_buffer_ptr = std::unique_ptr<wkb_buffer>; using wkb_buffer_ptr = std::unique_ptr<wkb_buffer>;
wkb_buffer_ptr point_wkb( new_geometry::point const& pt, wkbByteOrder byte_order) wkb_buffer_ptr point_wkb( geometry::point const& pt, wkbByteOrder byte_order)
{ {
std::size_t size = 1 + 4 + 8 * 2 ; // byteOrder + wkbType + Point std::size_t size = 1 + 4 + 8 * 2 ; // byteOrder + wkbType + Point
wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size); wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size);
wkb_stream ss(wkb->buffer(), wkb->size()); wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1); ss.write(reinterpret_cast<char*>(&byte_order),1);
write(ss, static_cast<int>(new_geometry::geometry_types::Point), 4 , byte_order); write(ss, static_cast<int>(geometry::geometry_types::Point), 4 , byte_order);
write(ss, pt.x, 8, byte_order); write(ss, pt.x, 8, byte_order);
write(ss, pt.y, 8, byte_order); write(ss, pt.y, 8, byte_order);
assert(ss.good()); assert(ss.good());
return std::move(wkb); return std::move(wkb);
} }
wkb_buffer_ptr line_string_wkb(new_geometry::line_string const& line, wkbByteOrder byte_order) wkb_buffer_ptr line_string_wkb(geometry::line_string const& line, wkbByteOrder byte_order)
{ {
unsigned num_points = line.size(); unsigned num_points = line.size();
assert(num_points > 1); assert(num_points > 1);
@ -152,11 +152,11 @@ wkb_buffer_ptr line_string_wkb(new_geometry::line_string const& line, wkbByteOrd
wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size); wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size);
wkb_stream ss(wkb->buffer(), wkb->size()); wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1); ss.write(reinterpret_cast<char*>(&byte_order),1);
write(ss, static_cast<int>(mapnik::new_geometry::geometry_types::LineString) , 4, byte_order); write(ss, static_cast<int>(mapnik::geometry::geometry_types::LineString) , 4, byte_order);
write(ss, num_points, 4, byte_order); write(ss, num_points, 4, byte_order);
for (unsigned i=0; i< num_points; ++i) for (unsigned i=0; i< num_points; ++i)
{ {
new_geometry::point const& pt = line[i]; geometry::point const& pt = line[i];
write(ss, pt.x, 8, byte_order); write(ss, pt.x, 8, byte_order);
write(ss, pt.y, 8, byte_order); write(ss, pt.y, 8, byte_order);
} }
@ -164,7 +164,7 @@ wkb_buffer_ptr line_string_wkb(new_geometry::line_string const& line, wkbByteOrd
return std::move(wkb); return std::move(wkb);
} }
wkb_buffer_ptr polygon_wkb( new_geometry::polygon const& poly, wkbByteOrder byte_order) wkb_buffer_ptr polygon_wkb( geometry::polygon const& poly, wkbByteOrder byte_order)
{ {
std::size_t size = 1 + 4 + 4 ; // byteOrder + wkbType + numRings std::size_t size = 1 + 4 + 4 ; // byteOrder + wkbType + numRings
size += 4 + 2 * 8 * poly.exterior_ring.size(); size += 4 + 2 * 8 * poly.exterior_ring.size();
@ -177,7 +177,7 @@ wkb_buffer_ptr polygon_wkb( new_geometry::polygon const& poly, wkbByteOrder byte
wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size); wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size);
wkb_stream ss(wkb->buffer(), wkb->size()); wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1); ss.write(reinterpret_cast<char*>(&byte_order),1);
write(ss, static_cast<int>(mapnik::new_geometry::geometry_types::Polygon), 4, byte_order); write(ss, static_cast<int>(mapnik::geometry::geometry_types::Polygon), 4, byte_order);
write(ss, poly.num_rings(), 4, byte_order); write(ss, poly.num_rings(), 4, byte_order);
// exterior // exterior
@ -202,18 +202,18 @@ wkb_buffer_ptr polygon_wkb( new_geometry::polygon const& poly, wkbByteOrder byte
return std::move(wkb); return std::move(wkb);
} }
wkb_buffer_ptr multi_point_wkb( new_geometry::multi_point const& multi_pt, wkbByteOrder byte_order) wkb_buffer_ptr multi_point_wkb( geometry::multi_point const& multi_pt, wkbByteOrder byte_order)
{ {
std::size_t size = 1 + 4 + 4 + (1 + 4 + 8 * 2) * multi_pt.size() ; // byteOrder + wkbType + num_point + Point.size * num_points std::size_t size = 1 + 4 + 4 + (1 + 4 + 8 * 2) * multi_pt.size() ; // byteOrder + wkbType + num_point + Point.size * num_points
wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size); wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size);
wkb_stream ss(wkb->buffer(), wkb->size()); wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1); ss.write(reinterpret_cast<char*>(&byte_order),1);
write(ss, static_cast<int>(new_geometry::geometry_types::MultiPoint), 4, byte_order); write(ss, static_cast<int>(geometry::geometry_types::MultiPoint), 4, byte_order);
write(ss, multi_pt.size(), 4 ,byte_order); write(ss, multi_pt.size(), 4 ,byte_order);
for (auto const& pt : multi_pt) for (auto const& pt : multi_pt)
{ {
ss.write(reinterpret_cast<char*>(&byte_order),1); ss.write(reinterpret_cast<char*>(&byte_order),1);
write(ss, static_cast<int>(new_geometry::geometry_types::Point), 4, byte_order); write(ss, static_cast<int>(geometry::geometry_types::Point), 4, byte_order);
write(ss, pt.x, 8, byte_order); write(ss, pt.x, 8, byte_order);
write(ss, pt.y, 8, byte_order); write(ss, pt.y, 8, byte_order);
} }
@ -232,34 +232,34 @@ struct geometry_to_wkb
geometry_to_wkb(wkbByteOrder byte_order) geometry_to_wkb(wkbByteOrder byte_order)
: byte_order_(byte_order) {} : byte_order_(byte_order) {}
result_type operator() (new_geometry::geometry const& geom) const result_type operator() (geometry::geometry const& geom) const
{ {
return util::apply_visitor(*this, geom); return util::apply_visitor(*this, geom);
} }
result_type operator() (new_geometry::geometry_empty const&) const result_type operator() (geometry::geometry_empty const&) const
{ {
return result_type(); return result_type();
} }
result_type operator() (new_geometry::point const& pt) const result_type operator() (geometry::point const& pt) const
{ {
return point_wkb(pt, byte_order_); return point_wkb(pt, byte_order_);
} }
result_type operator() (new_geometry::line_string const& line) const result_type operator() (geometry::line_string const& line) const
{ {
return line_string_wkb(line, byte_order_); return line_string_wkb(line, byte_order_);
} }
result_type operator() (new_geometry::polygon const& poly) const result_type operator() (geometry::polygon const& poly) const
{ {
return polygon_wkb(poly, byte_order_); return polygon_wkb(poly, byte_order_);
} }
// multi/collection // multi/collection
result_type operator() (new_geometry::multi_point const& multi_pt) const result_type operator() (geometry::multi_point const& multi_pt) const
{ {
return multi_point_wkb(multi_pt, byte_order_); return multi_point_wkb(multi_pt, byte_order_);
} }
@ -287,7 +287,7 @@ wkb_buffer_ptr multi_geom_wkb(MultiGeometry const& multi_geom, wkbByteOrder byte
wkb_buffer_ptr multi_wkb = std::make_unique<wkb_buffer>(multi_size); wkb_buffer_ptr multi_wkb = std::make_unique<wkb_buffer>(multi_size);
wkb_stream ss(multi_wkb->buffer(), multi_wkb->size()); wkb_stream ss(multi_wkb->buffer(), multi_wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1); ss.write(reinterpret_cast<char*>(&byte_order),1);
write(ss, static_cast<int>(new_geometry::detail::geometry_type()(multi_geom)) , 4, byte_order); write(ss, static_cast<int>(geometry::detail::geometry_type()(multi_geom)) , 4, byte_order);
write(ss, multi_geom.size(), 4 ,byte_order); write(ss, multi_geom.size(), 4 ,byte_order);
for ( wkb_buffer_ptr const& wkb : wkb_cont) for ( wkb_buffer_ptr const& wkb : wkb_cont)

View file

@ -28,90 +28,90 @@
namespace boost { namespace spirit { namespace traits { namespace boost { namespace spirit { namespace traits {
template <> template <>
struct transform_attribute<mapnik::new_geometry::geometry const, struct transform_attribute<mapnik::geometry::geometry const,
mapnik::new_geometry::point const&, karma::domain> mapnik::geometry::point const&, karma::domain>
{ {
using type = mapnik::new_geometry::point const&; using type = mapnik::geometry::point const&;
static type pre(mapnik::new_geometry::geometry const& geom) static type pre(mapnik::geometry::geometry const& geom)
{ {
return mapnik::util::get<mapnik::new_geometry::point>(geom); return mapnik::util::get<mapnik::geometry::point>(geom);
} }
}; };
template <> template <>
struct transform_attribute<mapnik::new_geometry::geometry const, struct transform_attribute<mapnik::geometry::geometry const,
mapnik::new_geometry::line_string const&, karma::domain> mapnik::geometry::line_string const&, karma::domain>
{ {
using type = mapnik::new_geometry::line_string const&; using type = mapnik::geometry::line_string const&;
static type pre(mapnik::new_geometry::geometry const& geom) static type pre(mapnik::geometry::geometry const& geom)
{ {
return mapnik::util::get<mapnik::new_geometry::line_string>(geom); return mapnik::util::get<mapnik::geometry::line_string>(geom);
} }
}; };
template <> template <>
struct transform_attribute<mapnik::new_geometry::geometry const, struct transform_attribute<mapnik::geometry::geometry const,
mapnik::new_geometry::polygon const&, karma::domain> mapnik::geometry::polygon const&, karma::domain>
{ {
using type = mapnik::new_geometry::polygon const&; using type = mapnik::geometry::polygon const&;
static type pre(mapnik::new_geometry::geometry const& geom) static type pre(mapnik::geometry::geometry const& geom)
{ {
return mapnik::util::get<mapnik::new_geometry::polygon>(geom); return mapnik::util::get<mapnik::geometry::polygon>(geom);
} }
}; };
template <> template <>
struct transform_attribute<mapnik::new_geometry::polygon const, struct transform_attribute<mapnik::geometry::polygon const,
std::vector<mapnik::new_geometry::linear_ring> const&, karma::domain> std::vector<mapnik::geometry::linear_ring> const&, karma::domain>
{ {
using type = std::vector<mapnik::new_geometry::linear_ring> const&; using type = std::vector<mapnik::geometry::linear_ring> const&;
static type pre(mapnik::new_geometry::polygon const& poly) static type pre(mapnik::geometry::polygon const& poly)
{ {
return poly.interior_rings; return poly.interior_rings;
} }
}; };
template <> template <>
struct transform_attribute<mapnik::new_geometry::geometry const, struct transform_attribute<mapnik::geometry::geometry const,
mapnik::new_geometry::multi_point const&, karma::domain> mapnik::geometry::multi_point const&, karma::domain>
{ {
using type = mapnik::new_geometry::multi_point const&; using type = mapnik::geometry::multi_point const&;
static type pre(mapnik::new_geometry::geometry const& geom) static type pre(mapnik::geometry::geometry const& geom)
{ {
return mapnik::util::get<mapnik::new_geometry::multi_point>(geom); return mapnik::util::get<mapnik::geometry::multi_point>(geom);
} }
}; };
template <> template <>
struct transform_attribute<mapnik::new_geometry::geometry const, struct transform_attribute<mapnik::geometry::geometry const,
mapnik::new_geometry::multi_line_string const&, karma::domain> mapnik::geometry::multi_line_string const&, karma::domain>
{ {
using type = mapnik::new_geometry::multi_line_string const&; using type = mapnik::geometry::multi_line_string const&;
static type pre(mapnik::new_geometry::geometry const& geom) static type pre(mapnik::geometry::geometry const& geom)
{ {
return mapnik::util::get<mapnik::new_geometry::multi_line_string>(geom); return mapnik::util::get<mapnik::geometry::multi_line_string>(geom);
} }
}; };
template <> template <>
struct transform_attribute<mapnik::new_geometry::geometry const, struct transform_attribute<mapnik::geometry::geometry const,
mapnik::new_geometry::multi_polygon const&, karma::domain> mapnik::geometry::multi_polygon const&, karma::domain>
{ {
using type = mapnik::new_geometry::multi_polygon const&; using type = mapnik::geometry::multi_polygon const&;
static type pre(mapnik::new_geometry::geometry const& geom) static type pre(mapnik::geometry::geometry const& geom)
{ {
return mapnik::util::get<mapnik::new_geometry::multi_polygon>(geom); return mapnik::util::get<mapnik::geometry::multi_polygon>(geom);
} }
}; };
template <> template <>
struct transform_attribute<mapnik::new_geometry::geometry const, struct transform_attribute<mapnik::geometry::geometry const,
mapnik::new_geometry::geometry_collection const&, karma::domain> mapnik::geometry::geometry_collection const&, karma::domain>
{ {
using type = mapnik::new_geometry::geometry_collection const&; using type = mapnik::geometry::geometry_collection const&;
static type pre(mapnik::new_geometry::geometry const& geom) static type pre(mapnik::geometry::geometry const& geom)
{ {
return mapnik::util::get<mapnik::new_geometry::geometry_collection>(geom); return mapnik::util::get<mapnik::geometry::geometry_collection>(geom);
} }
}; };

View file

@ -25,7 +25,7 @@
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
namespace mapnik { namespace new_geometry { namespace mapnik { namespace geometry {
template <typename T> template <typename T>
struct vertex_processor struct vertex_processor

View file

@ -59,7 +59,7 @@ class MAPNIK_DECL geometry_utils : private util::noncopyable
{ {
public: public:
static mapnik::new_geometry::geometry from_wkb(const char* wkb, static mapnik::geometry::geometry from_wkb(const char* wkb,
unsigned size, unsigned size,
wkbFormat format = wkbGeneric); wkbFormat format = wkbGeneric);
}; };

View file

@ -35,7 +35,7 @@
namespace mapnik { namespace mapnik {
inline bool from_wkt(std::string const& wkt, mapnik::new_geometry::geometry & geom) inline bool from_wkt(std::string const& wkt, mapnik::geometry::geometry & geom)
{ {
using namespace boost::spirit; using namespace boost::spirit;
static const mapnik::wkt::wkt_grammar<std::string::const_iterator> g; static const mapnik::wkt::wkt_grammar<std::string::const_iterator> g;
@ -45,10 +45,10 @@ inline bool from_wkt(std::string const& wkt, mapnik::new_geometry::geometry & ge
return qi::phrase_parse(first, last, (g)(boost::phoenix::ref(geom)), space); return qi::phrase_parse(first, last, (g)(boost::phoenix::ref(geom)), space);
} }
inline bool to_wkt(std::string & wkt, mapnik::new_geometry::geometry const& geom) inline bool to_wkt(std::string & wkt, mapnik::geometry::geometry const& geom)
{ {
using sink_type = std::back_insert_iterator<std::string>; using sink_type = std::back_insert_iterator<std::string>;
static const mapnik::wkt::wkt_generator_grammar<sink_type, mapnik::new_geometry::geometry> generator; static const mapnik::wkt::wkt_generator_grammar<sink_type, mapnik::geometry::geometry> generator;
sink_type sink(wkt); sink_type sink(wkt);
return boost::spirit::karma::generate(sink, generator, geom); return boost::spirit::karma::generate(sink, generator, geom);
} }

View file

@ -49,11 +49,11 @@ namespace detail {
template <typename Geometry> template <typename Geometry>
struct get_type struct get_type
{ {
using result_type = mapnik::new_geometry::geometry_types; using result_type = mapnik::geometry::geometry_types;
template <typename T> template <typename T>
result_type operator() (T const& geom) const result_type operator() (T const& geom) const
{ {
auto type = mapnik::new_geometry::geometry_type(geom); auto type = mapnik::geometry::geometry_type(geom);
return type; return type;
} }
}; };
@ -94,25 +94,25 @@ struct wkt_generator_grammar :
wkt_generator_grammar(); wkt_generator_grammar();
// rules // rules
karma::rule<OutputIterator, Geometry const&()> geometry; karma::rule<OutputIterator, Geometry const&()> geometry;
karma::rule<OutputIterator, karma::locals<mapnik::new_geometry::geometry_types>, Geometry const&() > geometry_dispatch; karma::rule<OutputIterator, karma::locals<mapnik::geometry::geometry_types>, Geometry const&() > geometry_dispatch;
karma::rule<OutputIterator, new_geometry::geometry const&()> point; karma::rule<OutputIterator, geometry::geometry const&()> point;
karma::rule<OutputIterator, new_geometry::point const&()> point_coord; karma::rule<OutputIterator, geometry::point const&()> point_coord;
karma::rule<OutputIterator, new_geometry::geometry const&()> linestring; karma::rule<OutputIterator, geometry::geometry const&()> linestring;
karma::rule<OutputIterator, new_geometry::line_string const&()> linestring_coord; karma::rule<OutputIterator, geometry::line_string const&()> linestring_coord;
karma::rule<OutputIterator, new_geometry::geometry const&()> polygon; karma::rule<OutputIterator, geometry::geometry const&()> polygon;
karma::rule<OutputIterator, new_geometry::polygon const&()> polygon_coord; karma::rule<OutputIterator, geometry::polygon const&()> polygon_coord;
karma::rule<OutputIterator, new_geometry::linear_ring const&()> exterior_ring_coord; karma::rule<OutputIterator, geometry::linear_ring const&()> exterior_ring_coord;
karma::rule<OutputIterator, std::vector<new_geometry::linear_ring> const&()> interior_ring_coord; karma::rule<OutputIterator, std::vector<geometry::linear_ring> const&()> interior_ring_coord;
karma::rule<OutputIterator, new_geometry::geometry const& ()> multi_point; karma::rule<OutputIterator, geometry::geometry const& ()> multi_point;
karma::rule<OutputIterator, new_geometry::multi_point const& ()> multi_point_coord; karma::rule<OutputIterator, geometry::multi_point const& ()> multi_point_coord;
karma::rule<OutputIterator, new_geometry::geometry const& ()> multi_linestring; karma::rule<OutputIterator, geometry::geometry const& ()> multi_linestring;
karma::rule<OutputIterator, new_geometry::multi_line_string const& ()> multi_linestring_coord; karma::rule<OutputIterator, geometry::multi_line_string const& ()> multi_linestring_coord;
karma::rule<OutputIterator, new_geometry::geometry const& ()> multi_polygon; karma::rule<OutputIterator, geometry::geometry const& ()> multi_polygon;
karma::rule<OutputIterator, new_geometry::multi_polygon const& ()> multi_polygon_coord; karma::rule<OutputIterator, geometry::multi_polygon const& ()> multi_polygon_coord;
karma::rule<OutputIterator, new_geometry::geometry const& ()> geometry_collection; karma::rule<OutputIterator, geometry::geometry const& ()> geometry_collection;
karma::rule<OutputIterator, new_geometry::geometry_collection const& ()> geometries; karma::rule<OutputIterator, geometry::geometry_collection const& ()> geometries;
boost::phoenix::function<detail::get_type<Geometry> > geometry_type; boost::phoenix::function<detail::get_type<Geometry> > geometry_type;
karma::symbols<mapnik::new_geometry::geometry_types, char const*> empty; karma::symbols<mapnik::geometry::geometry_types, char const*> empty;
// //
karma::real_generator<double, detail::wkt_coordinate_policy<double> > coordinate; karma::real_generator<double, detail::wkt_coordinate_policy<double> > coordinate;
}; };

View file

@ -40,38 +40,38 @@ wkt_generator_grammar<OutputIterator, Geometry>::wkt_generator_grammar()
boost::spirit::karma::eps_type eps; boost::spirit::karma::eps_type eps;
empty.add empty.add
(new_geometry::geometry_types::Point, "POINT EMPTY") (geometry::geometry_types::Point, "POINT EMPTY")
(new_geometry::geometry_types::LineString, "LINESTRING EMPTY") (geometry::geometry_types::LineString, "LINESTRING EMPTY")
(new_geometry::geometry_types::Polygon, "POLYGON EMPTY") (geometry::geometry_types::Polygon, "POLYGON EMPTY")
(new_geometry::geometry_types::MultiPoint, "MULTIPOINT EMPTY") (geometry::geometry_types::MultiPoint, "MULTIPOINT EMPTY")
(new_geometry::geometry_types::MultiLineString, "MULTILINESTRING EMPTY") (geometry::geometry_types::MultiLineString, "MULTILINESTRING EMPTY")
(new_geometry::geometry_types::MultiPolygon, "MULTIPOLYGON EMPTY") (geometry::geometry_types::MultiPolygon, "MULTIPOLYGON EMPTY")
(new_geometry::geometry_types::GeometryCollection, "GEOMETRYCOLLECTION EMPTY") (geometry::geometry_types::GeometryCollection, "GEOMETRYCOLLECTION EMPTY")
; ;
geometry = geometry_dispatch.alias() geometry = geometry_dispatch.alias()
; ;
geometry_dispatch = eps[_a = geometry_type(_val)] << geometry_dispatch = eps[_a = geometry_type(_val)] <<
(&uint_(new_geometry::geometry_types::Point)[_1 = _a] (&uint_(geometry::geometry_types::Point)[_1 = _a]
<< (point | empty[_1 = _a])) << (point | empty[_1 = _a]))
| |
(&uint_(new_geometry::geometry_types::LineString)[_1 = _a] (&uint_(geometry::geometry_types::LineString)[_1 = _a]
<< (linestring | empty[_1 = _a])) << (linestring | empty[_1 = _a]))
| |
(&uint_(new_geometry::geometry_types::Polygon)[_1 = _a] (&uint_(geometry::geometry_types::Polygon)[_1 = _a]
<< (polygon | empty[_1 = _a])) << (polygon | empty[_1 = _a]))
| |
(&uint_(new_geometry::geometry_types::MultiPoint)[_1 = _a] (&uint_(geometry::geometry_types::MultiPoint)[_1 = _a]
<< ( multi_point | empty[_1 = _a])) << ( multi_point | empty[_1 = _a]))
| |
(&uint_(new_geometry::geometry_types::MultiLineString)[_1 = _a] (&uint_(geometry::geometry_types::MultiLineString)[_1 = _a]
<< (multi_linestring | empty[_1 = _a])) << (multi_linestring | empty[_1 = _a]))
| |
(&uint_(new_geometry::geometry_types::MultiPolygon)[_1 = _a] (&uint_(geometry::geometry_types::MultiPolygon)[_1 = _a]
<< (multi_polygon | empty[_1 = _a])) << (multi_polygon | empty[_1 = _a]))
| |
(&uint_(new_geometry::geometry_types::GeometryCollection)[_1 = _a] (&uint_(geometry::geometry_types::GeometryCollection)[_1 = _a]
<< (geometry_collection | empty[_1 = _a])) << (geometry_collection | empty[_1 = _a]))
; ;

View file

@ -85,29 +85,29 @@ struct add_hole
} }
template <typename Iterator> template <typename Iterator>
struct wkt_grammar : qi::grammar<Iterator, void(mapnik::new_geometry::geometry&) , ascii::space_type> struct wkt_grammar : qi::grammar<Iterator, void(mapnik::geometry::geometry&) , ascii::space_type>
{ {
wkt_grammar(); wkt_grammar();
qi::rule<Iterator, void(mapnik::new_geometry::geometry&), ascii::space_type> geometry_tagged_text; qi::rule<Iterator, void(mapnik::geometry::geometry&), ascii::space_type> geometry_tagged_text;
qi::rule<Iterator, void(mapnik::new_geometry::geometry&), ascii::space_type> point_tagged_text; qi::rule<Iterator, void(mapnik::geometry::geometry&), ascii::space_type> point_tagged_text;
qi::rule<Iterator, void(mapnik::new_geometry::geometry&), ascii::space_type> linestring_tagged_text; qi::rule<Iterator, void(mapnik::geometry::geometry&), ascii::space_type> linestring_tagged_text;
qi::rule<Iterator, void(mapnik::new_geometry::geometry&), ascii::space_type> polygon_tagged_text; qi::rule<Iterator, void(mapnik::geometry::geometry&), ascii::space_type> polygon_tagged_text;
qi::rule<Iterator, void(mapnik::new_geometry::geometry&), ascii::space_type> multipoint_tagged_text; qi::rule<Iterator, void(mapnik::geometry::geometry&), ascii::space_type> multipoint_tagged_text;
qi::rule<Iterator, void(mapnik::new_geometry::geometry&), ascii::space_type> multilinestring_tagged_text; qi::rule<Iterator, void(mapnik::geometry::geometry&), ascii::space_type> multilinestring_tagged_text;
qi::rule<Iterator, void(mapnik::new_geometry::geometry&), ascii::space_type> multipolygon_tagged_text; qi::rule<Iterator, void(mapnik::geometry::geometry&), ascii::space_type> multipolygon_tagged_text;
qi::rule<Iterator, void(mapnik::new_geometry::geometry&), ascii::space_type> geometrycollection_tagged_text; qi::rule<Iterator, void(mapnik::geometry::geometry&), ascii::space_type> geometrycollection_tagged_text;
qi::rule<Iterator, mapnik::new_geometry::point(), ascii::space_type> point_text; qi::rule<Iterator, mapnik::geometry::point(), ascii::space_type> point_text;
qi::rule<Iterator, mapnik::new_geometry::line_string(), ascii::space_type> linestring_text; qi::rule<Iterator, mapnik::geometry::line_string(), ascii::space_type> linestring_text;
qi::rule<Iterator, mapnik::new_geometry::linear_ring(), ascii::space_type> linearring_text; qi::rule<Iterator, mapnik::geometry::linear_ring(), ascii::space_type> linearring_text;
qi::rule<Iterator, mapnik::new_geometry::polygon(), ascii::space_type> polygon_text; qi::rule<Iterator, mapnik::geometry::polygon(), ascii::space_type> polygon_text;
qi::rule<Iterator, mapnik::new_geometry::multi_point(), ascii::space_type> multipoint_text; qi::rule<Iterator, mapnik::geometry::multi_point(), ascii::space_type> multipoint_text;
qi::rule<Iterator, mapnik::new_geometry::multi_line_string(), ascii::space_type> multilinestring_text; qi::rule<Iterator, mapnik::geometry::multi_line_string(), ascii::space_type> multilinestring_text;
qi::rule<Iterator, mapnik::new_geometry::multi_polygon(), ascii::space_type> multipolygon_text; qi::rule<Iterator, mapnik::geometry::multi_polygon(), ascii::space_type> multipolygon_text;
qi::rule<Iterator, qi::locals<mapnik::new_geometry::geometry>, qi::rule<Iterator, qi::locals<mapnik::geometry::geometry>,
mapnik::new_geometry::geometry_collection(), ascii::space_type> geometrycollection_text; mapnik::geometry::geometry_collection(), ascii::space_type> geometrycollection_text;
qi::rule<Iterator, mapnik::new_geometry::point(), ascii::space_type> point; qi::rule<Iterator, mapnik::geometry::point(), ascii::space_type> point;
qi::rule<Iterator, mapnik::new_geometry::line_string(), ascii::space_type> points; qi::rule<Iterator, mapnik::geometry::line_string(), ascii::space_type> points;
qi::rule<Iterator, mapnik::new_geometry::linear_ring(), ascii::space_type> ring_points; qi::rule<Iterator, mapnik::geometry::linear_ring(), ascii::space_type> ring_points;
qi::rule<Iterator,ascii::space_type> empty_set; qi::rule<Iterator,ascii::space_type> empty_set;
boost::phoenix::function<detail::assign> assign; boost::phoenix::function<detail::assign> assign;
boost::phoenix::function<detail::move_part> move_part; boost::phoenix::function<detail::move_part> move_part;

View file

@ -131,7 +131,7 @@ wkt_grammar<Iterator>::wkt_grammar()
// geometry collection text // geometry collection text
geometrycollection_text = (lit('(') geometrycollection_text = (lit('(')
>> ( eps[_a = construct<new_geometry::geometry>()] >> ( eps[_a = construct<geometry::geometry>()]
>> geometry_tagged_text(_a)[move_part(_val,_a)] % lit(',')) >> geometry_tagged_text(_a)[move_part(_val,_a)] % lit(','))
>> lit(')')) >> lit(')'))
| |

View file

@ -541,11 +541,11 @@ void csv_datasource::parse_csv(T & stream,
{ {
break; break;
} }
mapnik::new_geometry::geometry geom; mapnik::geometry::geometry geom;
if (mapnik::from_wkt(value, geom)) if (mapnik::from_wkt(value, geom))
{ {
// correct orientations etc // correct orientations etc
mapnik::new_geometry::correct(geom); mapnik::geometry::correct(geom);
// set geometry // set geometry
feature->set_geometry(std::move(geom)); feature->set_geometry(std::move(geom));
parsed_wkt = true; parsed_wkt = true;
@ -581,7 +581,7 @@ void csv_datasource::parse_csv(T & stream,
{ {
break; break;
} }
mapnik::new_geometry::geometry geom; mapnik::geometry::geometry geom;
if (mapnik::json::from_geojson(value, geom)) if (mapnik::json::from_geojson(value, geom))
{ {
feature->set_geometry(std::move(geom)); feature->set_geometry(std::move(geom));
@ -816,7 +816,7 @@ void csv_datasource::parse_csv(T & stream,
{ {
if (parsed_x && parsed_y) if (parsed_x && parsed_y)
{ {
mapnik::new_geometry::point pt(x,y); mapnik::geometry::point pt(x,y);
feature->set_geometry(std::move(pt)); feature->set_geometry(std::move(pt));
features_.push_back(feature); features_.push_back(feature);
null_geom = false; null_geom = false;

View file

@ -613,7 +613,7 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt)
{ {
// construct feature // construct feature
feature_ptr feature = feature_factory::create(ctx_,1); feature_ptr feature = feature_factory::create(ctx_,1);
feature->set_geometry(mapnik::new_geometry::point(pt.x,pt.y)); feature->set_geometry(mapnik::geometry::point(pt.x,pt.y));
feature->put_new("value",value); feature->put_new("value",value);
if (raster_has_nodata) if (raster_has_nodata)
{ {

View file

@ -259,7 +259,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
SDOPointType* sdopoint = geom->getSdo_point(); SDOPointType* sdopoint = geom->getSdo_point();
if (sdopoint && ! sdopoint->isNull()) if (sdopoint && ! sdopoint->isNull())
{ {
std::unique_ptr<geometry_type> point = std::make_unique<geometry_type>(mapnik::new_geometry::geometry_types::Point); std::unique_ptr<geometry_type> point = std::make_unique<geometry_type>(mapnik::geometry::geometry_types::Point);
point->move_to(sdopoint->getX(), sdopoint->getY()); point->move_to(sdopoint->getX(), sdopoint->getY());
feature->add_geometry(point.release()); feature->add_geometry(point.release());
} }
@ -272,7 +272,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_single_geom = true; const bool is_single_geom = true;
const bool is_point_type = false; const bool is_point_type = false;
convert_ordinates(feature, convert_ordinates(feature,
mapnik::new_geometry::geometry_types::LineString, mapnik::geometry::geometry_types::LineString,
elem_info, elem_info,
ordinates, ordinates,
dimensions, dimensions,
@ -288,7 +288,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_single_geom = true; const bool is_single_geom = true;
const bool is_point_type = false; const bool is_point_type = false;
convert_ordinates(feature, convert_ordinates(feature,
mapnik::new_geometry::geometry_types::Polygon, mapnik::geometry::geometry_types::Polygon,
elem_info, elem_info,
ordinates, ordinates,
dimensions, dimensions,
@ -304,7 +304,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_single_geom = false; const bool is_single_geom = false;
const bool is_point_type = true; const bool is_point_type = true;
convert_ordinates(feature, convert_ordinates(feature,
mapnik::new_geometry::geometry_types::Point, mapnik::geometry::geometry_types::Point,
elem_info, elem_info,
ordinates, ordinates,
dimensions, dimensions,
@ -321,7 +321,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_point_type = false; const bool is_point_type = false;
convert_ordinates(feature, convert_ordinates(feature,
mapnik::new_geometry::geometry_types::LineString, mapnik::geometry::geometry_types::LineString,
elem_info, elem_info,
ordinates, ordinates,
dimensions, dimensions,
@ -338,7 +338,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_point_type = false; const bool is_point_type = false;
convert_ordinates(feature, convert_ordinates(feature,
mapnik::new_geometry::geometry_types::Polygon, mapnik::geometry::geometry_types::Polygon,
elem_info, elem_info,
ordinates, ordinates,
dimensions, dimensions,
@ -356,7 +356,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_point_type = false; const bool is_point_type = false;
convert_ordinates(feature, convert_ordinates(feature,
mapnik::new_geometry::geometry_types::Polygon, mapnik::geometry::geometry_types::Polygon,
elem_info, elem_info,
ordinates, ordinates,
dimensions, dimensions,
@ -404,20 +404,20 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
int next_interp = elem_info[i + 2]; int next_interp = elem_info[i + 2];
bool is_linear_element = true; bool is_linear_element = true;
bool is_unknown_etype = false; bool is_unknown_etype = false;
mapnik::geometry_type::types gtype = mapnik::new_geometry::geometry_types::Point; mapnik::geometry_type::types gtype = mapnik::geometry::geometry_types::Point;
switch (etype) switch (etype)
{ {
case SDO_ETYPE_POINT: case SDO_ETYPE_POINT:
if (interp == SDO_INTERPRETATION_POINT) {} if (interp == SDO_INTERPRETATION_POINT) {}
if (interp > SDO_INTERPRETATION_POINT) {} if (interp > SDO_INTERPRETATION_POINT) {}
gtype = mapnik::new_geometry::geometry_types::Point; gtype = mapnik::geometry::geometry_types::Point;
break; break;
case SDO_ETYPE_LINESTRING: case SDO_ETYPE_LINESTRING:
if (interp == SDO_INTERPRETATION_STRAIGHT) {} if (interp == SDO_INTERPRETATION_STRAIGHT) {}
if (interp == SDO_INTERPRETATION_CIRCULAR) {} if (interp == SDO_INTERPRETATION_CIRCULAR) {}
gtype = mapnik::new_geometry::geometry_types::LineString; gtype = mapnik::geometry::geometry_types::LineString;
break; break;
case SDO_ETYPE_POLYGON: case SDO_ETYPE_POLYGON:
@ -426,7 +426,7 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
if (interp == SDO_INTERPRETATION_CIRCULAR) {} if (interp == SDO_INTERPRETATION_CIRCULAR) {}
if (interp == SDO_INTERPRETATION_RECTANGLE) {} if (interp == SDO_INTERPRETATION_RECTANGLE) {}
if (interp == SDO_INTERPRETATION_CIRCLE) {} if (interp == SDO_INTERPRETATION_CIRCLE) {}
gtype = mapnik::new_geometry::geometry_types::Polygon; gtype = mapnik::geometry::geometry_types::Polygon;
break; break;
case SDO_ETYPE_COMPOUND_LINESTRING: case SDO_ETYPE_COMPOUND_LINESTRING:
@ -434,7 +434,7 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
case SDO_ETYPE_COMPOUND_POLYGON_INTERIOR: case SDO_ETYPE_COMPOUND_POLYGON_INTERIOR:
// interp = next ETYPE to consider // interp = next ETYPE to consider
is_linear_element = false; is_linear_element = false;
gtype = mapnik::new_geometry::geometry_types::Polygon; gtype = mapnik::geometry::geometry_types::Polygon;
break; break;
case SDO_ETYPE_UNKNOWN: // unknown case SDO_ETYPE_UNKNOWN: // unknown

View file

@ -29,7 +29,7 @@
#include <ogr_core.h> #include <ogr_core.h>
#include <ogr_geometry.h> #include <ogr_geometry.h>
mapnik::new_geometry::geometry ogr_converter::convert_geometry(OGRGeometry* ogr_geom) mapnik::geometry::geometry ogr_converter::convert_geometry(OGRGeometry* ogr_geom)
{ {
// NOTE: wkbFlatten macro in ogr flattens 2.5d types into base 2d type // NOTE: wkbFlatten macro in ogr flattens 2.5d types into base 2d type
switch (wkbFlatten(ogr_geom->getGeometryType())) switch (wkbFlatten(ogr_geom->getGeometryType()))
@ -65,19 +65,19 @@ mapnik::new_geometry::geometry ogr_converter::convert_geometry(OGRGeometry* ogr_
MAPNIK_LOG_WARN(ogr) << "ogr_converter: unknown <ogr> geometry_type=" MAPNIK_LOG_WARN(ogr) << "ogr_converter: unknown <ogr> geometry_type="
<< wkbFlatten(ogr_geom->getGeometryType()); << wkbFlatten(ogr_geom->getGeometryType());
} }
return mapnik::new_geometry::geometry(); return mapnik::geometry::geometry();
break; break;
} }
} }
mapnik::new_geometry::point ogr_converter::convert_point(OGRPoint* ogr_geom) mapnik::geometry::point ogr_converter::convert_point(OGRPoint* ogr_geom)
{ {
return mapnik::new_geometry::point(ogr_geom->getX(), ogr_geom->getY()); return mapnik::geometry::point(ogr_geom->getX(), ogr_geom->getY());
} }
mapnik::new_geometry::multi_point ogr_converter::convert_multipoint(OGRMultiPoint* ogr_geom) mapnik::geometry::multi_point ogr_converter::convert_multipoint(OGRMultiPoint* ogr_geom)
{ {
mapnik::new_geometry::multi_point geom; mapnik::geometry::multi_point geom;
int num_geometries = ogr_geom->getNumGeometries(); int num_geometries = ogr_geom->getNumGeometries();
geom.reserve(num_geometries); geom.reserve(num_geometries);
for (int i = 0; i < num_geometries; ++i) for (int i = 0; i < num_geometries; ++i)
@ -88,9 +88,9 @@ mapnik::new_geometry::multi_point ogr_converter::convert_multipoint(OGRMultiPoin
return geom; return geom;
} }
mapnik::new_geometry::line_string ogr_converter::convert_linestring(OGRLineString* ogr_geom) mapnik::geometry::line_string ogr_converter::convert_linestring(OGRLineString* ogr_geom)
{ {
mapnik::new_geometry::line_string geom; mapnik::geometry::line_string geom;
int num_points = ogr_geom->getNumPoints(); int num_points = ogr_geom->getNumPoints();
geom.reserve(num_points); geom.reserve(num_points);
for (int i = 0; i < num_points; ++i) for (int i = 0; i < num_points; ++i)
@ -100,9 +100,9 @@ mapnik::new_geometry::line_string ogr_converter::convert_linestring(OGRLineStrin
return geom; return geom;
} }
mapnik::new_geometry::multi_line_string ogr_converter::convert_multilinestring(OGRMultiLineString* ogr_geom) mapnik::geometry::multi_line_string ogr_converter::convert_multilinestring(OGRMultiLineString* ogr_geom)
{ {
mapnik::new_geometry::multi_line_string geom; mapnik::geometry::multi_line_string geom;
int num_geometries = ogr_geom->getNumGeometries(); int num_geometries = ogr_geom->getNumGeometries();
geom.reserve(num_geometries); geom.reserve(num_geometries);
for (int i = 0; i < num_geometries; ++i) for (int i = 0; i < num_geometries; ++i)
@ -114,10 +114,10 @@ mapnik::new_geometry::multi_line_string ogr_converter::convert_multilinestring(O
} }
mapnik::new_geometry::polygon ogr_converter::convert_polygon(OGRPolygon* ogr_geom) mapnik::geometry::polygon ogr_converter::convert_polygon(OGRPolygon* ogr_geom)
{ {
mapnik::new_geometry::polygon geom; mapnik::geometry::polygon geom;
mapnik::new_geometry::linear_ring exterior; mapnik::geometry::linear_ring exterior;
OGRLinearRing* ogr_exterior = ogr_geom->getExteriorRing(); OGRLinearRing* ogr_exterior = ogr_geom->getExteriorRing();
int num_points = ogr_exterior->getNumPoints(); int num_points = ogr_exterior->getNumPoints();
exterior.reserve(num_points); exterior.reserve(num_points);
@ -131,7 +131,7 @@ mapnik::new_geometry::polygon ogr_converter::convert_polygon(OGRPolygon* ogr_geo
for (int r = 0; r < num_interior; ++r) for (int r = 0; r < num_interior; ++r)
{ {
OGRLinearRing* ogr_interior = ogr_geom->getInteriorRing(r); OGRLinearRing* ogr_interior = ogr_geom->getInteriorRing(r);
mapnik::new_geometry::linear_ring interior; mapnik::geometry::linear_ring interior;
int num_interior_points = ogr_interior->getNumPoints(); int num_interior_points = ogr_interior->getNumPoints();
interior.reserve(num_interior_points); interior.reserve(num_interior_points);
for (int i = 0; i < num_interior_points; ++i) for (int i = 0; i < num_interior_points; ++i)
@ -143,9 +143,9 @@ mapnik::new_geometry::polygon ogr_converter::convert_polygon(OGRPolygon* ogr_geo
return geom; return geom;
} }
mapnik::new_geometry::multi_polygon ogr_converter::convert_multipolygon(OGRMultiPolygon* ogr_geom) mapnik::geometry::multi_polygon ogr_converter::convert_multipolygon(OGRMultiPolygon* ogr_geom)
{ {
mapnik::new_geometry::multi_polygon geom; mapnik::geometry::multi_polygon geom;
int num_geometries = ogr_geom->getNumGeometries(); int num_geometries = ogr_geom->getNumGeometries();
geom.reserve(num_geometries); geom.reserve(num_geometries);
for (int i = 0; i < num_geometries; ++i) for (int i = 0; i < num_geometries; ++i)
@ -156,9 +156,9 @@ mapnik::new_geometry::multi_polygon ogr_converter::convert_multipolygon(OGRMulti
return geom; return geom;
} }
mapnik::new_geometry::geometry_collection ogr_converter::convert_collection(OGRGeometryCollection* ogr_geom) mapnik::geometry::geometry_collection ogr_converter::convert_collection(OGRGeometryCollection* ogr_geom)
{ {
mapnik::new_geometry::geometry_collection geom; mapnik::geometry::geometry_collection geom;
int num_geometries = ogr_geom->getNumGeometries(); int num_geometries = ogr_geom->getNumGeometries();
geom.reserve(num_geometries); geom.reserve(num_geometries);
for (int i = 0; i < num_geometries; ++i) for (int i = 0; i < num_geometries; ++i)

View file

@ -39,14 +39,14 @@ class ogr_converter
{ {
public: public:
static mapnik::new_geometry::geometry convert_geometry (OGRGeometry* ogr_geom); static mapnik::geometry::geometry convert_geometry (OGRGeometry* ogr_geom);
static mapnik::new_geometry::point convert_point (OGRPoint* ogr_geom); static mapnik::geometry::point convert_point (OGRPoint* ogr_geom);
static mapnik::new_geometry::multi_point convert_multipoint (OGRMultiPoint* ogr_geom); static mapnik::geometry::multi_point convert_multipoint (OGRMultiPoint* ogr_geom);
static mapnik::new_geometry::line_string convert_linestring (OGRLineString* ogr_geom); static mapnik::geometry::line_string convert_linestring (OGRLineString* ogr_geom);
static mapnik::new_geometry::multi_line_string convert_multilinestring (OGRMultiLineString* ogr_geom); static mapnik::geometry::multi_line_string convert_multilinestring (OGRMultiLineString* ogr_geom);
static mapnik::new_geometry::polygon convert_polygon (OGRPolygon* ogr_geom); static mapnik::geometry::polygon convert_polygon (OGRPolygon* ogr_geom);
static mapnik::new_geometry::multi_polygon convert_multipolygon (OGRMultiPolygon* ogr_geom); static mapnik::geometry::multi_polygon convert_multipolygon (OGRMultiPolygon* ogr_geom);
static mapnik::new_geometry::geometry_collection convert_collection (OGRGeometryCollection* ogr_geom); static mapnik::geometry::geometry_collection convert_collection (OGRGeometryCollection* ogr_geom);
}; };
#endif // OGR_CONVERTER_HPP #endif // OGR_CONVERTER_HPP

View file

@ -63,7 +63,7 @@ feature_ptr osm_featureset<filterT>::next()
feature = feature_factory::create(ctx_, cur_item->id); feature = feature_factory::create(ctx_, cur_item->id);
double lat = static_cast<osm_node*>(cur_item)->lat; double lat = static_cast<osm_node*>(cur_item)->lat;
double lon = static_cast<osm_node*>(cur_item)->lon; double lon = static_cast<osm_node*>(cur_item)->lon;
feature->set_geometry(mapnik::new_geometry::point(lon,lat)); feature->set_geometry(mapnik::geometry::point(lon,lat));
} }
else if (dataset_->current_item_is_way()) else if (dataset_->current_item_is_way())
{ {
@ -81,7 +81,7 @@ feature_ptr osm_featureset<filterT>::next()
feature = feature_factory::create(ctx_, cur_item->id); feature = feature_factory::create(ctx_, cur_item->id);
if (static_cast<osm_way*>(cur_item)->is_polygon()) if (static_cast<osm_way*>(cur_item)->is_polygon())
{ {
mapnik::new_geometry::linear_ring ring; mapnik::geometry::linear_ring ring;
for (unsigned int count = 0; for (unsigned int count = 0;
count < static_cast<osm_way*>(cur_item)->nodes.size(); count < static_cast<osm_way*>(cur_item)->nodes.size();
count++) count++)
@ -89,13 +89,13 @@ feature_ptr osm_featureset<filterT>::next()
ring.add_coord(static_cast<osm_way*>(cur_item)->nodes[count]->lon, ring.add_coord(static_cast<osm_way*>(cur_item)->nodes[count]->lon,
static_cast<osm_way*>(cur_item)->nodes[count]->lat); static_cast<osm_way*>(cur_item)->nodes[count]->lat);
} }
mapnik::new_geometry::polygon geom; mapnik::geometry::polygon geom;
geom.set_exterior_ring(std::move(ring)); geom.set_exterior_ring(std::move(ring));
feature->set_geometry(std::move(geom)); feature->set_geometry(std::move(geom));
} }
else else
{ {
mapnik::new_geometry::line_string geom; mapnik::geometry::line_string geom;
for (unsigned int count = 0; for (unsigned int count = 0;
count < static_cast<osm_way*>(cur_item)->nodes.size(); count < static_cast<osm_way*>(cur_item)->nodes.size();
count++) count++)

View file

@ -122,7 +122,7 @@ feature_ptr postgis_featureset::next()
int size = rs_->getFieldLength(0); int size = rs_->getFieldLength(0);
const char *data = rs_->getValue(0); const char *data = rs_->getValue(0);
mapnik::new_geometry::geometry geometry = geometry_utils::from_wkb(data, size); mapnik::geometry::geometry geometry = geometry_utils::from_wkb(data, size);
feature->set_geometry(std::move(geometry)); feature->set_geometry(std::move(geometry));
totalGeomSize_ += size; totalGeomSize_ += size;

View file

@ -87,7 +87,7 @@ feature_ptr shape_featureset<filterT>::next()
double y = record.read_double(); double y = record.read_double();
if (!filter_.pass(mapnik::box2d<double>(x,y,x,y))) if (!filter_.pass(mapnik::box2d<double>(x,y,x,y)))
continue; continue;
feature->set_geometry(mapnik::new_geometry::point(x,y)); feature->set_geometry(mapnik::geometry::point(x,y));
break; break;
} }
case shape_io::shape_multipoint: case shape_io::shape_multipoint:
@ -97,12 +97,12 @@ feature_ptr shape_featureset<filterT>::next()
shape_io::read_bbox(record, feature_bbox_); shape_io::read_bbox(record, feature_bbox_);
if (!filter_.pass(feature_bbox_)) continue; if (!filter_.pass(feature_bbox_)) continue;
int num_points = record.read_ndr_integer(); int num_points = record.read_ndr_integer();
mapnik::new_geometry::multi_point multi_point; mapnik::geometry::multi_point multi_point;
for (int i = 0; i < num_points; ++i) for (int i = 0; i < num_points; ++i)
{ {
double x = record.read_double(); double x = record.read_double();
double y = record.read_double(); double y = record.read_double();
multi_point.emplace_back(mapnik::new_geometry::point(x, y)); multi_point.emplace_back(mapnik::geometry::point(x, y));
} }
feature->set_geometry(std::move(multi_point)); feature->set_geometry(std::move(multi_point));
break; break;

View file

@ -103,7 +103,7 @@ feature_ptr shape_index_featureset<filterT>::next()
{ {
double x = record.read_double(); double x = record.read_double();
double y = record.read_double(); double y = record.read_double();
feature->set_geometry(mapnik::new_geometry::point(x,y)); feature->set_geometry(mapnik::geometry::point(x,y));
break; break;
} }
case shape_io::shape_multipoint: case shape_io::shape_multipoint:
@ -113,12 +113,12 @@ feature_ptr shape_index_featureset<filterT>::next()
shape_io::read_bbox(record, feature_bbox_); shape_io::read_bbox(record, feature_bbox_);
if (!filter_.pass(feature_bbox_)) continue; if (!filter_.pass(feature_bbox_)) continue;
int num_points = record.read_ndr_integer(); int num_points = record.read_ndr_integer();
mapnik::new_geometry::multi_point multi_point; mapnik::geometry::multi_point multi_point;
for (int i = 0; i < num_points; ++i) for (int i = 0; i < num_points; ++i)
{ {
double x = record.read_double(); double x = record.read_double();
double y = record.read_double(); double y = record.read_double();
multi_point.emplace_back(mapnik::new_geometry::point(x, y)); multi_point.emplace_back(mapnik::geometry::point(x, y));
} }
feature->set_geometry(std::move(multi_point)); feature->set_geometry(std::move(multi_point));
break; break;

View file

@ -89,7 +89,7 @@ void shape_io::read_bbox(shape_file::record_type & record, mapnik::box2d<double>
bbox.init(lox, loy, hix, hiy); bbox.init(lox, loy, hix, hiy);
} }
mapnik::new_geometry::geometry shape_io::read_polyline(shape_file::record_type & record) mapnik::geometry::geometry shape_io::read_polyline(shape_file::record_type & record)
{ {
int num_parts = record.read_ndr_integer(); int num_parts = record.read_ndr_integer();
int num_points = record.read_ndr_integer(); int num_points = record.read_ndr_integer();
@ -97,7 +97,7 @@ mapnik::new_geometry::geometry shape_io::read_polyline(shape_file::record_type &
if (num_parts == 1) if (num_parts == 1)
{ {
mapnik::new_geometry::line_string line; mapnik::geometry::line_string line;
line.reserve(num_points); line.reserve(num_points);
record.skip(4); record.skip(4);
for (int i = 0; i < num_points; ++i) for (int i = 0; i < num_points; ++i)
@ -106,7 +106,7 @@ mapnik::new_geometry::geometry shape_io::read_polyline(shape_file::record_type &
double y = record.read_double(); double y = record.read_double();
line.add_coord(x, y); line.add_coord(x, y);
} }
return std::move(mapnik::new_geometry::geometry(std::move(line))); return std::move(mapnik::geometry::geometry(std::move(line)));
} }
else else
{ {
@ -117,7 +117,7 @@ mapnik::new_geometry::geometry shape_io::read_polyline(shape_file::record_type &
} }
int start, end; int start, end;
mapnik::new_geometry::multi_line_string multi_line; mapnik::geometry::multi_line_string multi_line;
for (int k = 0; k < num_parts; ++k) for (int k = 0; k < num_parts; ++k)
{ {
start = parts[k]; start = parts[k];
@ -130,7 +130,7 @@ mapnik::new_geometry::geometry shape_io::read_polyline(shape_file::record_type &
end = parts[k + 1]; end = parts[k + 1];
} }
mapnik::new_geometry::line_string line; mapnik::geometry::line_string line;
line.reserve(end - start); line.reserve(end - start);
for (int j = start; j < end; ++j) for (int j = start; j < end; ++j)
{ {
@ -140,7 +140,7 @@ mapnik::new_geometry::geometry shape_io::read_polyline(shape_file::record_type &
} }
multi_line.push_back(std::move(line)); multi_line.push_back(std::move(line));
} }
return std::move(mapnik::new_geometry::geometry(std::move(multi_line))); return std::move(mapnik::geometry::geometry(std::move(multi_line)));
} }
} }
@ -158,7 +158,7 @@ bool is_clockwise(T const& ring)
return ( area < 0.0) ? true : false; return ( area < 0.0) ? true : false;
} }
mapnik::new_geometry::geometry shape_io::read_polygon(shape_file::record_type & record) mapnik::geometry::geometry shape_io::read_polygon(shape_file::record_type & record)
{ {
int num_parts = record.read_ndr_integer(); int num_parts = record.read_ndr_integer();
int num_points = record.read_ndr_integer(); int num_points = record.read_ndr_integer();
@ -170,15 +170,15 @@ mapnik::new_geometry::geometry shape_io::read_polygon(shape_file::record_type &
parts[i] = record.read_ndr_integer(); parts[i] = record.read_ndr_integer();
} }
mapnik::new_geometry::multi_polygon multi_poly; mapnik::geometry::multi_polygon multi_poly;
mapnik::new_geometry::polygon poly; mapnik::geometry::polygon poly;
for (int k = 0; k < num_parts; ++k) for (int k = 0; k < num_parts; ++k)
{ {
int start = parts[k]; int start = parts[k];
int end; int end;
if (k == num_parts - 1) end = num_points; if (k == num_parts - 1) end = num_points;
else end = parts[k + 1]; else end = parts[k + 1];
mapnik::new_geometry::linear_ring ring; mapnik::geometry::linear_ring ring;
ring.reserve(end - start); ring.reserve(end - start);
for (int j = start; j < end; ++j) for (int j = start; j < end; ++j)
{ {
@ -204,7 +204,7 @@ mapnik::new_geometry::geometry shape_io::read_polygon(shape_file::record_type &
if (multi_poly.size() > 0) // multi if (multi_poly.size() > 0) // multi
{ {
multi_poly.emplace_back(std::move(poly)); multi_poly.emplace_back(std::move(poly));
return std::move(mapnik::new_geometry::geometry(std::move(multi_poly))); return std::move(mapnik::geometry::geometry(std::move(multi_poly)));
} }
return std::move(mapnik::new_geometry::geometry(std::move(poly))); return std::move(mapnik::geometry::geometry(std::move(poly)));
} }

View file

@ -76,8 +76,8 @@ public:
void move_to(std::streampos pos); void move_to(std::streampos pos);
static void read_bbox(shape_file::record_type & record, mapnik::box2d<double> & bbox); static void read_bbox(shape_file::record_type & record, mapnik::box2d<double> & bbox);
static mapnik::new_geometry::geometry read_polyline(shape_file::record_type & record); static mapnik::geometry::geometry read_polyline(shape_file::record_type & record);
static mapnik::new_geometry::geometry read_polygon(shape_file::record_type & record); static mapnik::geometry::geometry read_polygon(shape_file::record_type & record);
shapeType type_; shapeType type_;
shape_file shp_; shape_file shp_;

View file

@ -448,8 +448,8 @@ boost::optional<mapnik::datasource_geometry_t> sqlite_datasource::get_geometry_t
if (data) if (data)
{ {
mapnik::new_geometry::geometry geom = mapnik::geometry_utils::from_wkb(data, size, format_); mapnik::geometry::geometry geom = mapnik::geometry_utils::from_wkb(data, size, format_);
if (mapnik::new_geometry::empty(geom)) if (mapnik::geometry::empty(geom))
{ {
continue; continue;
} }

View file

@ -81,8 +81,8 @@ feature_ptr sqlite_featureset::next()
} }
feature_ptr feature = feature_factory::create(ctx_,rs_->column_integer64(1)); feature_ptr feature = feature_factory::create(ctx_,rs_->column_integer64(1));
mapnik::new_geometry::geometry geom = geometry_utils::from_wkb(data, size, format_); mapnik::geometry::geometry geom = geometry_utils::from_wkb(data, size, format_);
if (mapnik::new_geometry::empty(geom)) if (mapnik::geometry::empty(geom))
{ {
continue; continue;
} }
@ -90,7 +90,7 @@ feature_ptr sqlite_featureset::next()
if (!spatial_index_) if (!spatial_index_)
{ {
// we are not using r-tree index, check if feature intersects bounding box // we are not using r-tree index, check if feature intersects bounding box
box2d<double> bbox = mapnik::new_geometry::envelope(geom); box2d<double> bbox = mapnik::geometry::envelope(geom);
if (!bbox_.intersects(bbox)) if (!bbox_.intersects(bbox))
continue; continue;
} }

View file

@ -196,10 +196,10 @@ public:
const char* data = static_cast<const char*>(rs->column_blob(0, size)); const char* data = static_cast<const char*>(rs->column_blob(0, size));
if (data) if (data)
{ {
mapnik::new_geometry::geometry geom = mapnik::geometry_utils::from_wkb(data, size, mapnik::wkbAuto); mapnik::geometry::geometry geom = mapnik::geometry_utils::from_wkb(data, size, mapnik::wkbAuto);
if (!mapnik::new_geometry::empty(geom)) if (!mapnik::geometry::empty(geom))
{ {
mapnik::box2d<double> bbox = mapnik::new_geometry::envelope(geom); mapnik::box2d<double> bbox = mapnik::geometry::envelope(geom);
if (bbox.valid()) if (bbox.valid())
{ {
if (first) if (first)
@ -280,10 +280,10 @@ public:
const char* data = (const char*) rs->column_blob(0, size); const char* data = (const char*) rs->column_blob(0, size);
if (data) if (data)
{ {
mapnik::new_geometry::geometry geom = mapnik::geometry_utils::from_wkb(data, size, mapnik::wkbAuto); mapnik::geometry::geometry geom = mapnik::geometry_utils::from_wkb(data, size, mapnik::wkbAuto);
if (!mapnik::new_geometry::empty(geom)) if (!mapnik::geometry::empty(geom))
{ {
mapnik::box2d<double> bbox = mapnik::new_geometry::envelope(geom); mapnik::box2d<double> bbox = mapnik::geometry::envelope(geom);
if (bbox.valid()) if (bbox.valid())
{ {
ps.bind(bbox); ps.bind(bbox);
@ -356,10 +356,10 @@ public:
const char* data = static_cast<const char*>(rs->column_blob(0, size)); const char* data = static_cast<const char*>(rs->column_blob(0, size));
if (data) if (data)
{ {
mapnik::new_geometry::geometry geom = mapnik::geometry_utils::from_wkb(data, size, mapnik::wkbAuto); mapnik::geometry::geometry geom = mapnik::geometry_utils::from_wkb(data, size, mapnik::wkbAuto);
if (!mapnik::new_geometry::empty(geom)) if (!mapnik::geometry::empty(geom))
{ {
mapnik::box2d<double> bbox = mapnik::new_geometry::envelope(geom); mapnik::box2d<double> bbox = mapnik::geometry::envelope(geom);
if (bbox.valid()) if (bbox.valid())
{ {
const int type_oid = rs->column_type(1); const int type_oid = rs->column_type(1);

View file

@ -35,7 +35,7 @@ mapnik::feature_ptr hello_featureset::next()
mapnik::coord2d center = box_.center(); mapnik::coord2d center = box_.center();
// create a new point geometry // create a new point geometry
feature->set_geometry(mapnik::new_geometry::point(center.x,center.y)); feature->set_geometry(mapnik::geometry::point(center.x,center.y));
// return the feature! // return the feature!
return feature; return feature;
@ -53,7 +53,7 @@ mapnik::feature_ptr hello_featureset::next()
// take the outer ring of the bbox that was used to query // take the outer ring of the bbox that was used to query
// to dynamically generate a fake line // to dynamically generate a fake line
mapnik::new_geometry::line_string line; mapnik::geometry::line_string line;
line.reserve(4); line.reserve(4);
line.add_coord(box_.minx(),box_.maxy()); line.add_coord(box_.minx(),box_.maxy());
line.add_coord(box_.maxx(),box_.maxy()); line.add_coord(box_.maxx(),box_.maxy());

View file

@ -96,7 +96,7 @@ struct feature_generator
x = x * (*topo_.tr).scale_x + (*topo_.tr).translate_x; x = x * (*topo_.tr).scale_x + (*topo_.tr).translate_x;
y = y * (*topo_.tr).scale_y + (*topo_.tr).translate_y; y = y * (*topo_.tr).scale_y + (*topo_.tr).translate_y;
} }
mapnik::new_geometry::point point(x, y); mapnik::geometry::point point(x, y);
feature->set_geometry(std::move(point)); feature->set_geometry(std::move(point));
assign_properties(*feature, pt, tr_); assign_properties(*feature, pt, tr_);
return feature; return feature;
@ -105,7 +105,7 @@ struct feature_generator
feature_ptr operator() (multi_point const& multi_pt) const feature_ptr operator() (multi_point const& multi_pt) const
{ {
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_)); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_));
mapnik::new_geometry::multi_point multi_point; mapnik::geometry::multi_point multi_point;
multi_point.reserve(multi_pt.points.size()); multi_point.reserve(multi_pt.points.size());
for (auto const& pt : multi_pt.points) for (auto const& pt : multi_pt.points)
{ {
@ -129,7 +129,7 @@ struct feature_generator
double px = 0, py = 0; double px = 0, py = 0;
index_type arc_index = line.ring; index_type arc_index = line.ring;
mapnik::new_geometry::line_string line_string; mapnik::geometry::line_string line_string;
line_string.reserve( topo_.arcs[arc_index].coordinates.size()); line_string.reserve( topo_.arcs[arc_index].coordinates.size());
for (auto pt : topo_.arcs[arc_index].coordinates) for (auto pt : topo_.arcs[arc_index].coordinates)
@ -152,14 +152,14 @@ struct feature_generator
{ {
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_)); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_));
mapnik::new_geometry::multi_line_string multi_line_string; mapnik::geometry::multi_line_string multi_line_string;
multi_line_string.reserve(multi_line.rings.size()); multi_line_string.reserve(multi_line.rings.size());
for (auto const& index : multi_line.rings) for (auto const& index : multi_line.rings)
{ {
double px = 0, py = 0; double px = 0, py = 0;
bool reverse = index < 0; bool reverse = index < 0;
index_type arc_index = reverse ? std::abs(index) - 1 : index; index_type arc_index = reverse ? std::abs(index) - 1 : index;
mapnik::new_geometry::line_string line_string; mapnik::geometry::line_string line_string;
line_string.reserve(topo_.arcs[arc_index].coordinates.size()); line_string.reserve(topo_.arcs[arc_index].coordinates.size());
for (auto pt : topo_.arcs[arc_index].coordinates) for (auto pt : topo_.arcs[arc_index].coordinates)
{ {
@ -183,12 +183,12 @@ struct feature_generator
{ {
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_)); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_));
std::vector<mapnik::topojson::coordinate> processed_coords; std::vector<mapnik::topojson::coordinate> processed_coords;
mapnik::new_geometry::polygon polygon; mapnik::geometry::polygon polygon;
if (poly.rings.size() > 1) polygon.interior_rings.reserve(poly.rings.size() - 1); if (poly.rings.size() > 1) polygon.interior_rings.reserve(poly.rings.size() - 1);
bool first = true; bool first = true;
for (auto const& ring : poly.rings) for (auto const& ring : poly.rings)
{ {
mapnik::new_geometry::linear_ring linear_ring; mapnik::geometry::linear_ring linear_ring;
for (auto const& index : ring) for (auto const& index : ring)
{ {
double px = 0, py = 0; double px = 0, py = 0;
@ -248,18 +248,18 @@ struct feature_generator
{ {
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_)); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_));
std::vector<mapnik::topojson::coordinate> processed_coords; std::vector<mapnik::topojson::coordinate> processed_coords;
mapnik::new_geometry::multi_polygon multi_polygon; mapnik::geometry::multi_polygon multi_polygon;
multi_polygon.reserve(multi_poly.polygons.size()); multi_polygon.reserve(multi_poly.polygons.size());
for (auto const& poly : multi_poly.polygons) for (auto const& poly : multi_poly.polygons)
{ {
bool first = true; bool first = true;
mapnik::new_geometry::polygon polygon; mapnik::geometry::polygon polygon;
if (poly.size() > 1) polygon.interior_rings.reserve(poly.size() - 1); if (poly.size() > 1) polygon.interior_rings.reserve(poly.size() - 1);
for (auto const& ring : poly) for (auto const& ring : poly)
{ {
mapnik::new_geometry::linear_ring linear_ring; mapnik::geometry::linear_ring linear_ring;
for (auto const& index : ring) for (auto const& index : ring)
{ {
double px = 0, py = 0; double px = 0, py = 0;

View file

@ -109,7 +109,7 @@ void agg_renderer<T0,T1>::process(debug_symbolizer const& sym,
{ {
using apply_vertex_mode = apply_vertex_mode<buffer_type>; using apply_vertex_mode = apply_vertex_mode<buffer_type>;
apply_vertex_mode apply(pixmap_, common_.t_, prj_trans); apply_vertex_mode apply(pixmap_, common_.t_, prj_trans);
util::apply_visitor(new_geometry::vertex_processor<apply_vertex_mode>(apply), feature.get_geometry()); util::apply_visitor(geometry::vertex_processor<apply_vertex_mode>(apply), feature.get_geometry());
} }
} }

View file

@ -124,7 +124,7 @@ void agg_renderer<T0,T1>::process(dot_symbolizer const& sym,
ren.color(agg::rgba8_pre(fill.red(), fill.green(), fill.blue(), int(fill.alpha() * opacity))); ren.color(agg::rgba8_pre(fill.red(), fill.green(), fill.blue(), int(fill.alpha() * opacity)));
using render_dot_symbolizer_type = detail::render_dot_symbolizer<rasterizer, renderer_type, renderer_common, proj_transform>; using render_dot_symbolizer_type = detail::render_dot_symbolizer<rasterizer, renderer_type, renderer_common, proj_transform>;
render_dot_symbolizer_type apply(rx, ry, *ras_ptr, ren, common_, prj_trans); render_dot_symbolizer_type apply(rx, ry, *ras_ptr, ren, common_, prj_trans);
mapnik::util::apply_visitor(new_geometry::vertex_processor<render_dot_symbolizer_type>(apply), feature.get_geometry()); mapnik::util::apply_visitor(geometry::vertex_processor<render_dot_symbolizer_type>(apply), feature.get_geometry());
} }
template void agg_renderer<image_rgba8>::process(dot_symbolizer const&, template void agg_renderer<image_rgba8>::process(dot_symbolizer const&,

View file

@ -142,7 +142,7 @@ struct agg_renderer_process_visitor_l
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
} }
@ -211,7 +211,7 @@ struct agg_renderer_process_visitor_l
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
} }

View file

@ -179,7 +179,7 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
} }
@ -203,7 +203,7 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
converter.set<stroke_tag>(); //always stroke converter.set<stroke_tag>(); //always stroke
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());

View file

@ -143,7 +143,7 @@ struct agg_renderer_process_visitor_p
double y0 = 0; double y0 = 0;
using apply_local_alignment = detail::apply_local_alignment; using apply_local_alignment = detail::apply_local_alignment;
apply_local_alignment apply(common_.t_,prj_trans_, clip_box, x0, y0); apply_local_alignment apply(common_.t_,prj_trans_, clip_box, x0, y0);
util::apply_visitor(new_geometry::vertex_processor<apply_local_alignment>(apply), feature_.get_geometry()); util::apply_visitor(geometry::vertex_processor<apply_local_alignment>(apply), feature_.get_geometry());
offset_x = unsigned(current_buffer_->width() - x0); offset_x = unsigned(current_buffer_->width() - x0);
offset_y = unsigned(current_buffer_->height() - y0); offset_y = unsigned(current_buffer_->height() - y0);
} }
@ -173,7 +173,7 @@ struct agg_renderer_process_visitor_p
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
agg::scanline_u8 sl; agg::scanline_u8 sl;
@ -243,7 +243,7 @@ struct agg_renderer_process_visitor_p
double y0 = 0; double y0 = 0;
using apply_local_alignment = detail::apply_local_alignment; using apply_local_alignment = detail::apply_local_alignment;
apply_local_alignment apply(common_.t_,prj_trans_, clip_box, x0, y0); apply_local_alignment apply(common_.t_,prj_trans_, clip_box, x0, y0);
util::apply_visitor(new_geometry::vertex_processor<apply_local_alignment>(apply), feature_.get_geometry()); util::apply_visitor(geometry::vertex_processor<apply_local_alignment>(apply), feature_.get_geometry());
offset_x = unsigned(current_buffer_->width() - x0); offset_x = unsigned(current_buffer_->width() - x0);
offset_y = unsigned(current_buffer_->height() - y0); offset_y = unsigned(current_buffer_->height() - y0);
@ -273,7 +273,7 @@ struct agg_renderer_process_visitor_p
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
agg::scanline_u8 sl; agg::scanline_u8 sl;

View file

@ -117,7 +117,7 @@ void cairo_renderer<T>::process(debug_symbolizer const& sym,
{ {
using apply_vertex_mode = apply_vertex_mode<cairo_context>; using apply_vertex_mode = apply_vertex_mode<cairo_context>;
apply_vertex_mode apply(context_, common_.t_, prj_trans); apply_vertex_mode apply(context_, common_.t_, prj_trans);
util::apply_visitor(new_geometry::vertex_processor<apply_vertex_mode>(apply), feature.get_geometry()); util::apply_visitor(geometry::vertex_processor<apply_vertex_mode>(apply), feature.get_geometry());
} }
} }

View file

@ -159,7 +159,7 @@ void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply), feature.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply), feature.get_geometry());
} }

View file

@ -99,7 +99,7 @@ void cairo_renderer<T>::process(line_symbolizer const& sym,
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
// stroke // stroke

View file

@ -114,7 +114,7 @@ void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
double y0 = 0.0; double y0 = 0.0;
using apply_local_alignment = detail::apply_local_alignment; using apply_local_alignment = detail::apply_local_alignment;
apply_local_alignment apply(common_.t_, prj_trans, clip_box, x0, y0); apply_local_alignment apply(common_.t_, prj_trans, clip_box, x0, y0);
util::apply_visitor(new_geometry::vertex_processor<apply_local_alignment>(apply), feature.get_geometry()); util::apply_visitor(geometry::vertex_processor<apply_local_alignment>(apply), feature.get_geometry());
offset_x = std::abs(clip_box.width() - x0); offset_x = std::abs(clip_box.width() - x0);
offset_y = std::abs(clip_box.height() - y0); offset_y = std::abs(clip_box.height() - y0);
} }
@ -139,7 +139,7 @@ void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
// fill polygon // fill polygon

View file

@ -128,7 +128,7 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
converter.set<stroke_tag>(); //always stroke converter.set<stroke_tag>(); //always stroke
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());

View file

@ -104,7 +104,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
converter.set<stroke_tag>(); //always stroke converter.set<stroke_tag>(); //always stroke
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());

View file

@ -86,7 +86,7 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>; using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>; using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter); apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry()); mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());

View file

@ -92,7 +92,7 @@ pixel_position_list const& group_symbolizer_helper::get()
// TODO to support clipped geometries this needs to use // TODO to support clipped geometries this needs to use
// vertex_converters // vertex_converters
apply_find_line_placements apply(t_, prj_trans_, *this); apply_find_line_placements apply(t_, prj_trans_, *this);
mapnik::util::apply_visitor(new_geometry::vertex_processor<apply_find_line_placements>(apply), *geom); mapnik::util::apply_visitor(geometry::vertex_processor<apply_find_line_placements>(apply), *geom);
} }
} }

View file

@ -32,4 +32,4 @@ using sink_type = std::back_insert_iterator<std::string>;
template struct mapnik::json::properties_generator_grammar<sink_type, mapnik::feature_impl>; template struct mapnik::json::properties_generator_grammar<sink_type, mapnik::feature_impl>;
template struct mapnik::json::feature_generator_grammar<sink_type, mapnik::feature_impl>; template struct mapnik::json::feature_generator_grammar<sink_type, mapnik::feature_impl>;
template struct mapnik::json::geometry_generator_grammar<sink_type, mapnik::new_geometry::geometry>; template struct mapnik::json::geometry_generator_grammar<sink_type, mapnik::geometry::geometry>;

View file

@ -102,10 +102,10 @@ base_symbolizer_helper::base_symbolizer_helper(
struct largest_bbox_first struct largest_bbox_first
{ {
bool operator() (new_geometry::geometry const* g0, new_geometry::geometry const* g1) const bool operator() (geometry::geometry const* g0, geometry::geometry const* g1) const
{ {
box2d<double> b0 = new_geometry::envelope(*g0); box2d<double> b0 = geometry::envelope(*g0);
box2d<double> b1 = new_geometry::envelope(*g1); box2d<double> b1 = geometry::envelope(*g1);
return b0.width() * b0.height() > b1.width() * b1.height(); return b0.width() * b0.height() > b1.width() * b1.height();
} }
}; };
@ -115,27 +115,27 @@ void base_symbolizer_helper::initialize_geometries() const
bool largest_box_only = text_props_->largest_bbox_only; bool largest_box_only = text_props_->largest_bbox_only;
double minimum_path_length = text_props_->minimum_path_length; double minimum_path_length = text_props_->minimum_path_length;
new_geometry::geometry const& geom = feature_.get_geometry(); geometry::geometry const& geom = feature_.get_geometry();
new_geometry::geometry_types type = new_geometry::geometry_type(geom); geometry::geometry_types type = geometry::geometry_type(geom);
// FIXME: how to handle MultiLinePolygon // FIXME: how to handle MultiLinePolygon
if (type == new_geometry::geometry_types::Polygon) if (type == geometry::geometry_types::Polygon)
{ {
if (minimum_path_length > 0) if (minimum_path_length > 0)
{ {
box2d<double> gbox = t_.forward(new_geometry::envelope(geom), prj_trans_); box2d<double> gbox = t_.forward(geometry::envelope(geom), prj_trans_);
if (gbox.width() >= minimum_path_length) if (gbox.width() >= minimum_path_length)
{ {
geometries_to_process_.push_back(const_cast<new_geometry::geometry*>(&geom)); geometries_to_process_.push_back(const_cast<geometry::geometry*>(&geom));
} }
} }
else else
{ {
geometries_to_process_.push_back(const_cast<new_geometry::geometry*>(&geom)); geometries_to_process_.push_back(const_cast<geometry::geometry*>(&geom));
} }
} }
else else
{ {
geometries_to_process_.push_back(const_cast<new_geometry::geometry*>(&geom)); geometries_to_process_.push_back(const_cast<geometry::geometry*>(&geom));
} }
// FIXME: return early if geometries_to_process_.empty() ? // FIXME: return early if geometries_to_process_.empty() ?
if (largest_box_only) if (largest_box_only)
@ -166,12 +166,12 @@ void base_symbolizer_helper::initialize_points() const
for (auto * geom_ptr : geometries_to_process_) for (auto * geom_ptr : geometries_to_process_)
{ {
new_geometry::geometry const& geom = *geom_ptr; geometry::geometry const& geom = *geom_ptr;
if (how_placed == VERTEX_PLACEMENT) if (how_placed == VERTEX_PLACEMENT)
{ {
using apply_vertex_placement = detail::apply_vertex_placement<std::list<pixel_position> >; using apply_vertex_placement = detail::apply_vertex_placement<std::list<pixel_position> >;
apply_vertex_placement apply(points_, t_, prj_trans_); apply_vertex_placement apply(points_, t_, prj_trans_);
util::apply_visitor(new_geometry::vertex_processor<apply_vertex_placement>(apply), geom); util::apply_visitor(geometry::vertex_processor<apply_vertex_placement>(apply), geom);
#if 0 #if 0
va.rewind(0); va.rewind(0);
for(unsigned i = 0; i < va.size(); ++i) for(unsigned i = 0; i < va.size(); ++i)
@ -188,19 +188,19 @@ void base_symbolizer_helper::initialize_points() const
// https://github.com/mapnik/mapnik/issues/1423 // https://github.com/mapnik/mapnik/issues/1423
bool success = false; bool success = false;
// https://github.com/mapnik/mapnik/issues/1350 // https://github.com/mapnik/mapnik/issues/1350
auto type = new_geometry::geometry_type(geom); auto type = geometry::geometry_type(geom);
// FIXME: how to handle MultiLineString? // FIXME: how to handle MultiLineString?
if (type == new_geometry::geometry_types::LineString) if (type == geometry::geometry_types::LineString)
{ {
auto const& line = mapnik::util::get<new_geometry::line_string>(geom); auto const& line = mapnik::util::get<geometry::line_string>(geom);
new_geometry::line_string_vertex_adapter va(line); geometry::line_string_vertex_adapter va(line);
success = label::middle_point(va, label_x,label_y); success = label::middle_point(va, label_x,label_y);
} }
else if (how_placed == POINT_PLACEMENT) else if (how_placed == POINT_PLACEMENT)
{ {
new_geometry::point pt; geometry::point pt;
new_geometry::centroid(geom, pt); geometry::centroid(geom, pt);
label_x = pt.x; label_x = pt.x;
label_y = pt.y; label_y = pt.y;
success = true; success = true;
@ -282,11 +282,11 @@ bool text_symbolizer_helper::next_line_placement() const
continue; //Reexecute size check continue; //Reexecute size check
} }
auto type = new_geometry::geometry_type(**geo_itr_); auto type = geometry::geometry_type(**geo_itr_);
if (type == new_geometry::LineString) // ?? if (type == geometry::LineString) // ??
{ {
auto const& line = util::get<new_geometry::line_string>(**geo_itr_); auto const& line = util::get<geometry::line_string>(**geo_itr_);
new_geometry::line_string_vertex_adapter va(line); geometry::line_string_vertex_adapter va(line);
converter_.apply(va); converter_.apply(va);
if (adapter_.status()) if (adapter_.status())
{ {

View file

@ -119,59 +119,59 @@ public:
needSwap_ = byteOrder_ ? wkbXDR : wkbNDR; needSwap_ = byteOrder_ ? wkbXDR : wkbNDR;
} }
mapnik::new_geometry::geometry read() mapnik::geometry::geometry read()
{ {
int type = read_integer(); int type = read_integer();
switch (type) switch (type)
{ {
case wkbPoint: case wkbPoint:
return std::move(mapnik::new_geometry::geometry(read_point())); return std::move(mapnik::geometry::geometry(read_point()));
case wkbLineString: case wkbLineString:
return std::move(mapnik::new_geometry::geometry(read_linestring())); return std::move(mapnik::geometry::geometry(read_linestring()));
case wkbPolygon: case wkbPolygon:
return std::move(mapnik::new_geometry::geometry(read_polygon())); return std::move(mapnik::geometry::geometry(read_polygon()));
case wkbMultiPoint: case wkbMultiPoint:
return std::move(mapnik::new_geometry::geometry(read_multipoint())); return std::move(mapnik::geometry::geometry(read_multipoint()));
case wkbMultiLineString: case wkbMultiLineString:
return std::move(mapnik::new_geometry::geometry(read_multilinestring())); return std::move(mapnik::geometry::geometry(read_multilinestring()));
case wkbMultiPolygon: case wkbMultiPolygon:
return std::move(mapnik::new_geometry::geometry(read_multipolygon())); return std::move(mapnik::geometry::geometry(read_multipolygon()));
case wkbGeometryCollection: case wkbGeometryCollection:
return std::move(mapnik::new_geometry::geometry(read_collection())); return std::move(mapnik::geometry::geometry(read_collection()));
case wkbPointZ: case wkbPointZ:
case wkbPointM: case wkbPointM:
return std::move(mapnik::new_geometry::geometry(read_point<true>())); return std::move(mapnik::geometry::geometry(read_point<true>()));
case wkbPointZM: case wkbPointZM:
return std::move(mapnik::new_geometry::geometry(read_point<true,true>())); return std::move(mapnik::geometry::geometry(read_point<true,true>()));
case wkbLineStringZ: case wkbLineStringZ:
case wkbLineStringM: case wkbLineStringM:
return std::move(mapnik::new_geometry::geometry(read_linestring<true>())); return std::move(mapnik::geometry::geometry(read_linestring<true>()));
case wkbLineStringZM: case wkbLineStringZM:
return std::move(mapnik::new_geometry::geometry(read_linestring<true,true>())); return std::move(mapnik::geometry::geometry(read_linestring<true,true>()));
case wkbPolygonZ: case wkbPolygonZ:
case wkbPolygonM: case wkbPolygonM:
return std::move(mapnik::new_geometry::geometry(read_polygon<true>())); return std::move(mapnik::geometry::geometry(read_polygon<true>()));
case wkbPolygonZM: case wkbPolygonZM:
return std::move(mapnik::new_geometry::geometry(read_polygon<true,true>())); return std::move(mapnik::geometry::geometry(read_polygon<true,true>()));
case wkbMultiPointZ: case wkbMultiPointZ:
case wkbMultiPointM: case wkbMultiPointM:
return std::move(mapnik::new_geometry::geometry(read_multipoint<true>())); return std::move(mapnik::geometry::geometry(read_multipoint<true>()));
case wkbMultiPointZM: case wkbMultiPointZM:
return std::move(mapnik::new_geometry::geometry(read_multipoint<true,true>())); return std::move(mapnik::geometry::geometry(read_multipoint<true,true>()));
case wkbMultiLineStringZ: case wkbMultiLineStringZ:
case wkbMultiLineStringM: case wkbMultiLineStringM:
return std::move(mapnik::new_geometry::geometry(read_multilinestring<true>())); return std::move(mapnik::geometry::geometry(read_multilinestring<true>()));
case wkbMultiLineStringZM: case wkbMultiLineStringZM:
return std::move(mapnik::new_geometry::geometry(read_multilinestring<true,true>())); return std::move(mapnik::geometry::geometry(read_multilinestring<true,true>()));
case wkbMultiPolygonZ: case wkbMultiPolygonZ:
case wkbMultiPolygonM: case wkbMultiPolygonM:
return std::move(mapnik::new_geometry::geometry(read_multipolygon<true>())); return std::move(mapnik::geometry::geometry(read_multipolygon<true>()));
case wkbMultiPolygonZM: case wkbMultiPolygonZM:
return std::move(mapnik::new_geometry::geometry(read_multipolygon<true,true>())); return std::move(mapnik::geometry::geometry(read_multipolygon<true,true>()));
case wkbGeometryCollectionZ: case wkbGeometryCollectionZ:
case wkbGeometryCollectionM: case wkbGeometryCollectionM:
case wkbGeometryCollectionZM: case wkbGeometryCollectionZM:
return std::move(mapnik::new_geometry::geometry(read_collection())); return std::move(mapnik::geometry::geometry(read_collection()));
default: default:
break; break;
} }
@ -243,19 +243,19 @@ private:
} }
template <bool Z = false, bool M = false> template <bool Z = false, bool M = false>
mapnik::new_geometry::point read_point() mapnik::geometry::point read_point()
{ {
double x = read_double(); double x = read_double();
double y = read_double(); double y = read_double();
if (Z) pos_ += 8; if (Z) pos_ += 8;
if (M) pos_ += 8; if (M) pos_ += 8;
return mapnik::new_geometry::point(x, y); return mapnik::geometry::point(x, y);
} }
template <bool Z = false, bool M = false> template <bool Z = false, bool M = false>
mapnik::new_geometry::multi_point read_multipoint() mapnik::geometry::multi_point read_multipoint()
{ {
mapnik::new_geometry::multi_point multi_point; mapnik::geometry::multi_point multi_point;
int num_points = read_integer(); int num_points = read_integer();
multi_point.reserve(num_points); multi_point.reserve(num_points);
for (int i = 0; i < num_points; ++i) for (int i = 0; i < num_points; ++i)
@ -267,23 +267,23 @@ private:
} }
template <bool M = false, bool Z = false> template <bool M = false, bool Z = false>
mapnik::new_geometry::line_string read_linestring() mapnik::geometry::line_string read_linestring()
{ {
mapnik::new_geometry::line_string line; mapnik::geometry::line_string line;
int num_points = read_integer(); int num_points = read_integer();
if (num_points > 0) if (num_points > 0)
{ {
line.reserve(num_points); line.reserve(num_points);
read_coords<mapnik::new_geometry::line_string, M, Z>(line, num_points); read_coords<mapnik::geometry::line_string, M, Z>(line, num_points);
} }
return line; return line;
} }
template <bool M = false, bool Z = false> template <bool M = false, bool Z = false>
mapnik::new_geometry::multi_line_string read_multilinestring() mapnik::geometry::multi_line_string read_multilinestring()
{ {
int num_lines = read_integer(); int num_lines = read_integer();
mapnik::new_geometry::multi_line_string multi_line; mapnik::geometry::multi_line_string multi_line;
multi_line.reserve(num_lines); multi_line.reserve(num_lines);
for (int i = 0; i < num_lines; ++i) for (int i = 0; i < num_lines; ++i)
{ {
@ -294,10 +294,10 @@ private:
} }
template <bool M = false, bool Z = false> template <bool M = false, bool Z = false>
mapnik::new_geometry::polygon read_polygon() mapnik::geometry::polygon read_polygon()
{ {
int num_rings = read_integer(); int num_rings = read_integer();
mapnik::new_geometry::polygon poly; mapnik::geometry::polygon poly;
if (num_rings > 1) if (num_rings > 1)
{ {
poly.interior_rings.reserve(num_rings - 1); poly.interior_rings.reserve(num_rings - 1);
@ -305,12 +305,12 @@ private:
for (int i = 0; i < num_rings; ++i) for (int i = 0; i < num_rings; ++i)
{ {
mapnik::new_geometry::linear_ring ring; mapnik::geometry::linear_ring ring;
int num_points = read_integer(); int num_points = read_integer();
if (num_points > 0) if (num_points > 0)
{ {
ring.reserve(num_points); ring.reserve(num_points);
read_coords<mapnik::new_geometry::linear_ring, M, Z>(ring, num_points); read_coords<mapnik::geometry::linear_ring, M, Z>(ring, num_points);
} }
if ( i == 0) poly.set_exterior_ring(std::move(ring)); if ( i == 0) poly.set_exterior_ring(std::move(ring));
else poly.add_hole(std::move(ring)); else poly.add_hole(std::move(ring));
@ -321,10 +321,10 @@ private:
} }
template <bool M = false, bool Z = false> template <bool M = false, bool Z = false>
mapnik::new_geometry::multi_polygon read_multipolygon() mapnik::geometry::multi_polygon read_multipolygon()
{ {
int num_polys = read_integer(); int num_polys = read_integer();
mapnik::new_geometry::multi_polygon multi_poly; mapnik::geometry::multi_polygon multi_poly;
for (int i = 0; i < num_polys; ++i) for (int i = 0; i < num_polys; ++i)
{ {
pos_ += 5; pos_ += 5;
@ -333,10 +333,10 @@ private:
return multi_poly; return multi_poly;
} }
mapnik::new_geometry::geometry_collection read_collection() mapnik::geometry::geometry_collection read_collection()
{ {
int num_geometries = read_integer(); int num_geometries = read_integer();
mapnik::new_geometry::geometry_collection collection; mapnik::geometry::geometry_collection collection;
for (int i = 0; i < num_geometries; ++i) for (int i = 0; i < num_geometries; ++i)
{ {
pos_ += 1; // skip byte order pos_ += 1; // skip byte order
@ -387,12 +387,12 @@ private:
}; };
mapnik::new_geometry::geometry geometry_utils::from_wkb(const char* wkb, mapnik::geometry::geometry geometry_utils::from_wkb(const char* wkb,
unsigned size, unsigned size,
wkbFormat format) wkbFormat format)
{ {
wkb_reader reader(wkb, size, format); wkb_reader reader(wkb, size, format);
return mapnik::new_geometry::geometry(reader.read()); return mapnik::geometry::geometry(reader.read());
} }
} // namespace mapnik } // namespace mapnik

View file

@ -27,6 +27,6 @@
namespace mapnik { namespace wkt { namespace mapnik { namespace wkt {
using sink_type = std::back_insert_iterator<std::string>; using sink_type = std::back_insert_iterator<std::string>;
template struct wkt_generator_grammar<sink_type, mapnik::new_geometry::geometry>; template struct wkt_generator_grammar<sink_type, mapnik::geometry::geometry>;
}} }}

View file

@ -48,9 +48,9 @@ int main(int argc, char** argv)
mapnik::transcoder tr("utf-8"); mapnik::transcoder tr("utf-8");
mapnik::value_unicode_string ustr = tr.transcode("hello world!"); mapnik::value_unicode_string ustr = tr.transcode("hello world!");
feature->put("name",ustr); feature->put("name",ustr);
//auto pt = std::make_unique<mapnik::geometry_type>(mapnik::new_geometry::geometry_types::Point); //auto pt = std::make_unique<mapnik::geometry_type>(mapnik::geometry::geometry_types::Point);
//pt->move_to(128,128); //pt->move_to(128,128);
mapnik::new_geometry::point pt(128,128); mapnik::geometry::point pt(128,128);
feature->set_geometry(std::move(pt)); feature->set_geometry(std::move(pt));
mapnik::parameters params; mapnik::parameters params;

View file

@ -55,7 +55,7 @@ boost::optional<std::string> linestring_bbox_clipping(mapnik::box2d<double> bbox
line_symbolizer sym; line_symbolizer sym;
view_transform t(bbox.width(),bbox.height(), bbox); view_transform t(bbox.width(),bbox.height(), bbox);
mapnik::geometry_container output_paths; mapnik::geometry_container output_paths;
output_geometry_backend backend(output_paths, mapnik::new_geometry::geometry_types::LineString); output_geometry_backend backend(output_paths, mapnik::geometry::geometry_types::LineString);
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>(); mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
mapnik::feature_impl f(ctx,0); mapnik::feature_impl f(ctx,0);
@ -98,7 +98,7 @@ boost::optional<std::string> polygon_bbox_clipping(mapnik::box2d<double> bbox,
polygon_symbolizer sym; polygon_symbolizer sym;
view_transform t(bbox.width(),bbox.height(), bbox); view_transform t(bbox.width(),bbox.height(), bbox);
mapnik::geometry_container output_paths; mapnik::geometry_container output_paths;
output_geometry_backend backend(output_paths, mapnik::new_geometry::geometry_types::Polygon); output_geometry_backend backend(output_paths, mapnik::geometry::geometry_types::Polygon);
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>(); mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
mapnik::feature_impl f(ctx,0); mapnik::feature_impl f(ctx,0);

View file

@ -18,22 +18,22 @@ int main(int argc, char** argv)
try try
{ {
// reused these for simplicity // reused these for simplicity
mapnik::new_geometry::point centroid; mapnik::geometry::point centroid;
{ {
// single point // single point
mapnik::new_geometry::point pt(10,10); mapnik::geometry::point pt(10,10);
BOOST_TEST( mapnik::new_geometry::centroid(pt, centroid)); BOOST_TEST( mapnik::geometry::centroid(pt, centroid));
BOOST_TEST( pt.x == centroid.x); BOOST_TEST( pt.x == centroid.x);
BOOST_TEST( pt.y == centroid.y); BOOST_TEST( pt.y == centroid.y);
} }
// linestring with three consecutive verticies // linestring with three consecutive verticies
{ {
mapnik::new_geometry::line_string line; mapnik::geometry::line_string line;
line.add_coord(0, 0); line.add_coord(0, 0);
line.add_coord(25, 25); line.add_coord(25, 25);
line.add_coord(50, 50); line.add_coord(50, 50);
BOOST_TEST(mapnik::new_geometry::centroid(line, centroid)); BOOST_TEST(mapnik::geometry::centroid(line, centroid));
BOOST_TEST( centroid.x == 25 ); BOOST_TEST( centroid.x == 25 );
BOOST_TEST( centroid.y == 25 ); BOOST_TEST( centroid.y == 25 );
} }
@ -42,7 +42,7 @@ int main(int argc, char** argv)
#if 0 #if 0
// hit tests // hit tests
{ {
mapnik::geometry_type pt_hit(mapnik::new_geometry::geometry_types::Point); mapnik::geometry_type pt_hit(mapnik::geometry::geometry_types::Point);
pt_hit.move_to(10,10); pt_hit.move_to(10,10);
mapnik::vertex_adapter va(pt_hit); mapnik::vertex_adapter va(pt_hit);
BOOST_TEST( mapnik::label::hit_test(va, 10, 10, 0.1) ); BOOST_TEST( mapnik::label::hit_test(va, 10, 10, 0.1) );
@ -50,7 +50,7 @@ int main(int argc, char** argv)
BOOST_TEST( mapnik::label::hit_test(va, 9, 9, 1.5) ); BOOST_TEST( mapnik::label::hit_test(va, 9, 9, 1.5) );
} }
{ {
mapnik::geometry_type line_hit(mapnik::new_geometry::geometry_types::LineString); mapnik::geometry_type line_hit(mapnik::geometry::geometry_types::LineString);
line_hit.move_to(0,0); line_hit.move_to(0,0);
line_hit.line_to(50,50); line_hit.line_to(50,50);
mapnik::vertex_adapter va(line_hit); mapnik::vertex_adapter va(line_hit);

View file

@ -68,15 +68,15 @@ int main(int argc, char** argv)
try { try {
// spatialite blob // spatialite blob
mapnik::new_geometry::geometry geom = mapnik::geometry_utils::from_wkb((const char*)sp_valid_blob, mapnik::geometry::geometry geom = mapnik::geometry_utils::from_wkb((const char*)sp_valid_blob,
sizeof(sp_valid_blob) / sizeof(sp_valid_blob[0]), sizeof(sp_valid_blob) / sizeof(sp_valid_blob[0]),
mapnik::wkbSpatiaLite); mapnik::wkbSpatiaLite);
BOOST_TEST(mapnik::new_geometry::is_valid(geom) && mapnik::new_geometry::is_simple(geom)); BOOST_TEST(mapnik::geometry::is_valid(geom) && mapnik::geometry::is_simple(geom));
geom = mapnik::geometry_utils::from_wkb((const char*)sp_valid_blob, geom = mapnik::geometry_utils::from_wkb((const char*)sp_valid_blob,
sizeof(sp_valid_blob) / sizeof(sp_valid_blob[0]), sizeof(sp_valid_blob) / sizeof(sp_valid_blob[0]),
mapnik::wkbAuto); mapnik::wkbAuto);
BOOST_TEST(mapnik::new_geometry::is_valid(geom) && mapnik::new_geometry::is_simple(geom)); BOOST_TEST(mapnik::geometry::is_valid(geom) && mapnik::geometry::is_simple(geom));
@ -88,13 +88,13 @@ int main(int argc, char** argv)
geom = mapnik::geometry_utils::from_wkb((const char*)sq_valid_blob, geom = mapnik::geometry_utils::from_wkb((const char*)sq_valid_blob,
sizeof(sq_valid_blob) / sizeof(sq_valid_blob[0]), sizeof(sq_valid_blob) / sizeof(sq_valid_blob[0]),
mapnik::wkbGeneric); mapnik::wkbGeneric);
BOOST_TEST(mapnik::new_geometry::is_valid(geom) && mapnik::new_geometry::is_simple(geom)); BOOST_TEST(mapnik::geometry::is_valid(geom) && mapnik::geometry::is_simple(geom));
geom = mapnik::geometry_utils::from_wkb( (const char*)sq_valid_blob, geom = mapnik::geometry_utils::from_wkb( (const char*)sq_valid_blob,
sizeof(sq_valid_blob) / sizeof(sq_valid_blob[0]), sizeof(sq_valid_blob) / sizeof(sq_valid_blob[0]),
mapnik::wkbAuto); mapnik::wkbAuto);
BOOST_TEST(mapnik::new_geometry::is_valid(geom) && mapnik::new_geometry::is_simple(geom)); BOOST_TEST(mapnik::geometry::is_valid(geom) && mapnik::geometry::is_simple(geom));
BOOST_TEST_THROWS(mapnik::geometry_utils::from_wkb((const char*)sq_invalid_blob, BOOST_TEST_THROWS(mapnik::geometry_utils::from_wkb((const char*)sq_invalid_blob,
sizeof(sq_invalid_blob) / sizeof(sq_invalid_blob[0]), sizeof(sq_invalid_blob) / sizeof(sq_invalid_blob[0]),

View file

@ -1,4 +1,3 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/datasource_cache.hpp> #include <mapnik/datasource_cache.hpp>
@ -30,13 +29,13 @@ SECTION("hello world") {
REQUIRE( feat1->id() == static_cast<mapnik::value_integer>(1) ); REQUIRE( feat1->id() == static_cast<mapnik::value_integer>(1) );
REQUIRE( feat2->id() == static_cast<mapnik::value_integer>(2) ); REQUIRE( feat2->id() == static_cast<mapnik::value_integer>(2) );
auto const& geom1 = feat1->get_geometry(); auto const& geom1 = feat1->get_geometry();
REQUIRE( geom1.is<mapnik::new_geometry::point>() ); REQUIRE( geom1.is<mapnik::geometry::point>() );
auto const& point = mapnik::util::get<mapnik::new_geometry::point>(geom1); auto const& point = mapnik::util::get<mapnik::geometry::point>(geom1);
REQUIRE( point.x == bbox.center().x ); REQUIRE( point.x == bbox.center().x );
REQUIRE( point.y == bbox.center().y ); REQUIRE( point.y == bbox.center().y );
auto const& geom2 = feat2->get_geometry(); auto const& geom2 = feat2->get_geometry();
REQUIRE( geom2.is<mapnik::new_geometry::line_string>() ); REQUIRE( geom2.is<mapnik::geometry::line_string>() );
auto const& line = mapnik::util::get<mapnik::new_geometry::line_string>(geom2); auto const& line = mapnik::util::get<mapnik::geometry::line_string>(geom2);
REQUIRE( line.size() == 4 ); REQUIRE( line.size() == 4 );
REQUIRE( line[0].x == bbox.minx() ); REQUIRE( line[0].x == bbox.minx() );
REQUIRE( line[0].y == bbox.maxy() ); REQUIRE( line[0].y == bbox.maxy() );

View file

@ -11,11 +11,11 @@ TEST_CASE("geometry") {
SECTION("json point") { SECTION("json point") {
mapnik::util::file input("./tests/data/json/fixtures/point1.json"); mapnik::util::file input("./tests/data/json/fixtures/point1.json");
auto json = input.data(); auto json = input.data();
mapnik::new_geometry::geometry geom; mapnik::geometry::geometry geom;
std::string json_string(json.get()); std::string json_string(json.get());
REQUIRE( mapnik::json::from_geojson(json_string, geom) ); REQUIRE( mapnik::json::from_geojson(json_string, geom) );
REQUIRE( geom.is<mapnik::new_geometry::point>() ); REQUIRE( geom.is<mapnik::geometry::point>() );
auto const& point = mapnik::util::get<mapnik::new_geometry::point>(geom); auto const& point = mapnik::util::get<mapnik::geometry::point>(geom);
REQUIRE( point.x == 30 ); REQUIRE( point.x == 30 );
REQUIRE( point.y == 10 ); REQUIRE( point.y == 10 );
std::string new_json; std::string new_json;
@ -25,11 +25,11 @@ SECTION("json point") {
SECTION("json point reversed") { SECTION("json point reversed") {
mapnik::util::file input("./tests/data/json/fixtures/point2.json"); mapnik::util::file input("./tests/data/json/fixtures/point2.json");
auto json = input.data(); auto json = input.data();
mapnik::new_geometry::geometry geom; mapnik::geometry::geometry geom;
std::string json_string(json.get()); std::string json_string(json.get());
REQUIRE( mapnik::json::from_geojson(json_string,geom) ); REQUIRE( mapnik::json::from_geojson(json_string,geom) );
REQUIRE( geom.is<mapnik::new_geometry::point>() ); REQUIRE( geom.is<mapnik::geometry::point>() );
auto const& point = mapnik::util::get<mapnik::new_geometry::point>(geom); auto const& point = mapnik::util::get<mapnik::geometry::point>(geom);
REQUIRE( point.x == 30 ); REQUIRE( point.x == 30 );
REQUIRE( point.y == 10 ); REQUIRE( point.y == 10 );
} }

View file

@ -7,7 +7,7 @@
TEST_CASE("geometry ops") { TEST_CASE("geometry ops") {
SECTION("hit_test_filter") { SECTION("hit_test_filter") {
using namespace mapnik::new_geometry; using namespace mapnik::geometry;
{ {
geometry geom(point(0,0)); geometry geom(point(0,0));
REQUIRE( mapnik::hit_test(geom,0,0,0) ); REQUIRE( mapnik::hit_test(geom,0,0,0) );

View file

@ -81,7 +81,7 @@ int main (int argc, char ** argv )
while(f) while(f)
{ {
std::cerr << *f << std::endl; std::cerr << *f << std::endl;
mapnik::new_geometry::geometry const& geom = f->get_geometry(); mapnik::geometry::geometry const& geom = f->get_geometry();
// NDR // NDR
{ {
mapnik::util::wkb_buffer_ptr wkb = mapnik::util::to_wkb(geom,mapnik::wkbNDR); mapnik::util::wkb_buffer_ptr wkb = mapnik::util::to_wkb(geom,mapnik::wkbNDR);

View file

@ -389,10 +389,10 @@ void pgsql2sqlite(Connection conn,
if (oid == geometry_oid) if (oid == geometry_oid)
{ {
mapnik::Feature feat(ctx,pkid); mapnik::Feature feat(ctx,pkid);
mapnik::new_geometry::geometry geom = geometry_utils::from_wkb(buf, size, wkbGeneric); mapnik::geometry::geometry geom = geometry_utils::from_wkb(buf, size, wkbGeneric);
if (!mapnik::new_geometry::empty(geom)) if (!mapnik::geometry::empty(geom))
{ {
box2d<double> bbox = mapnik::new_geometry::envelope(geom); box2d<double> bbox = mapnik::geometry::envelope(geom);
if (bbox.valid()) if (bbox.valid())
{ {
sqlite::record_type rec; sqlite::record_type rec;