geometry container typedef fixing

This commit is contained in:
Dane Springmeyer 2014-09-29 18:40:57 -07:00
parent c654994dbc
commit dc57849b7d
17 changed files with 77 additions and 39 deletions

View file

@ -30,11 +30,9 @@
#include <boost/python/call_method.hpp> #include <boost/python/call_method.hpp>
#include <boost/python/tuple.hpp> #include <boost/python/tuple.hpp>
#include <boost/python/to_python_converter.hpp> #include <boost/python/to_python_converter.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
// mapnik // mapnik
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp> #include <mapnik/feature_factory.hpp>
@ -56,7 +54,7 @@ using mapnik::context_ptr;
using mapnik::feature_kv_iterator; using mapnik::feature_kv_iterator;
mapnik::geometry_type const& (mapnik::feature_impl::*get_geometry_by_const_ref)(std::size_t) const = &mapnik::feature_impl::get_geometry; mapnik::geometry_type const& (mapnik::feature_impl::*get_geometry_by_const_ref)(std::size_t) const = &mapnik::feature_impl::get_geometry;
boost::ptr_vector<mapnik::geometry_type> const& (mapnik::feature_impl::*get_paths_by_const_ref)() const = &mapnik::feature_impl::paths; mapnik::geometry_container const& (mapnik::feature_impl::*get_paths_by_const_ref)() const = &mapnik::feature_impl::paths;
void feature_add_geometries_from_wkb(mapnik::feature_impl & feature, std::string wkb) void feature_add_geometries_from_wkb(mapnik::feature_impl & feature, std::string wkb)
{ {

View file

@ -28,12 +28,12 @@
#include <boost/python/exception_translator.hpp> #include <boost/python/exception_translator.hpp>
#include <boost/python/manage_new_object.hpp> #include <boost/python/manage_new_object.hpp>
#include <boost/python/iterator.hpp> #include <boost/python/iterator.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>
// mapnik // mapnik
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/wkt/wkt_factory.hpp> // from_wkt #include <mapnik/wkt/wkt_factory.hpp> // from_wkt
#include <mapnik/util/geometry_to_wkt.hpp> #include <mapnik/util/geometry_to_wkt.hpp>
#include <mapnik/json/geometry_parser.hpp> // from_geojson #include <mapnik/json/geometry_parser.hpp> // from_geojson

View file

@ -29,6 +29,7 @@
#include <mapnik/value.hpp> #include <mapnik/value.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/feature_kv_iterator.hpp> #include <mapnik/feature_kv_iterator.hpp>
#include <mapnik/noncopyable.hpp> #include <mapnik/noncopyable.hpp>

View file

@ -28,10 +28,6 @@
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/noncopyable.hpp> #include <mapnik/noncopyable.hpp>
// boost
#include <memory>
#include <boost/ptr_container/ptr_vector.hpp>
namespace mapnik { namespace mapnik {
template <typename T, template <typename> class Container=vertex_vector> template <typename T, template <typename> class Container=vertex_vector>
@ -154,8 +150,6 @@ public:
}; };
using geometry_type = geometry<double,vertex_vector>; using geometry_type = geometry<double,vertex_vector>;
using geometry_ptr = std::shared_ptr<geometry_type>;
using geometry_container = boost::ptr_vector<geometry_type>;
} }

View file

@ -0,0 +1,35 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef MAPNIK_GEOMETRY_CONTAINER_HPP
#define MAPNIK_GEOMETRY_CONTAINER_HPP
// boost
#include <boost/ptr_container/ptr_vector.hpp>
namespace mapnik {
using geometry_container = boost::ptr_vector<geometry_type>;
}
#endif // MAPNIK_GEOMETRY_CONTAINER_HPP

View file

@ -27,6 +27,7 @@
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>
#include <mapnik/value.hpp> #include <mapnik/value.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/json/geometry_generator_grammar.hpp> #include <mapnik/json/geometry_generator_grammar.hpp>
#include <mapnik/feature_kv_iterator.hpp> #include <mapnik/feature_kv_iterator.hpp>

View file

@ -27,6 +27,7 @@
#include <mapnik/json/geometry_grammar.hpp> #include <mapnik/json/geometry_grammar.hpp>
#include <mapnik/value.hpp> #include <mapnik/value.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/unicode.hpp> #include <mapnik/unicode.hpp>
#include <mapnik/value.hpp> #include <mapnik/value.hpp>
#include <mapnik/json/generic_json.hpp> #include <mapnik/json/generic_json.hpp>

View file

@ -25,6 +25,7 @@
// mapnik // mapnik
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/json/geometry_grammar.hpp> #include <mapnik/json/geometry_grammar.hpp>
// boost // boost
@ -33,7 +34,7 @@
namespace mapnik { namespace json { namespace mapnik { namespace json {
inline bool from_geojson(std::string const& json, boost::ptr_vector<geometry_type> & paths) inline bool from_geojson(std::string const& json, geometry_container & paths)
{ {
using namespace boost::spirit; using namespace boost::spirit;
static const geometry_grammar<std::string::const_iterator> g; static const geometry_grammar<std::string::const_iterator> g;

View file

@ -25,11 +25,11 @@
// mapnik // mapnik
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/util/path_iterator.hpp> #include <mapnik/util/path_iterator.hpp>
// boost // boost
#include <boost/spirit/include/support_container.hpp> #include <boost/spirit/include/support_container.hpp>
#include <boost/concept_check.hpp>
namespace boost { namespace spirit { namespace traits { namespace boost { namespace spirit { namespace traits {
@ -60,9 +60,8 @@ template <>
struct end_container<mapnik::geometry_type const> struct end_container<mapnik::geometry_type const>
{ {
static mapnik::util::path_iterator<mapnik::geometry_type> static mapnik::util::path_iterator<mapnik::geometry_type>
call (mapnik::geometry_type const& g) call (mapnik::geometry_type const&)
{ {
boost::ignore_unused_variable_warning(g);
return mapnik::util::path_iterator<mapnik::geometry_type>(); return mapnik::util::path_iterator<mapnik::geometry_type>();
} }
}; };

View file

@ -26,6 +26,7 @@
// mapnik // mapnik
#include <mapnik/global.hpp> #include <mapnik/global.hpp>
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/svg/geometry_svg_generator.hpp> #include <mapnik/svg/geometry_svg_generator.hpp>
// boost // boost

View file

@ -27,6 +27,7 @@
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
#include <mapnik/make_unique.hpp> #include <mapnik/make_unique.hpp>
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/vertex.hpp> #include <mapnik/vertex.hpp>
// stl // stl
@ -187,7 +188,7 @@ wkb_buffer_ptr to_polygon_wkb( GeometryType const& g, wkbByteOrder byte_order)
using point_type = std::pair<double,double>; using point_type = std::pair<double,double>;
using linear_ring = std::vector<point_type>; using linear_ring = std::vector<point_type>;
boost::ptr_vector<linear_ring> rings; std::vector<linear_ring> rings;
double x = 0; double x = 0;
double y = 0; double y = 0;
@ -197,8 +198,10 @@ wkb_buffer_ptr to_polygon_wkb( GeometryType const& g, wkbByteOrder byte_order)
unsigned command = g.vertex(i,&x,&y); unsigned command = g.vertex(i,&x,&y);
if (command == SEG_MOVETO) if (command == SEG_MOVETO)
{ {
rings.push_back(new linear_ring); // start new loop linear_ring ring;
rings.back().emplace_back(x,y); ring.reserve(1);
ring.emplace_back(x,y);
rings.push_back(std::move(ring)); // start new loop
size += 4; // num_points size += 4; // num_points
size += 2 * 8; // point size += 2 * 8; // point
} }

View file

@ -25,6 +25,7 @@
// mapnik // mapnik
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/wkt/wkt_generator_grammar.hpp> #include <mapnik/wkt/wkt_generator_grammar.hpp>
namespace mapnik { namespace util { namespace mapnik { namespace util {

View file

@ -25,6 +25,7 @@
// mapnik // mapnik
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/noncopyable.hpp> #include <mapnik/noncopyable.hpp>
namespace mapnik namespace mapnik

View file

@ -25,6 +25,7 @@
// mapnik // mapnik
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/wkt/wkt_grammar.hpp> #include <mapnik/wkt/wkt_grammar.hpp>
// stl // stl

View file

@ -29,6 +29,7 @@
// mapnik // mapnik
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/geometry_container.hpp>
#include <mapnik/vertex.hpp> #include <mapnik/vertex.hpp>
namespace mapnik { namespace wkt { namespace mapnik { namespace wkt {

View file

@ -128,7 +128,7 @@ public:
needSwap_ = byteOrder_ ? wkbXDR : wkbNDR; needSwap_ = byteOrder_ ? wkbXDR : wkbNDR;
} }
void read(boost::ptr_vector<geometry_type> & paths) void read(geometry_container & paths)
{ {
int type = read_integer(); int type = read_integer();
@ -307,7 +307,7 @@ private:
} }
} }
void read_point(boost::ptr_vector<geometry_type> & paths) void read_point(geometry_container & paths)
{ {
double x = read_double(); double x = read_double();
double y = read_double(); double y = read_double();
@ -316,7 +316,7 @@ private:
paths.push_back(pt.release()); paths.push_back(pt.release());
} }
void read_multipoint(boost::ptr_vector<geometry_type> & paths) void read_multipoint(geometry_container & paths)
{ {
int num_points = read_integer(); int num_points = read_integer();
for (int i = 0; i < num_points; ++i) for (int i = 0; i < num_points; ++i)
@ -326,7 +326,7 @@ private:
} }
} }
void read_point_xyz(boost::ptr_vector<geometry_type> & paths) void read_point_xyz(geometry_container & paths)
{ {
double x = read_double(); double x = read_double();
double y = read_double(); double y = read_double();
@ -336,7 +336,7 @@ private:
paths.push_back(pt.release()); paths.push_back(pt.release());
} }
void read_point_xyzm(boost::ptr_vector<geometry_type> & paths) void read_point_xyzm(geometry_container & paths)
{ {
double x = read_double(); double x = read_double();
double y = read_double(); double y = read_double();
@ -346,7 +346,7 @@ private:
paths.push_back(pt.release()); paths.push_back(pt.release());
} }
void read_multipoint_xyz(boost::ptr_vector<geometry_type> & paths) void read_multipoint_xyz(geometry_container & paths)
{ {
int num_points = read_integer(); int num_points = read_integer();
for (int i = 0; i < num_points; ++i) for (int i = 0; i < num_points; ++i)
@ -356,7 +356,7 @@ private:
} }
} }
void read_multipoint_xyzm(boost::ptr_vector<geometry_type> & paths) void read_multipoint_xyzm(geometry_container & paths)
{ {
int num_points = read_integer(); int num_points = read_integer();
for (int i = 0; i < num_points; ++i) for (int i = 0; i < num_points; ++i)
@ -366,7 +366,7 @@ private:
} }
} }
void read_linestring(boost::ptr_vector<geometry_type> & paths) void read_linestring(geometry_container & paths)
{ {
int num_points = read_integer(); int num_points = read_integer();
if (num_points > 0) if (num_points > 0)
@ -383,7 +383,7 @@ private:
} }
} }
void read_multilinestring(boost::ptr_vector<geometry_type> & paths) void read_multilinestring(geometry_container & paths)
{ {
int num_lines = read_integer(); int num_lines = read_integer();
for (int i = 0; i < num_lines; ++i) for (int i = 0; i < num_lines; ++i)
@ -393,7 +393,7 @@ private:
} }
} }
void read_linestring_xyz(boost::ptr_vector<geometry_type> & paths) void read_linestring_xyz(geometry_container & paths)
{ {
int num_points = read_integer(); int num_points = read_integer();
if (num_points > 0) if (num_points > 0)
@ -410,7 +410,7 @@ private:
} }
} }
void read_linestring_xyzm(boost::ptr_vector<geometry_type> & paths) void read_linestring_xyzm(geometry_container & paths)
{ {
int num_points = read_integer(); int num_points = read_integer();
if (num_points > 0) if (num_points > 0)
@ -427,7 +427,7 @@ private:
} }
} }
void read_multilinestring_xyz(boost::ptr_vector<geometry_type> & paths) void read_multilinestring_xyz(geometry_container & paths)
{ {
int num_lines = read_integer(); int num_lines = read_integer();
for (int i = 0; i < num_lines; ++i) for (int i = 0; i < num_lines; ++i)
@ -437,7 +437,7 @@ private:
} }
} }
void read_multilinestring_xyzm(boost::ptr_vector<geometry_type> & paths) void read_multilinestring_xyzm(geometry_container & paths)
{ {
int num_lines = read_integer(); int num_lines = read_integer();
for (int i = 0; i < num_lines; ++i) for (int i = 0; i < num_lines; ++i)
@ -447,7 +447,7 @@ private:
} }
} }
void read_polygon(boost::ptr_vector<geometry_type> & paths) void read_polygon(geometry_container & paths)
{ {
int num_rings = read_integer(); int num_rings = read_integer();
if (num_rings > 0) if (num_rings > 0)
@ -473,7 +473,7 @@ private:
} }
} }
void read_multipolygon(boost::ptr_vector<geometry_type> & paths) void read_multipolygon(geometry_container & paths)
{ {
int num_polys = read_integer(); int num_polys = read_integer();
for (int i = 0; i < num_polys; ++i) for (int i = 0; i < num_polys; ++i)
@ -483,7 +483,7 @@ private:
} }
} }
void read_polygon_xyz(boost::ptr_vector<geometry_type> & paths) void read_polygon_xyz(geometry_container & paths)
{ {
int num_rings = read_integer(); int num_rings = read_integer();
if (num_rings > 0) if (num_rings > 0)
@ -509,7 +509,7 @@ private:
} }
} }
void read_polygon_xyzm(boost::ptr_vector<geometry_type> & paths) void read_polygon_xyzm(geometry_container & paths)
{ {
int num_rings = read_integer(); int num_rings = read_integer();
if (num_rings > 0) if (num_rings > 0)
@ -535,7 +535,7 @@ private:
} }
} }
void read_multipolygon_xyz(boost::ptr_vector<geometry_type> & paths) void read_multipolygon_xyz(geometry_container & paths)
{ {
int num_polys = read_integer(); int num_polys = read_integer();
for (int i = 0; i < num_polys; ++i) for (int i = 0; i < num_polys; ++i)
@ -545,7 +545,7 @@ private:
} }
} }
void read_multipolygon_xyzm(boost::ptr_vector<geometry_type> & paths) void read_multipolygon_xyzm(geometry_container & paths)
{ {
int num_polys = read_integer(); int num_polys = read_integer();
for (int i = 0; i < num_polys; ++i) for (int i = 0; i < num_polys; ++i)
@ -555,7 +555,7 @@ private:
} }
} }
void read_collection(boost::ptr_vector<geometry_type> & paths) void read_collection(geometry_container & paths)
{ {
int num_geometries = read_integer(); int num_geometries = read_integer();
for (int i = 0; i < num_geometries; ++i) for (int i = 0; i < num_geometries; ++i)
@ -607,7 +607,7 @@ private:
}; };
bool geometry_utils::from_wkb(boost::ptr_vector<geometry_type>& paths, bool geometry_utils::from_wkb(geometry_container& paths,
const char* wkb, const char* wkb,
unsigned size, unsigned size,
wkbFormat format) wkbFormat format)

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;
boost::ptr_vector<mapnik::geometry_type> & paths = f->paths(); mapnik::geometry_container const& paths = f->paths();
for (mapnik::geometry_type const& geom : paths) for (mapnik::geometry_type const& geom : paths)
{ {
// NDR // NDR