Merge pull request #2013 from mapnik/c++11-revised

C++11
This commit is contained in:
Dane Springmeyer 2013-09-24 23:30:22 -07:00
commit 8678410f9d
211 changed files with 923 additions and 965 deletions

View file

@ -38,9 +38,13 @@ severities = ['debug', 'warn', 'error', 'none']
DEFAULT_CC = "gcc"
DEFAULT_CXX = "g++"
DEFAULT_CXX11_CXXFLAGS = " -std=c++11"
DEFAULT_CXX11_LINKFLAGS = ""
if sys.platform == 'darwin':
DEFAULT_CC = "clang"
DEFAULT_CXX = "clang++"
DEFAULT_CXX11_CXXFLAGS += ' -stdlib=libc++'
DEFAULT_CXX11_LINKFLAGS = ' -stdlib=libc++'
py3 = None
@ -1126,8 +1130,10 @@ if not preconfigured:
# set any custom cxxflags and ldflags to come first
env.Append(CPPDEFINES = env['CUSTOM_DEFINES'])
env.Append(CUSTOM_CXXFLAGS = DEFAULT_CXX11_CXXFLAGS)
env.Append(CXXFLAGS = env['CUSTOM_CXXFLAGS'])
env.Append(CFLAGS = env['CUSTOM_CFLAGS'])
env.Append(CUSTOM_LDFLAGS = DEFAULT_CXX11_LINKFLAGS)
env.Append(LINKFLAGS = env['CUSTOM_LDFLAGS'])
### platform specific bits
@ -1680,7 +1686,6 @@ if not preconfigured:
# c++11 support / https://github.com/mapnik/mapnik/issues/1683
# - upgrade to PHOENIX_V3 since that is needed for c++11 compile
if 'c++11' in env['CUSTOM_CXXFLAGS']:
env.Append(CPPDEFINES = '-DBOOST_SPIRIT_USE_PHOENIX_V3=1')
# - workaround boost gil channel_algorithm.hpp narrowing error
# TODO - remove when building against >= 1.55

View file

@ -16,7 +16,7 @@
// boost
#include <boost/version.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/make_shared.hpp>
#include <boost/bind.hpp>
@ -93,20 +93,20 @@ void benchmark(T & test_runner, std::string const& name)
bool compare_images(std::string const& src_fn,std::string const& dest_fn)
{
std::auto_ptr<mapnik::image_reader> reader1(mapnik::get_image_reader(dest_fn,"png"));
std::unique_ptr<mapnik::image_reader> reader1(mapnik::get_image_reader(dest_fn,"png"));
if (!reader1.get())
{
throw mapnik::image_reader_exception("Failed to load: " + dest_fn);
}
boost::shared_ptr<image_32> image_ptr1 = boost::make_shared<image_32>(reader1->width(),reader1->height());
std::shared_ptr<image_32> image_ptr1 = std::make_shared<image_32>(reader1->width(),reader1->height());
reader1->read(0,0,image_ptr1->data());
std::auto_ptr<mapnik::image_reader> reader2(mapnik::get_image_reader(src_fn,"png"));
std::unique_ptr<mapnik::image_reader> reader2(mapnik::get_image_reader(src_fn,"png"));
if (!reader2.get())
{
throw mapnik::image_reader_exception("Failed to load: " + src_fn);
}
boost::shared_ptr<image_32> image_ptr2 = boost::make_shared<image_32>(reader2->width(),reader2->height());
std::shared_ptr<image_32> image_ptr2 = std::make_shared<image_32>(reader2->width(),reader2->height());
reader2->read(0,0,image_ptr2->data());
image_data_32 const& dest = image_ptr1->data();
@ -156,19 +156,19 @@ struct test2
{
unsigned iter_;
unsigned threads_;
boost::shared_ptr<image_32> im_;
std::shared_ptr<image_32> im_;
explicit test2(unsigned iterations, unsigned threads=0) :
iter_(iterations),
threads_(threads),
im_()
{
std::string filename("./benchmark/data/multicolor.png");
std::auto_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(filename,"png"));
std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(filename,"png"));
if (!reader.get())
{
throw mapnik::image_reader_exception("Failed to load: " + filename);
}
im_ = boost::make_shared<image_32>(reader->width(),reader->height());
im_ = std::make_shared<image_32>(reader->width(),reader->height());
reader->read(0,0,im_->data());
}
@ -450,7 +450,7 @@ struct test11
ps.close_polygon();
for (unsigned i=0;i<iter_;++i)
{
BOOST_FOREACH (geometry_type & geom , paths)
for (geometry_type & geom : paths)
{
poly_clipper clipped(geom,ps,
agg::clipper_and,
@ -500,7 +500,7 @@ struct test12
}
for (unsigned i=0;i<iter_;++i)
{
BOOST_FOREACH ( geometry_type & geom , paths)
for ( geometry_type & geom : paths)
{
poly_clipper clipped(extent_, geom);
unsigned cmd;
@ -535,7 +535,7 @@ struct test13
unsigned long count = 0;
for (unsigned i=0;i<iter_;++i)
{
BOOST_FOREACH( std::string const& name , mapnik::freetype_engine::face_names())
for ( std::string const& name : mapnik::freetype_engine::face_names())
{
mapnik::face_ptr f = engine.create_face(name);
if (f) ++count;

View file

@ -48,7 +48,7 @@ namespace
{
//user-friendly wrapper that uses Python dictionary
using namespace boost::python;
boost::shared_ptr<mapnik::datasource> create_datasource(dict const& d)
std::shared_ptr<mapnik::datasource> create_datasource(dict const& d)
{
mapnik::parameters params;
boost::python::list keys=d.keys();
@ -92,7 +92,7 @@ boost::shared_ptr<mapnik::datasource> create_datasource(dict const& d)
return mapnik::datasource_cache::instance().create(params);
}
boost::python::dict describe(boost::shared_ptr<mapnik::datasource> const& ds)
boost::python::dict describe(std::shared_ptr<mapnik::datasource> const& ds)
{
boost::python::dict description;
mapnik::layer_descriptor ld = ds->get_descriptor();
@ -103,7 +103,7 @@ boost::python::dict describe(boost::shared_ptr<mapnik::datasource> const& ds)
return description;
}
boost::python::list fields(boost::shared_ptr<mapnik::datasource> const& ds)
boost::python::list fields(std::shared_ptr<mapnik::datasource> const& ds)
{
boost::python::list flds;
if (ds)
@ -119,7 +119,7 @@ boost::python::list fields(boost::shared_ptr<mapnik::datasource> const& ds)
}
return flds;
}
boost::python::list field_types(boost::shared_ptr<mapnik::datasource> const& ds)
boost::python::list field_types(std::shared_ptr<mapnik::datasource> const& ds)
{
boost::python::list fld_types;
if (ds)
@ -173,7 +173,7 @@ void export_datasource()
.value("Collection",mapnik::datasource::Collection)
;
class_<datasource,boost::shared_ptr<datasource>,
class_<datasource,std::shared_ptr<datasource>,
boost::noncopyable>("Datasource",no_init)
.def("type",&datasource::type)
.def("geometry_type",&datasource::get_geometry_type)

View file

@ -29,7 +29,7 @@ namespace {
using namespace boost::python;
boost::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
std::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
{
mapnik::parameters params;
boost::python::list keys=d.keys();

View file

@ -228,7 +228,7 @@ void export_feature()
.def("push", &context_type::push)
;
class_<mapnik::feature_impl,boost::shared_ptr<mapnik::feature_impl>,
class_<mapnik::feature_impl,std::shared_ptr<mapnik::feature_impl>,
boost::noncopyable>("Feature",init<context_ptr,mapnik::value_integer>("Default ctor."))
.def("id",&mapnik::feature_impl::id)
.def("__str__",&mapnik::feature_impl::to_string)

View file

@ -65,7 +65,7 @@ inline mapnik::feature_ptr next(mapnik::featureset_ptr const& itr)
void export_featureset()
{
using namespace boost::python;
class_<mapnik::Featureset,boost::shared_ptr<mapnik::Featureset>,
class_<mapnik::Featureset,std::shared_ptr<mapnik::Featureset>,
boost::noncopyable>("Featureset",no_init)
.def("__iter__",pass_through)
.def("next",next)

View file

@ -79,25 +79,25 @@ void add_geojson_impl(path_type& p, std::string const& json)
throw std::runtime_error("Failed to parse geojson geometry");
}
boost::shared_ptr<path_type> from_wkt_impl(std::string const& wkt)
std::shared_ptr<path_type> from_wkt_impl(std::string const& wkt)
{
boost::shared_ptr<path_type> paths = boost::make_shared<path_type>();
std::shared_ptr<path_type> paths = std::make_shared<path_type>();
if (!mapnik::from_wkt(wkt, *paths))
throw std::runtime_error("Failed to parse WKT");
return paths;
}
boost::shared_ptr<path_type> from_wkb_impl(std::string const& wkb)
std::shared_ptr<path_type> from_wkb_impl(std::string const& wkb)
{
boost::shared_ptr<path_type> paths = boost::make_shared<path_type>();
std::shared_ptr<path_type> paths = std::make_shared<path_type>();
if (!mapnik::geometry_utils::from_wkb(*paths, wkb.c_str(), wkb.size()))
throw std::runtime_error("Failed to parse WKB");
return paths;
}
boost::shared_ptr<path_type> from_geojson_impl(std::string const& json)
std::shared_ptr<path_type> from_geojson_impl(std::string const& json)
{
boost::shared_ptr<path_type> paths = boost::make_shared<path_type>();
std::shared_ptr<path_type> paths = std::make_shared<path_type>();
if (! mapnik::json::from_geojson(json, *paths))
throw std::runtime_error("Failed to parse geojson geometry");
return paths;
@ -107,7 +107,7 @@ mapnik::box2d<double> envelope_impl(path_type & p)
{
mapnik::box2d<double> b;
bool first = true;
BOOST_FOREACH(mapnik::geometry_type const& geom, p)
for (mapnik::geometry_type const& geom : p)
{
if (first)
{
@ -232,6 +232,7 @@ std::string to_geojson( path_type const& geom)
std::string to_svg( geometry_type const& geom)
{
#if BOOST_VERSION >= 104700
std::string svg; // Use Python String directly ?
bool result = mapnik::util::to_svg(svg,geom);
@ -269,10 +270,10 @@ void export_geometry()
{
using namespace boost::python;
enum_<mapnik::eGeomType>("GeometryType")
.value("Point",mapnik::Point)
.value("LineString",mapnik::LineString)
.value("Polygon",mapnik::Polygon)
enum_<mapnik::geometry_type::types>("GeometryType")
.value("Point",mapnik::geometry_type::types::Point)
.value("LineString",mapnik::geometry_type::types::LineString)
.value("Polygon",mapnik::geometry_type::types::Polygon)
;
#if BOOST_VERSION >= 104700
@ -283,7 +284,7 @@ void export_geometry()
#endif
using mapnik::geometry_type;
class_<geometry_type, std::auto_ptr<geometry_type>, boost::noncopyable>("Geometry2d",no_init)
class_<geometry_type, std::shared_ptr<geometry_type>, boost::noncopyable>("Geometry2d",no_init)
.def("envelope",&geometry_type::envelope)
// .def("__str__",&geometry_type::to_string)
.def("type",&geometry_type::type)
@ -293,7 +294,7 @@ void export_geometry()
// TODO add other geometry_type methods
;
class_<path_type, boost::shared_ptr<path_type>, boost::noncopyable>("Path")
class_<path_type, std::shared_ptr<path_type>, boost::noncopyable>("Path")
.def("__getitem__", getitem_impl,return_value_policy<reference_existing_object>())
.def("__len__", &path_type::size)
.def("envelope",envelope_impl)

View file

@ -55,7 +55,7 @@ mapnik::grid::value_type get_pixel(mapnik::grid const& grid, int x, int y)
void export_grid()
{
class_<mapnik::grid,boost::shared_ptr<mapnik::grid> >(
class_<mapnik::grid,std::shared_ptr<mapnik::grid> >(
"Grid",
"This class represents a feature hitgrid.",
init<int,int,std::string,unsigned>(

View file

@ -41,7 +41,7 @@ static dict (*encode)( mapnik::grid_view const&, std::string const& , bool, unsi
void export_grid_view()
{
class_<mapnik::grid_view,
boost::shared_ptr<mapnik::grid_view> >("GridView",
std::shared_ptr<mapnik::grid_view> >("GridView",
"This class represents a feature hitgrid subset.",no_init)
.def("width",&mapnik::grid_view::width)
.def("height",&mapnik::grid_view::height)

View file

@ -146,16 +146,16 @@ void set_pixel(mapnik::image_32 & im, unsigned x, unsigned y, mapnik::color cons
im.setPixel(x, y, c.rgba());
}
boost::shared_ptr<image_32> open_from_file(std::string const& filename)
std::shared_ptr<image_32> open_from_file(std::string const& filename)
{
boost::optional<std::string> type = type_from_filename(filename);
if (type)
{
std::auto_ptr<image_reader> reader(get_image_reader(filename,*type));
std::unique_ptr<image_reader> reader(get_image_reader(filename,*type));
if (reader.get())
{
boost::shared_ptr<image_32> image_ptr = boost::make_shared<image_32>(reader->width(),reader->height());
std::shared_ptr<image_32> image_ptr = std::make_shared<image_32>(reader->width(),reader->height());
reader->read(0,0,image_ptr->data());
return image_ptr;
}
@ -164,28 +164,28 @@ boost::shared_ptr<image_32> open_from_file(std::string const& filename)
throw mapnik::image_reader_exception("Unsupported image format:" + filename);
}
boost::shared_ptr<image_32> fromstring(std::string const& str)
std::shared_ptr<image_32> fromstring(std::string const& str)
{
std::auto_ptr<image_reader> reader(get_image_reader(str.c_str(),str.size()));
std::unique_ptr<image_reader> reader(get_image_reader(str.c_str(),str.size()));
if (reader.get())
{
boost::shared_ptr<image_32> image_ptr = boost::make_shared<image_32>(reader->width(),reader->height());
std::shared_ptr<image_32> image_ptr = std::make_shared<image_32>(reader->width(),reader->height());
reader->read(0,0,image_ptr->data());
return image_ptr;
}
throw mapnik::image_reader_exception("Failed to load image from buffer" );
}
boost::shared_ptr<image_32> frombuffer(PyObject * obj)
std::shared_ptr<image_32> frombuffer(PyObject * obj)
{
void const* buffer=0;
Py_ssize_t buffer_len;
if (PyObject_AsReadBuffer(obj, &buffer, &buffer_len) == 0)
{
std::auto_ptr<image_reader> reader(get_image_reader(reinterpret_cast<char const*>(buffer),buffer_len));
std::unique_ptr<image_reader> reader(get_image_reader(reinterpret_cast<char const*>(buffer),buffer_len));
if (reader.get())
{
boost::shared_ptr<image_32> image_ptr = boost::make_shared<image_32>(reader->width(),reader->height());
std::shared_ptr<image_32> image_ptr = std::make_shared<image_32>(reader->width(),reader->height());
reader->read(0,0,image_ptr->data());
return image_ptr;
}
@ -205,10 +205,10 @@ void composite(image_32 & dst, image_32 & src, mapnik::composite_mode_e mode, fl
}
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
boost::shared_ptr<image_32> from_cairo(PycairoSurface* py_surface)
std::shared_ptr<image_32> from_cairo(PycairoSurface* py_surface)
{
mapnik::cairo_surface_ptr surface(py_surface->surface, mapnik::cairo_surface_closer());
boost::shared_ptr<image_32> image_ptr = boost::make_shared<image_32>(surface);
std::shared_ptr<image_32> image_ptr = std::make_shared<image_32>(surface);
return image_ptr;
}
#endif
@ -253,7 +253,7 @@ void export_image()
.value("value", mapnik::_value)
;
class_<image_32,boost::shared_ptr<image_32> >("Image","This class represents a 32 bit RGBA image.",init<int,int>())
class_<image_32,std::shared_ptr<image_32> >("Image","This class represents a 32 bit RGBA image.",init<int,int>())
.def("width",&image_32::width)
.def("height",&image_32::height)
.def("view",&image_32::get_view)

View file

@ -35,27 +35,26 @@
using mapnik::label_collision_detector4;
using mapnik::box2d;
using mapnik::Map;
using boost::make_shared;
namespace
{
boost::shared_ptr<label_collision_detector4>
std::shared_ptr<label_collision_detector4>
create_label_collision_detector_from_extent(box2d<double> const &extent)
{
return make_shared<label_collision_detector4>(extent);
return std::make_shared<label_collision_detector4>(extent);
}
boost::shared_ptr<label_collision_detector4>
std::shared_ptr<label_collision_detector4>
create_label_collision_detector_from_map(Map const &m)
{
double buffer = m.buffer_size();
box2d<double> extent(-buffer, -buffer, m.width() + buffer, m.height() + buffer);
return make_shared<label_collision_detector4>(extent);
return std::make_shared<label_collision_detector4>(extent);
}
boost::python::list
make_label_boxes(boost::shared_ptr<label_collision_detector4> det)
make_label_boxes(std::shared_ptr<label_collision_detector4> det)
{
boost::python::list boxes;
@ -77,7 +76,7 @@ void export_label_collision_detector()
// for overload resolution
void (label_collision_detector4::*insert_box)(box2d<double> const &) = &label_collision_detector4::insert;
class_<label_collision_detector4, boost::shared_ptr<label_collision_detector4>, boost::noncopyable>
class_<label_collision_detector4, std::shared_ptr<label_collision_detector4>, boost::noncopyable>
("LabelCollisionDetector",
"Object to detect collisions between labels, used in the rendering process.",
no_init)

View file

@ -31,7 +31,7 @@
// stl
#include <stdexcept>
static boost::shared_ptr<mapnik::rgba_palette> make_palette( std::string const& palette, std::string const& format )
static std::shared_ptr<mapnik::rgba_palette> make_palette( std::string const& palette, std::string const& format )
{
mapnik::rgba_palette::palette_type type = mapnik::rgba_palette::PALETTE_RGBA;
if (format == "rgb")
@ -40,7 +40,7 @@ static boost::shared_ptr<mapnik::rgba_palette> make_palette( std::string const&
type = mapnik::rgba_palette::PALETTE_ACT;
else
throw std::runtime_error("invalid type passed for mapnik.Palette: must be either rgba, rgb, or act");
return boost::make_shared<mapnik::rgba_palette>(palette, type);
return std::make_shared<mapnik::rgba_palette>(palette, type);
}
void export_palette ()
@ -48,7 +48,7 @@ void export_palette ()
using namespace boost::python;
class_<mapnik::rgba_palette,
boost::shared_ptr<mapnik::rgba_palette>,
std::shared_ptr<mapnik::rgba_palette>,
boost::noncopyable >("Palette",no_init)
//, init<std::string,std::string>(
// ( arg("palette"), arg("type")),

View file

@ -176,22 +176,22 @@ mapnik::value_holder get_param(mapnik::parameter const& p, int index)
}
}
boost::shared_ptr<mapnik::parameter> create_parameter(mapnik::value_unicode_string const& key, mapnik::value_holder const& value)
std::shared_ptr<mapnik::parameter> create_parameter(mapnik::value_unicode_string const& key, mapnik::value_holder const& value)
{
std::string key_utf8;
mapnik::to_utf8(key, key_utf8);
return boost::make_shared<mapnik::parameter>(key_utf8,value);
return std::make_shared<mapnik::parameter>(key_utf8,value);
}
// needed for Python_Unicode to std::string (utf8) conversion
boost::shared_ptr<mapnik::parameter> create_parameter_from_string(mapnik::value_unicode_string const& key, mapnik::value_unicode_string const& ustr)
std::shared_ptr<mapnik::parameter> create_parameter_from_string(mapnik::value_unicode_string const& key, mapnik::value_unicode_string const& ustr)
{
std::string key_utf8;
std::string ustr_utf8;
mapnik::to_utf8(key, key_utf8);
mapnik::to_utf8(ustr,ustr_utf8);
return boost::make_shared<mapnik::parameter>(key_utf8, ustr_utf8);
return std::make_shared<mapnik::parameter>(key_utf8, ustr_utf8);
}
void export_parameters()
@ -202,7 +202,7 @@ void export_parameters()
implicitly_convertible<mapnik::value_integer,mapnik::value_holder>();
implicitly_convertible<mapnik::value_double,mapnik::value_holder>();
class_<parameter,boost::shared_ptr<parameter> >("Parameter",no_init)
class_<parameter,std::shared_ptr<parameter> >("Parameter",no_init)
.def("__init__", make_constructor(create_parameter),
"Create a mapnik.Parameter from a pair of values, the first being a string\n"
"and the second being either a string, and integer, or a float")

View file

@ -138,7 +138,7 @@ void render(const mapnik::Map& map,
void render_with_detector(
const mapnik::Map &map,
mapnik::image_32 &image,
boost::shared_ptr<mapnik::label_collision_detector4> detector,
std::shared_ptr<mapnik::label_collision_detector4> detector,
double scale_factor = 1.0,
unsigned offset_x = 0u,
unsigned offset_y = 0u)
@ -213,7 +213,7 @@ void render6(const mapnik::Map& map, PycairoContext* py_context)
void render_with_detector2(
const mapnik::Map& map,
PycairoContext* py_context,
boost::shared_ptr<mapnik::label_collision_detector4> detector)
std::shared_ptr<mapnik::label_collision_detector4> detector)
{
python_unblock_auto_block b;
mapnik::cairo_ptr context(py_context->ctx, mapnik::cairo_closer());
@ -224,7 +224,7 @@ void render_with_detector2(
void render_with_detector3(
const mapnik::Map& map,
PycairoContext* py_context,
boost::shared_ptr<mapnik::label_collision_detector4> detector,
std::shared_ptr<mapnik::label_collision_detector4> detector,
double scale_factor = 1.0,
unsigned offset_x = 0u,
unsigned offset_y = 0u)
@ -238,7 +238,7 @@ void render_with_detector3(
void render_with_detector4(
const mapnik::Map& map,
PycairoSurface* py_surface,
boost::shared_ptr<mapnik::label_collision_detector4> detector)
std::shared_ptr<mapnik::label_collision_detector4> detector)
{
python_unblock_auto_block b;
mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer());
@ -249,7 +249,7 @@ void render_with_detector4(
void render_with_detector5(
const mapnik::Map& map,
PycairoSurface* py_surface,
boost::shared_ptr<mapnik::label_collision_detector4> detector,
std::shared_ptr<mapnik::label_collision_detector4> detector,
double scale_factor = 1.0,
unsigned offset_x = 0u,
unsigned offset_y = 0u)

View file

@ -22,7 +22,7 @@
// boost
#include <boost/python.hpp>
#include <boost/foreach.hpp>
// mapnik
#include <mapnik/query.hpp>
@ -55,7 +55,7 @@ struct names_to_list
static PyObject* convert(std::set<std::string> const& names)
{
boost::python::list l;
BOOST_FOREACH( std::string const& name, names )
for ( std::string const& name : names )
{
l.append(name);
}
@ -86,6 +86,3 @@ void export_query()
return_value_policy<copy_const_reference>()) )
.def("add_property_name", &query::add_property_name);
}

View file

@ -45,13 +45,17 @@ std::string get_image_filters(feature_type_style & style)
void set_image_filters(feature_type_style & style, std::string const& filters)
{
std::vector<mapnik::filter::filter_type> new_filters;
bool result = parse_image_filters(filters, new_filters);
if (!result)
{
throw mapnik::value_error("failed to parse image-filters: '" + filters + "'");
}
style.image_filters().swap(new_filters);
#ifdef _WINDOWS
style.image_filters() = new_filters;
// FIXME : https://svn.boost.org/trac/boost/ticket/2839
#else
style.image_filters() = std::move(new_filters);
#endif
}
void export_style()

View file

@ -432,17 +432,17 @@ void export_text_placement()
;
class_<TextPlacementsWrap,
boost::shared_ptr<TextPlacementsWrap>,
std::shared_ptr<TextPlacementsWrap>,
boost::noncopyable>
("TextPlacements")
.def_readwrite("defaults", &text_placements::defaults)
.def("get_placement_info", pure_virtual(&text_placements::get_placement_info))
/* TODO: add_expressions() */
;
register_ptr_to_python<boost::shared_ptr<text_placements> >();
register_ptr_to_python<std::shared_ptr<text_placements> >();
class_<TextPlacementInfoWrap,
boost::shared_ptr<TextPlacementInfoWrap>,
std::shared_ptr<TextPlacementInfoWrap>,
boost::noncopyable>
("TextPlacementInfo",
init<text_placements const*, double>())
@ -453,11 +453,11 @@ void export_text_placement()
.def_readwrite("properties", &text_placement_info::properties)
.def_readwrite("scale_factor", &text_placement_info::scale_factor)
;
register_ptr_to_python<boost::shared_ptr<text_placement_info> >();
register_ptr_to_python<std::shared_ptr<text_placement_info> >();
class_<processed_text,
boost::shared_ptr<processed_text>,
std::shared_ptr<processed_text>,
boost::noncopyable>
("ProcessedText", no_init)
.def("push_back", &processed_text::push_back)
@ -466,7 +466,7 @@ void export_text_placement()
class_<expression_set,
boost::shared_ptr<expression_set>,
std::shared_ptr<expression_set>,
boost::noncopyable>
("ExpressionSet")
.def("insert", &insert_expression);
@ -475,7 +475,7 @@ void export_text_placement()
//TODO: Python namespace
class_<NodeWrap,
boost::shared_ptr<NodeWrap>,
std::shared_ptr<NodeWrap>,
boost::noncopyable>
("FormattingNode")
.def("apply", pure_virtual(&formatting::node::apply))
@ -483,11 +483,11 @@ void export_text_placement()
&formatting::node::add_expressions,
&NodeWrap::default_add_expressions)
;
register_ptr_to_python<boost::shared_ptr<formatting::node> >();
register_ptr_to_python<std::shared_ptr<formatting::node> >();
class_<TextNodeWrap,
boost::shared_ptr<TextNodeWrap>,
std::shared_ptr<TextNodeWrap>,
bases<formatting::node>,
boost::noncopyable>
("FormattingText", init<expression_ptr>())
@ -497,11 +497,11 @@ void export_text_placement()
&formatting::text_node::get_text,
&formatting::text_node::set_text)
;
register_ptr_to_python<boost::shared_ptr<formatting::text_node> >();
register_ptr_to_python<std::shared_ptr<formatting::text_node> >();
class_with_converter<FormatNodeWrap,
boost::shared_ptr<FormatNodeWrap>,
std::shared_ptr<FormatNodeWrap>,
bases<formatting::node>,
boost::noncopyable>
("FormattingFormat")
@ -522,10 +522,10 @@ void export_text_placement()
&formatting::format_node::get_child,
&formatting::format_node::set_child)
;
register_ptr_to_python<boost::shared_ptr<formatting::format_node> >();
register_ptr_to_python<std::shared_ptr<formatting::format_node> >();
class_<ListNodeWrap,
boost::shared_ptr<ListNodeWrap>,
std::shared_ptr<ListNodeWrap>,
bases<formatting::node>,
boost::noncopyable>
("FormattingList", init<>())
@ -538,10 +538,10 @@ void export_text_placement()
.def("append", &ListNodeWrap::append)
;
register_ptr_to_python<boost::shared_ptr<formatting::list_node> >();
register_ptr_to_python<std::shared_ptr<formatting::list_node> >();
class_<ExprFormatWrap,
boost::shared_ptr<ExprFormatWrap>,
std::shared_ptr<ExprFormatWrap>,
bases<formatting::node>,
boost::noncopyable>
("FormattingExpressionFormat")
@ -561,7 +561,7 @@ void export_text_placement()
&formatting::expression_format::get_child,
&formatting::expression_format::set_child)
;
register_ptr_to_python<boost::shared_ptr<formatting::expression_format> >();
register_ptr_to_python<std::shared_ptr<formatting::expression_format> >();
//TODO: registry
}

View file

@ -23,7 +23,7 @@
// boost
#include <boost/python.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/make_shared.hpp>
// mapnik
@ -34,9 +34,9 @@ namespace impl {
typedef boost::ptr_vector<mapnik::geometry_type> path_type;
boost::shared_ptr<path_type> from_wkt(mapnik::wkt_parser & p, std::string const& wkt)
std::shared_ptr<path_type> from_wkt(mapnik::wkt_parser & p, std::string const& wkt)
{
boost::shared_ptr<path_type> paths = boost::make_shared<path_type>();
std::shared_ptr<path_type> paths = std::make_shared<path_type>();
if (!p.parse(wkt, *paths))
throw std::runtime_error("Failed to parse WKT");
return paths;

View file

@ -24,8 +24,6 @@
// boost
#include <boost/python.hpp>
#include <boost/scoped_array.hpp>
#include <boost/foreach.hpp>
// mapnik
#include <mapnik/map.hpp>
@ -67,7 +65,7 @@ void grid2utf(T const& grid_type,
for (unsigned y = 0; y < data.height(); ++y)
{
boost::uint16_t idx = 0;
boost::scoped_array<Py_UNICODE> line(new Py_UNICODE[array_size]);
const std::unique_ptr<Py_UNICODE[]> line(new Py_UNICODE[array_size]);
typename T::value_type const* row = data.getRow(y);
for (unsigned x = 0; x < data.width(); ++x)
{
@ -130,7 +128,7 @@ void grid2utf(T const& grid_type,
for (unsigned y = 0; y < grid_type.height(); y=y+resolution)
{
boost::uint16_t idx = 0;
boost::scoped_array<Py_UNICODE> line(new Py_UNICODE[array_size]);
const std::unique_ptr<Py_UNICODE[]> line(new Py_UNICODE[array_size]);
mapnik::grid::value_type const* row = grid_type.getRow(y);
for (unsigned x = 0; x < grid_type.width(); x=x+resolution)
{
@ -197,7 +195,7 @@ void grid2utf2(T const& grid_type,
for (unsigned y = 0; y < target.height(); ++y)
{
uint16_t idx = 0;
boost::scoped_array<Py_UNICODE> line(new Py_UNICODE[array_size]);
const std::unique_ptr<Py_UNICODE[]> line(new Py_UNICODE[array_size]);
mapnik::grid::value_type * row = target.getRow(y);
unsigned x;
for (x = 0; x < target.width(); ++x)
@ -245,7 +243,7 @@ void write_features(T const& grid_type,
std::set<std::string> const& attributes = grid_type.property_names();
typename T::feature_type::const_iterator feat_end = g_features.end();
BOOST_FOREACH ( std::string const& key_item, key_order )
for ( std::string const& key_item :key_order )
{
if (key_item.empty())
{
@ -261,7 +259,7 @@ void write_features(T const& grid_type,
bool found = false;
boost::python::dict feat;
mapnik::feature_ptr feature = feat_itr->second;
BOOST_FOREACH ( std::string const& attr, attributes )
for ( std::string const& attr : attributes )
{
if (attr == "__id__")
{
@ -305,7 +303,7 @@ void grid_encode_utf(T const& grid_type,
// convert key order to proper python list
boost::python::list keys_a;
BOOST_FOREACH ( typename T::lookup_type const& key_id, key_order )
for ( typename T::lookup_type const& key_id : key_order )
{
keys_a.append(key_id);
}

View file

@ -17,7 +17,7 @@
#include <vector>
#include <boost/concept_check.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/geometry/algorithms/area.hpp>
@ -32,8 +32,8 @@ class rtree
{
public:
typedef boost::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef boost::shared_ptr<rtree_leaf<Box, Value> > leaf_pointer;
typedef std::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef std::shared_ptr<rtree_leaf<Box, Value> > leaf_pointer;
/**
* \brief Creates a rtree with 'maximum' elements per node and 'minimum'.
@ -771,4 +771,3 @@ private:
}}} // namespace boost::geometry::index
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP

View file

@ -16,7 +16,7 @@
#include <utility>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/assign.hpp>
@ -33,7 +33,7 @@ class rtree_leaf : public rtree_node<Box, Value>
public:
/// container type for the leaves
typedef boost::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef std::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef std::vector<std::pair<Box, Value> > leaf_map;
/**
@ -250,4 +250,3 @@ private:
}}} // namespace boost::geometry::index
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_LEAF_HPP

View file

@ -16,7 +16,7 @@
#include <utility>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/assign.hpp>
@ -37,8 +37,8 @@ class rtree_node
{
public:
typedef boost::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef boost::shared_ptr<rtree_leaf<Box, Value> > leaf_pointer;
typedef std::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef std::shared_ptr<rtree_leaf<Box, Value> > leaf_pointer;
/// type for the node map
typedef std::vector<std::pair<Box, node_pointer > > node_map;

View file

@ -27,7 +27,7 @@
using mapnik::Map;
LayerListModel::LayerListModel(boost::shared_ptr<Map> map,QObject *parent)
LayerListModel::LayerListModel(std::shared_ptr<Map> map,QObject *parent)
: QAbstractListModel(parent),
map_(map) {}
@ -117,8 +117,3 @@ boost::optional<mapnik::layer&> LayerListModel::map_layer(int i)
}
return boost::optional<mapnik::layer&>();
}

View file

@ -34,7 +34,7 @@ class LayerListModel : public QAbstractListModel
{
Q_OBJECT
public:
LayerListModel(boost::shared_ptr<mapnik::Map> map, QObject * parent = 0);
LayerListModel(std::shared_ptr<mapnik::Map> map, QObject * parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation,
@ -45,7 +45,7 @@ class LayerListModel : public QAbstractListModel
boost::optional<mapnik::layer&> map_layer(int i);
private:
boost::shared_ptr<mapnik::Map> map_;
std::shared_ptr<mapnik::Map> map_;
};
#endif //LAYER_LIST_MODEL_HPP

View file

@ -185,7 +185,7 @@ void MainWindow::load_map_file(QString const& filename)
std::cout<<"loading "<< filename.toStdString() << std::endl;
unsigned width = mapWidget_->width();
unsigned height = mapWidget_->height();
boost::shared_ptr<mapnik::Map> map(new mapnik::Map(width,height));
std::shared_ptr<mapnik::Map> map(new mapnik::Map(width,height));
mapWidget_->setMap(map);
try
{
@ -412,7 +412,7 @@ void MainWindow::set_default_extent(double x0,double y0, double x1, double y1)
{
try
{
boost::shared_ptr<mapnik::Map> map_ptr = mapWidget_->getMap();
std::shared_ptr<mapnik::Map> map_ptr = mapWidget_->getMap();
if (map_ptr)
{
mapnik::projection prj(map_ptr->srs());
@ -433,7 +433,7 @@ void MainWindow::set_scaling_factor(double scaling_factor)
void MainWindow::zoom_all()
{
boost::shared_ptr<mapnik::Map> map_ptr = mapWidget_->getMap();
std::shared_ptr<mapnik::Map> map_ptr = mapWidget_->getMap();
if (map_ptr)
{
map_ptr->zoom_all();

View file

@ -606,12 +606,12 @@ void MapWidget::updateMap()
}
}
boost::shared_ptr<Map> MapWidget::getMap()
std::shared_ptr<Map> MapWidget::getMap()
{
return map_;
}
void MapWidget::setMap(boost::shared_ptr<Map> map)
void MapWidget::setMap(std::shared_ptr<Map> map)
{
map_ = map;
}

View file

@ -28,8 +28,8 @@
#include <QItemSelection>
#include <iostream>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <memory>
#ifndef Q_MOC_RUN
#include <mapnik/map.hpp>
@ -55,7 +55,7 @@ public:
};
private:
boost::shared_ptr<mapnik::Map> map_;
std::shared_ptr<mapnik::Map> map_;
int selected_;
QPixmap pix_;
mapnik::box2d<double> extent_;
@ -73,9 +73,9 @@ private:
public:
MapWidget(QWidget *parent=0);
void setTool(eTool tool);
boost::shared_ptr<mapnik::Map> getMap();
std::shared_ptr<mapnik::Map> getMap();
inline QPixmap const& pixmap() const { return pix_;}
void setMap(boost::shared_ptr<mapnik::Map> map);
void setMap(std::shared_ptr<mapnik::Map> map);
void defaultView();
void zoomToBox(mapnik::box2d<double> const& box);
void zoomIn();

View file

@ -26,7 +26,7 @@
// boost
#include <boost/concept_check.hpp>
#include <boost/scoped_ptr.hpp>
// qt
#include <QList>
#include <QIcon>
@ -114,7 +114,7 @@ public:
}
private:
boost::scoped_ptr<node_base> impl_;
const std::unique_ptr<node_base> impl_;
QList<node*> children_;
node * parent_;
};
@ -199,7 +199,7 @@ struct symbolizer_icon : public boost::static_visitor<QIcon>
{
// FIXME!
/*
boost::shared_ptr<mapnik::image_data_32> symbol = sym.get_image();
std::shared_ptr<mapnik::image_data_32> symbol = sym.get_image();
if (symbol)
{
QImage image(symbol->getBytes(),
@ -303,7 +303,7 @@ private:
class map_node
{
public:
explicit map_node(boost::shared_ptr<mapnik::Map> map)
explicit map_node(std::shared_ptr<mapnik::Map> map)
: map_(map) {}
~map_node() {}
@ -318,10 +318,10 @@ public:
}
private:
boost::shared_ptr<mapnik::Map> map_;
std::shared_ptr<mapnik::Map> map_;
};
StyleModel::StyleModel(boost::shared_ptr<mapnik::Map> map, QObject * parent)
StyleModel::StyleModel(std::shared_ptr<mapnik::Map> map, QObject * parent)
: QAbstractItemModel(parent),
root_(new node(map_node(map)))
{

View file

@ -27,14 +27,14 @@
#include <mapnik/map.hpp>
#endif
#include <boost/scoped_ptr.hpp>
class node;
class StyleModel : public QAbstractItemModel
{
Q_OBJECT
public:
StyleModel(boost::shared_ptr<mapnik::Map> map, QObject * parent=0);
StyleModel(std::shared_ptr<mapnik::Map> map, QObject * parent=0);
~StyleModel();
// interface
QModelIndex index (int row, int col, QModelIndex const& parent = QModelIndex()) const;
@ -43,8 +43,8 @@ class StyleModel : public QAbstractItemModel
int columnCount( QModelIndex const& parent = QModelIndex()) const;
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
private:
//boost::shared_ptr<mapnik::Map> map_;
boost::scoped_ptr<node> root_;
//std::shared_ptr<mapnik::Map> map_;
const std::unique_ptr<node> root_;
};
#endif // STYLE_MODEL_HPP

View file

@ -37,8 +37,8 @@
#include <mapnik/request.hpp>
// boost
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
// fwd declaration to avoid depedence on agg headers
namespace agg { struct trans_affine; }
@ -68,7 +68,7 @@ public:
// create with default, empty placement detector
agg_renderer(Map const& m, T & pixmap, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
// create with external placement detector, possibly non-empty
agg_renderer(Map const &m, T & pixmap, boost::shared_ptr<label_collision_detector4> detector,
agg_renderer(Map const &m, T & pixmap, std::shared_ptr<label_collision_detector4> detector,
double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
// pass in mapnik::request object to provide the mutable things per render
agg_renderer(Map const& m, request const& req, T & pixmap, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
@ -147,7 +147,7 @@ protected:
private:
buffer_type & pixmap_;
boost::shared_ptr<buffer_type> internal_buffer_;
std::shared_ptr<buffer_type> internal_buffer_;
mutable buffer_type * current_buffer_;
mutable bool style_level_compositing_;
unsigned width_;
@ -156,8 +156,8 @@ private:
CoordTransform t_;
freetype_engine font_engine_;
face_manager<freetype_engine> font_manager_;
boost::shared_ptr<label_collision_detector4> detector_;
boost::scoped_ptr<rasterizer> ras_ptr;
std::shared_ptr<label_collision_detector4> detector_;
const std::unique_ptr<rasterizer> ras_ptr;
box2d<double> query_extent_;
gamma_method_e gamma_method_;
double gamma_;

View file

@ -64,6 +64,7 @@ public:
box2d(coord<T,2> const& c0, coord<T,2> const& c1);
box2d(box2d_type const& rhs);
box2d(box2d_type const& rhs, agg::trans_affine const& tr);
box2d(box2d_type&& rhs);
box2d_type& operator=(box2d_type other);
T minx() const;
T miny() const;

View file

@ -37,7 +37,7 @@
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
// cairo
#include <cairo.h>
@ -78,18 +78,18 @@ void check_object_status_and_throw_exception(T const& object)
class cairo_face : private mapnik::noncopyable
{
public:
cairo_face(boost::shared_ptr<freetype_engine> const& engine, face_ptr const& face);
cairo_face(std::shared_ptr<freetype_engine> const& engine, face_ptr const& face);
~cairo_face();
cairo_font_face_t * face() const;
private:
class handle
{
public:
handle(boost::shared_ptr<freetype_engine> const& engine, face_ptr const& face)
handle(std::shared_ptr<freetype_engine> const& engine, face_ptr const& face)
: engine_(engine), face_(face) {}
private:
boost::shared_ptr<freetype_engine> engine_;
std::shared_ptr<freetype_engine> engine_;
face_ptr face_;
};
@ -104,17 +104,17 @@ private:
cairo_font_face_t *c_face_;
};
typedef boost::shared_ptr<cairo_face> cairo_face_ptr;
typedef std::shared_ptr<cairo_face> cairo_face_ptr;
class cairo_face_manager : private mapnik::noncopyable
{
public:
cairo_face_manager(boost::shared_ptr<freetype_engine> engine);
cairo_face_manager(std::shared_ptr<freetype_engine> engine);
cairo_face_ptr get_face(face_ptr face);
private:
typedef std::map<face_ptr,cairo_face_ptr> cairo_face_cache;
boost::shared_ptr<freetype_engine> font_engine_;
std::shared_ptr<freetype_engine> font_engine_;
cairo_face_cache cache_;
};
@ -210,7 +210,7 @@ public:
units_ = grad.get_units();
BOOST_FOREACH ( mapnik::stop_pair const& st, grad.get_stop_array() )
for ( mapnik::stop_pair const& st : grad.get_stop_array() )
{
mapnik::color const& stop_color = st.second;
double r= static_cast<double> (stop_color.red())/255.0;
@ -268,8 +268,8 @@ struct cairo_surface_closer
}
};
typedef boost::shared_ptr<cairo_t> cairo_ptr;
typedef boost::shared_ptr<cairo_surface_t> cairo_surface_ptr;
typedef std::shared_ptr<cairo_t> cairo_ptr;
typedef std::shared_ptr<cairo_surface_t> cairo_surface_ptr;
inline cairo_ptr create_context(cairo_surface_ptr const& surface)
{

View file

@ -41,7 +41,7 @@
#include <cairo.h>
// boost
#include <boost/scoped_ptr.hpp>
namespace agg {
struct trans_affine;
@ -67,7 +67,7 @@ protected:
unsigned offset_y=0);
cairo_renderer_base(Map const& m,
cairo_ptr const& cairo,
boost::shared_ptr<label_collision_detector4> detector,
std::shared_ptr<label_collision_detector4> detector,
double scale_factor=1.0,
unsigned offset_x=0,
unsigned offset_y=0);
@ -143,10 +143,10 @@ protected:
unsigned height_;
double scale_factor_;
CoordTransform t_;
boost::shared_ptr<freetype_engine> font_engine_;
std::shared_ptr<freetype_engine> font_engine_;
face_manager<freetype_engine> font_manager_;
cairo_face_manager face_manager_;
boost::shared_ptr<label_collision_detector4> detector_;
std::shared_ptr<label_collision_detector4> detector_;
box2d<double> query_extent_;
void setup(Map const& m);
};
@ -170,7 +170,7 @@ public:
unsigned offset_y=0);
cairo_renderer(Map const& m,
T const& obj,
boost::shared_ptr<label_collision_detector4> detector,
std::shared_ptr<label_collision_detector4> detector,
double scale_factor=1.0,
unsigned offset_x=0,
unsigned offset_y=0);

View file

@ -23,7 +23,7 @@
#ifndef MAPNIK_CHAR_INFO_HPP
#define MAPNIK_CHAR_INFO_HPP
#include <boost/shared_ptr.hpp>
#include <memory>
namespace mapnik {
struct char_properties;

View file

@ -33,7 +33,7 @@
#include <mapnik/feature_style_processor_context.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/optional.hpp>
// stl
@ -48,7 +48,7 @@ struct MAPNIK_DECL Featureset : private mapnik::noncopyable
virtual ~Featureset() {}
};
typedef boost::shared_ptr<Featureset> featureset_ptr;
typedef std::shared_ptr<Featureset> featureset_ptr;
class MAPNIK_DECL datasource_exception : public std::exception
{
@ -140,7 +140,7 @@ public:
}
};
typedef boost::shared_ptr<datasource> datasource_ptr;
typedef std::shared_ptr<datasource> datasource_ptr;
#ifdef MAPNIK_STATIC_PLUGINS
#define DATASOURCE_PLUGIN(classname)

View file

@ -30,7 +30,7 @@
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
// stl
#include <map>
@ -49,11 +49,11 @@ public:
std::string plugin_directories();
void register_datasources(std::string const& path);
bool register_datasource(std::string const& path);
boost::shared_ptr<datasource> create(parameters const& params);
std::shared_ptr<datasource> create(parameters const& params);
private:
datasource_cache();
~datasource_cache();
std::map<std::string,boost::shared_ptr<PluginInfo> > plugins_;
std::map<std::string,std::shared_ptr<PluginInfo> > plugins_;
bool registered_;
std::vector<std::string> plugin_directories_;
};

View file

@ -28,7 +28,7 @@
#include <mapnik/expression_node_types.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
// stl
#include <string>
@ -39,7 +39,7 @@ namespace mapnik
// fwd declare to reduce compile time
template <typename Iterator> struct expression_grammar;
typedef boost::shared_ptr<expr_node> expression_ptr;
typedef std::shared_ptr<expr_node> expression_ptr;
typedef std::set<expression_ptr> expression_set;

View file

@ -28,7 +28,7 @@
#include <mapnik/expression_node_types.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
// stl
#include <string>
@ -56,7 +56,7 @@ std::string to_expression_string(T const* expr_node_ptr)
}
template <typename T>
std::string to_expression_string(boost::shared_ptr<T> const& expr_node_ptr)
std::string to_expression_string(std::shared_ptr<T> const& expr_node_ptr)
{
throw std::logic_error("to_expression_string() called with pointer argument");
// compile error intended here; comment on the next line shows in clang output

View file

@ -31,42 +31,23 @@
#include <map>
namespace mapnik {
template <typename key_type,
typename product_type>
class default_factory_error
{
public:
struct factory_exception : public std::exception
{
const char* what() const throw()
{
return "unknown object type";
}
};
static product_type* on_unknown_type(const key_type&)
{
return 0;
}
};
template
<
typename product_type,
typename key_type,
typename product_creator=product_type* (*)(),
template <typename,typename> class factory_error_policy=default_factory_error
>
typename ...Args >
class factory : public singleton<factory <product_type,
key_type,
product_creator,factory_error_policy> >,
factory_error_policy <key_type,product_type>
Args...> >
{
private:
typedef product_type* (*product_creator)(Args...);
typedef std::map<key_type,product_creator> product_map;
product_map map_;
public:
bool register_product(const key_type& key,product_creator creator)
bool register_product(key_type const& key, product_creator creator)
{
return map_.insert(typename product_map::value_type(key,creator)).second;
}
@ -76,22 +57,12 @@ public:
return map_.erase(key)==1;
}
product_type* create_object(const key_type& key,std::string const& file)
product_type* create_object(key_type const& key, Args...args)
{
typename product_map::const_iterator pos=map_.find(key);
if (pos!=map_.end())
{
return (pos->second)(file);
}
return 0;
}
product_type* create_object(const key_type& key, char const* data, std::size_t size)
{
typename product_map::const_iterator pos=map_.find(key);
if (pos!=map_.end())
{
return (pos->second)(data, size);
return (pos->second)(args...);
}
return 0;
}

View file

@ -33,7 +33,7 @@
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/ptr_container/ptr_vector.hpp>
// stl
@ -48,7 +48,7 @@ namespace mapnik {
class raster;
class feature_impl;
typedef boost::shared_ptr<raster> raster_ptr;
typedef std::shared_ptr<raster> raster_ptr;
template <typename T>
class context : private mapnik::noncopyable
@ -88,7 +88,7 @@ private:
};
typedef context<std::map<std::string,std::size_t> > context_type;
typedef boost::shared_ptr<context_type> context_ptr;
typedef std::shared_ptr<context_type> context_ptr;
static const value default_value;
@ -116,22 +116,22 @@ public:
template <typename T>
inline void put(context_type::key_type const& key, T const& val)
{
put(key,value(val));
put(key, std::move(value(val)));
}
template <typename T>
inline void put_new(context_type::key_type const& key, T const& val)
{
put_new(key,value(val));
put_new(key,std::move(value(val)));
}
inline void put(context_type::key_type const& key, value const& val)
inline void put(context_type::key_type const& key, value && val)
{
context_type::map_type::const_iterator itr = ctx_->mapping_.find(key);
if (itr != ctx_->mapping_.end()
&& itr->second < data_.size())
{
data_[itr->second] = val;
data_[itr->second] = std::move(val);
}
else
{
@ -139,19 +139,19 @@ public:
}
}
inline void put_new(context_type::key_type const& key, value const& val)
inline void put_new(context_type::key_type const& key, value && val)
{
context_type::map_type::const_iterator itr = ctx_->mapping_.find(key);
if (itr != ctx_->mapping_.end()
&& itr->second < data_.size())
{
data_[itr->second] = val;
data_[itr->second] = std::move(val);
}
else
{
cont_type::size_type index = ctx_->push(key);
if (index == data_.size())
data_.push_back(val);
data_.push_back(std::move(val));
}
}
@ -231,9 +231,8 @@ public:
// TODO - cache this
box2d<double> result;
bool first = true;
for (unsigned i=0;i<num_geometries();++i)
for (auto const& geom : geom_cont_)
{
geometry_type const& geom = get_geometry(i);
if (first)
{
box2d<double> box = geom.envelope();
@ -311,7 +310,7 @@ inline std::ostream& operator<< (std::ostream & out,feature_impl const& f)
// TODO - remove at Mapnik 3.x
typedef feature_impl Feature;
typedef boost::shared_ptr<feature_impl> feature_ptr;
typedef std::shared_ptr<feature_impl> feature_ptr;
}

View file

@ -35,11 +35,11 @@ namespace mapnik
{
struct feature_factory
{
static boost::shared_ptr<feature_impl> create (context_ptr const& ctx, mapnik::value_integer fid)
static std::shared_ptr<feature_impl> create (context_ptr const& ctx, mapnik::value_integer fid)
{
//return boost::allocate_shared<feature_impl>(boost::pool_allocator<feature_impl>(),fid);
//return boost::allocate_shared<feature_impl>(boost::fast_pool_allocator<feature_impl>(),fid);
return boost::make_shared<feature_impl>(ctx,fid);
return std::make_shared<feature_impl>(ctx,fid);
}
};
}

View file

@ -23,13 +23,10 @@
#ifndef FEATURE_STYLE_PROCESSOR_CONTEXT_HPP
#define FEATURE_STYLE_PROCESSOR_CONTEXT_HPP
// boost
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
// stl
#include <map>
#include <string>
#include <memory>
namespace mapnik {
@ -39,9 +36,9 @@ public:
virtual ~IProcessorContext() {}
};
typedef boost::shared_ptr<IProcessorContext> processor_context_ptr;
typedef std::shared_ptr<IProcessorContext> processor_context_ptr;
typedef std::map<std::string, processor_context_ptr > feature_style_context_map;
}
#endif /* FEATURE_STYLE_PROCESSOR_CONTEXT_HPP */
#endif // FEATURE_STYLE_PROCESSOR_CONTEXT_HPP

View file

@ -135,7 +135,7 @@ struct layer_rendering_material {
box2d<double> layer_ext2_;
std::vector<feature_type_style const*> active_styles_;
std::vector<featureset_ptr> featureset_ptr_list_;
boost::ptr_vector<rule_cache> rule_caches_;
std::vector<rule_cache> rule_caches_;
layer_rendering_material(layer const& lay, projection const& dest) :
lay_(lay),
@ -143,7 +143,7 @@ struct layer_rendering_material {
proj1_(lay.srs(),true) {}
};
typedef boost::shared_ptr<layer_rendering_material> layer_rendering_material_ptr;
typedef std::shared_ptr<layer_rendering_material> layer_rendering_material_ptr;
template <typename Processor>
@ -180,12 +180,12 @@ void feature_style_processor<Processor>::apply(double scale_denom)
// implementing asynchronous queries
feature_style_context_map ctx_map;
BOOST_FOREACH ( layer const& lyr, m_.layers() )
for ( layer const& lyr : m_.layers() )
{
if (lyr.visible(scale_denom))
{
std::set<std::string> names;
layer_rendering_material_ptr mat = boost::make_shared<layer_rendering_material>(lyr, proj);
layer_rendering_material_ptr mat = std::make_shared<layer_rendering_material>(lyr, proj);
prepare_layer(*mat,
ctx_map,
@ -207,7 +207,7 @@ void feature_style_processor<Processor>::apply(double scale_denom)
}
}
BOOST_FOREACH ( layer_rendering_material_ptr mat, mat_list )
for ( layer_rendering_material_ptr mat : mat_list )
{
if (!mat->active_styles_.empty())
{
@ -381,7 +381,7 @@ void feature_style_processor<Processor>::prepare_layer(layer_rendering_material
{
// check for styles needing compositing operations applied
// https://github.com/mapnik/mapnik/issues/1477
BOOST_FOREACH(std::string const& style_name, style_names)
for (std::string const& style_name : style_names)
{
boost::optional<feature_type_style const&> style=m_.find_style(style_name);
if (!style)
@ -435,11 +435,11 @@ void feature_style_processor<Processor>::prepare_layer(layer_rendering_material
height/qh);
query q(layer_ext,res,scale_denom,extent);
boost::ptr_vector<rule_cache> & rule_caches = mat.rule_caches_;
std::vector<rule_cache> & rule_caches = mat.rule_caches_;
attribute_collector collector(names);
// iterate through all named styles collecting active styles and attribute names
BOOST_FOREACH(std::string const& style_name, style_names)
for (std::string const& style_name : style_names)
{
boost::optional<feature_type_style const&> style=m_.find_style(style_name);
if (!style)
@ -453,19 +453,19 @@ void feature_style_processor<Processor>::prepare_layer(layer_rendering_material
std::vector<rule> const& rules = style->get_rules();
bool active_rules = false;
std::auto_ptr<rule_cache> rc(new rule_cache);
BOOST_FOREACH(rule const& r, rules)
rule_cache rc;
for(rule const& r : rules)
{
if (r.active(scale_denom))
{
rc->add_rule(r);
rc.add_rule(r);
active_rules = true;
collector(r);
}
}
if (active_rules)
{
rule_caches.push_back(rc);
rule_caches.push_back(std::move(rc));
active_styles.push_back(&(*style));
}
}
@ -476,14 +476,14 @@ void feature_style_processor<Processor>::prepare_layer(layer_rendering_material
if (p.attribute_collection_policy() == COLLECT_ALL)
{
layer_descriptor lay_desc = ds->get_descriptor();
BOOST_FOREACH(attribute_descriptor const& desc, lay_desc.get_descriptors())
for (attribute_descriptor const& desc : lay_desc.get_descriptors())
{
q.add_property_name(desc.get_name());
}
}
else
{
BOOST_FOREACH(std::string const& name, names)
for (std::string const& name : names)
{
q.add_property_name(name);
}
@ -525,7 +525,7 @@ void feature_style_processor<Processor>::render_material(layer_rendering_materia
{
// The datasource wasn't querried because of early return
// but we have to apply compositing operations on styles
BOOST_FOREACH (feature_type_style const* style, active_styles)
for (feature_type_style const* style : active_styles)
{
p.start_style_processing(*style);
p.end_style_processing(*style);
@ -538,7 +538,7 @@ void feature_style_processor<Processor>::render_material(layer_rendering_materia
layer const& lay = mat.lay_;
boost::ptr_vector<rule_cache> & rule_caches = mat.rule_caches_;
std::vector<rule_cache> & rule_caches = mat.rule_caches_;
proj_transform prj_trans(mat.proj0_,mat.proj1_);
@ -554,7 +554,7 @@ void feature_style_processor<Processor>::render_material(layer_rendering_materia
featureset_ptr features = *featureset_ptr_list.begin();
if (features) {
// Cache all features into the memory_datasource before rendering.
boost::shared_ptr<featureset_buffer> cache = boost::make_shared<featureset_buffer>();
std::shared_ptr<featureset_buffer> cache = std::make_shared<featureset_buffer>();
feature_ptr feature, prev;
while ((feature = features->next()))
@ -564,7 +564,7 @@ void feature_style_processor<Processor>::render_material(layer_rendering_materia
// We're at a value boundary, so render what we have
// up to this point.
int i = 0;
BOOST_FOREACH (feature_type_style const* style, active_styles)
for (feature_type_style const* style : active_styles)
{
cache->prepare();
@ -581,7 +581,7 @@ void feature_style_processor<Processor>::render_material(layer_rendering_materia
}
int i = 0;
BOOST_FOREACH (feature_type_style const* style, active_styles)
for (feature_type_style const* style : active_styles)
{
cache->prepare();
render_style(p, style, rule_caches[i], cache, prj_trans);
@ -592,7 +592,7 @@ void feature_style_processor<Processor>::render_material(layer_rendering_materia
}
else if (cache_features)
{
boost::shared_ptr<featureset_buffer> cache = boost::make_shared<featureset_buffer>();
std::shared_ptr<featureset_buffer> cache = std::make_shared<featureset_buffer>();
featureset_ptr features = *featureset_ptr_list.begin();
if (features) {
// Cache all features into the memory_datasource before rendering.
@ -604,7 +604,7 @@ void feature_style_processor<Processor>::render_material(layer_rendering_materia
}
}
int i = 0;
BOOST_FOREACH (feature_type_style const* style, active_styles)
for (feature_type_style const* style : active_styles)
{
cache->prepare();
render_style(p, style,
@ -618,7 +618,7 @@ void feature_style_processor<Processor>::render_material(layer_rendering_materia
{
int i = 0;
std::vector<featureset_ptr>::iterator featuresets = featureset_ptr_list.begin();
BOOST_FOREACH (feature_type_style const* style, active_styles)
for (feature_type_style const* style : active_styles)
{
featureset_ptr features = *featuresets++;
render_style(p, style,
@ -652,7 +652,7 @@ void feature_style_processor<Processor>::render_style(
{
bool do_else = true;
bool do_also = false;
BOOST_FOREACH(rule const* r, rc.get_if_rules() )
for (rule const* r : rc.get_if_rules() )
{
expression_ptr const& expr=r->get_filter();
value_type result = boost::apply_visitor(evaluate<feature_impl,value_type>(*feature),*expr);
@ -664,7 +664,7 @@ void feature_style_processor<Processor>::render_style(
rule::symbolizers const& symbols = r->get_symbolizers();
if(!p.process(symbols,*feature,prj_trans))
{
BOOST_FOREACH (symbolizer const& sym, symbols)
for (symbolizer const& sym : symbols)
{
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
}
@ -679,13 +679,13 @@ void feature_style_processor<Processor>::render_style(
}
if (do_else)
{
BOOST_FOREACH( rule const* r, rc.get_else_rules() )
for( rule const* r : rc.get_else_rules() )
{
was_painted = true;
rule::symbolizers const& symbols = r->get_symbolizers();
if(!p.process(symbols,*feature,prj_trans))
{
BOOST_FOREACH (symbolizer const& sym, symbols)
for (symbolizer const& sym : symbols)
{
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
}
@ -694,13 +694,13 @@ void feature_style_processor<Processor>::render_style(
}
if (do_also)
{
BOOST_FOREACH( rule const* r, rc.get_also_rules() )
for( rule const* r : rc.get_also_rules() )
{
was_painted = true;
rule::symbolizers const& symbols = r->get_symbolizers();
if(!p.process(symbols,*feature,prj_trans))
{
BOOST_FOREACH (symbolizer const& sym, symbols)
for (symbolizer const& sym : symbols)
{
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
}

View file

@ -39,10 +39,10 @@
#include <mapnik/pixel_position.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/make_shared.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/foreach.hpp>
#ifdef MAPNIK_THREADSAFE
#include <boost/thread/mutex.hpp>
#endif
@ -63,7 +63,7 @@ struct char_properties;
class stroker;
struct glyph_t;
typedef boost::shared_ptr<font_face> face_ptr;
typedef std::shared_ptr<font_face> face_ptr;
class MAPNIK_DECL font_glyph : private mapnik::noncopyable
{
@ -85,7 +85,7 @@ private:
unsigned index_;
};
typedef boost::shared_ptr<font_glyph> glyph_ptr;
typedef std::shared_ptr<font_glyph> glyph_ptr;
@ -111,8 +111,8 @@ private:
std::map<unsigned, char_info> dimension_cache_;
};
typedef boost::shared_ptr<font_face_set> face_set_ptr;
typedef boost::shared_ptr<stroker> stroker_ptr;
typedef std::shared_ptr<font_face_set> face_set_ptr;
typedef std::shared_ptr<stroker> stroker_ptr;
class MAPNIK_DECL freetype_engine
{
@ -179,7 +179,7 @@ public:
face_set_ptr get_face_set(std::string const& name)
{
face_set_ptr face_set = boost::make_shared<font_face_set>();
face_set_ptr face_set = std::make_shared<font_face_set>();
if (face_ptr face = get_face(name))
{
face_set->add(face);
@ -190,8 +190,8 @@ public:
face_set_ptr get_face_set(font_set const& fset)
{
std::vector<std::string> const& names = fset.get_face_names();
face_set_ptr face_set = boost::make_shared<font_face_set>();
BOOST_FOREACH( std::string const& name, names)
face_set_ptr face_set = std::make_shared<font_face_set>();
for ( std::string const& name : names)
{
face_ptr face = get_face(name);
if (face)

View file

@ -38,7 +38,7 @@ struct char_properties;
namespace formatting {
class node;
typedef boost::shared_ptr<node> node_ptr;
typedef std::shared_ptr<node> node_ptr;
class MAPNIK_DECL node
{

View file

@ -29,30 +29,34 @@
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/ptr_container/ptr_vector.hpp>
namespace mapnik {
enum eGeomType {
Unknown = 0,
Point = 1,
LineString = 2,
Polygon = 3
};
template <typename T, template <typename> class Container=vertex_vector>
class geometry : private mapnik::noncopyable
{
public:
static const std::uint8_t geometry_bits = 7;
enum types : std::uint8_t
{
Unknown = 0x00,
Point = 0x01,
LineString = 0x02,
Polygon = 0x03,
PolygonExterior = Polygon,
PolygonInterior = Polygon | ( 1 << geometry_bits)
};
typedef T coord_type;
typedef Container<coord_type> container_type;
typedef typename container_type::value_type value_type;
typedef typename container_type::size_type size_type;
private:
container_type cont_;
eGeomType type_;
mutable unsigned itr_;
types type_;
mutable size_type itr_;
public:
geometry()
@ -60,17 +64,22 @@ public:
itr_(0)
{}
explicit geometry(eGeomType type)
explicit geometry(types type)
: type_(type),
itr_(0)
{}
eGeomType type() const
types type() const
{
return type_;
return static_cast<types>(type_ & types::Polygon);
}
void set_type(eGeomType type)
bool interior() const
{
return static_cast<bool>(type_ >> geometry_bits);
}
void set_type(types type)
{
type_ = type;
}
@ -91,7 +100,7 @@ public:
double x = 0;
double y = 0;
rewind(0);
for (unsigned i=0; i < size(); ++i)
for (size_type i = 0; i < size(); ++i)
{
unsigned cmd = vertex(&x,&y);
if (cmd == SEG_CLOSE) continue;
@ -144,7 +153,7 @@ public:
};
typedef geometry<double,vertex_vector> geometry_type;
typedef boost::shared_ptr<geometry_type> geometry_ptr;
typedef std::shared_ptr<geometry_type> geometry_ptr;
typedef boost::ptr_vector<geometry_type> geometry_container;
}

View file

@ -79,11 +79,11 @@ struct raster_markers_rasterizer_dispatch_grid
marker_placement_e placement_method = sym_.get_marker_placement();
box2d<double> bbox_(0,0, src_.width(),src_.height());
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
path.type() == geometry_type::types::Point)
{
double x = 0;
double y = 0;
if (path.type() == LineString)
if (path.type() == geometry_type::types::LineString)
{
if (!label::middle_point(path, x, y))
return;
@ -216,11 +216,11 @@ struct vector_markers_rasterizer_dispatch_grid
{
marker_placement_e placement_method = sym_.get_marker_placement();
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
path.type() == geometry_type::types::Point)
{
double x = 0;
double y = 0;
if (path.type() == LineString)
if (path.type() == geometry_type::types::LineString)
{
if (!label::middle_point(path, x, y))
return;
@ -294,4 +294,3 @@ private:
}
#endif

View file

@ -37,8 +37,8 @@
#include <mapnik/pixel_position.hpp>
// boost
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
// fwd declaration to avoid depedence on agg headers
namespace agg { struct trans_affine; }
@ -135,8 +135,8 @@ private:
CoordTransform t_;
freetype_engine font_engine_;
face_manager<freetype_engine> font_manager_;
boost::shared_ptr<label_collision_detector4> detector_;
boost::scoped_ptr<grid_rasterizer> ras_ptr;
std::shared_ptr<label_collision_detector4> detector_;
const std::unique_ptr<grid_rasterizer> ras_ptr;
box2d<double> query_extent_;
void setup(Map const& m);
};

View file

@ -33,7 +33,7 @@
#if BOOST_VERSION >= 104600
#include <boost/range/algorithm.hpp>
#endif
#include <boost/scoped_ptr.hpp>
// stl
#include <vector>
@ -124,7 +124,7 @@ class hextree : private mapnik::noncopyable
unsigned colors_;
// flag indicating existance of invisible pixels (a < InsertPolicy::MIN_ALPHA)
bool has_holes_;
boost::scoped_ptr<node> root_;
const std::unique_ptr<node> root_;
// working palette for quantization, sorted on mean(r,g,b,a) for easier searching NN
std::vector<rgba> sorted_pal_;
// index remaping of sorted_pal_ indexes to indexes of returned image palette

View file

@ -27,7 +27,7 @@
#include <mapnik/feature.hpp>
#include <mapnik/geom_util.hpp>
// boost
#include <boost/foreach.hpp>
namespace mapnik {
class hit_test_filter
@ -40,7 +40,7 @@ public:
bool pass(feature_impl & feature)
{
BOOST_FOREACH(geometry_type & geom, feature.paths())
for (geometry_type & geom : feature.paths())
{
if (label::hit_test(geom, x_,y_,tol_))
return true;

View file

@ -32,7 +32,7 @@
#include <boost/variant/static_visitor.hpp>
#include <boost/gil/gil_all.hpp>
#include <boost/concept_check.hpp>
#include <boost/foreach.hpp>
// agg
#include "agg_basics.h"
@ -418,7 +418,7 @@ void apply_filter(Src & src, colorize_alpha const& op)
double step = 1.0/(size-1);
double offset = 0.0;
BOOST_FOREACH( mapnik::filter::color_stop const& stop, op)
for ( mapnik::filter::color_stop const& stop : op)
{
mapnik::color const& c = stop.color;
double stop_offset = stop.offset;

View file

@ -62,8 +62,11 @@ struct MAPNIK_DECL image_reader : private mapnik::noncopyable
virtual ~image_reader() {}
};
bool register_image_reader(std::string const& type,image_reader* (*)(std::string const&));
bool register_image_reader(std::string const& type,image_reader* (*)(char const*, std::size_t));
template <typename...Args>
bool register_image_reader(std::string const& type, image_reader* (* fun)(Args...))
{
return factory<image_reader,std::string, Args...>::instance().register_product(type, fun);
}
MAPNIK_DECL image_reader* get_image_reader(std::string const& file,std::string const& type);
MAPNIK_DECL image_reader* get_image_reader(std::string const& file);

View file

@ -30,7 +30,7 @@
#include <mapnik/unicode.hpp>
// boost
#include <boost/scoped_ptr.hpp>
// stl
#include <vector>
@ -49,7 +49,7 @@ public:
~feature_collection_parser();
bool parse(iterator_type first, iterator_type last, std::vector<mapnik::feature_ptr> & features);
private:
boost::scoped_ptr<feature_collection_grammar<iterator_type,feature_type> > grammar_;
const std::unique_ptr<feature_collection_grammar<iterator_type,feature_type> > grammar_;
};
}}

View file

@ -30,7 +30,7 @@
#include <mapnik/unicode.hpp>
// boost
#include <boost/scoped_ptr.hpp>
// stl
#include <vector>
@ -49,7 +49,7 @@ public:
~feature_parser();
bool parse(iterator_type first, iterator_type last, mapnik::feature_impl & f);
private:
boost::scoped_ptr<feature_grammar<iterator_type,feature_type> > grammar_;
const std::unique_ptr<feature_grammar<iterator_type,feature_type> > grammar_;
};
}}

View file

@ -27,7 +27,7 @@
#include <mapnik/feature.hpp>
#include <mapnik/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
#include <string>
#include <iterator>
@ -46,7 +46,7 @@ public:
~feature_generator();
bool generate(std::string & geojson, mapnik::feature_impl const& f);
private:
boost::scoped_ptr<feature_generator_grammar<sink_type> > grammar_;
const std::unique_ptr<feature_generator_grammar<sink_type> > grammar_;
};
class MAPNIK_DECL geometry_generator : private mapnik::noncopyable
@ -57,7 +57,7 @@ public:
~geometry_generator();
bool generate(std::string & geojson, mapnik::geometry_container const& g);
private:
boost::scoped_ptr<multi_geometry_generator_grammar<sink_type> > grammar_;
const std::unique_ptr<multi_geometry_generator_grammar<sink_type> > grammar_;
};
#else

View file

@ -207,17 +207,17 @@ struct geometry_generator_grammar :
coordinates = point | linestring | polygon
;
point = &uint_(mapnik::Point)[_1 = _type(_val)]
point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)]
<< point_coord [_1 = _first(_val)]
;
linestring = &uint_(mapnik::LineString)[_1 = _type(_val)]
linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)]
<< lit('[')
<< coords
<< lit(']')
;
polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)]
polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)]
<< lit('[')
<< coords2
<< lit("]]")
@ -284,12 +284,12 @@ struct multi_geometry_generator_grammar :
using boost::spirit::karma::_r1;
geometry_types.add
(mapnik::Point,"\"Point\"")
(mapnik::LineString,"\"LineString\"")
(mapnik::Polygon,"\"Polygon\"")
(mapnik::Point + 3,"\"MultiPoint\"")
(mapnik::LineString + 3,"\"MultiLineString\"")
(mapnik::Polygon + 3,"\"MultiPolygon\"")
(mapnik::geometry_type::types::Point,"\"Point\"")
(mapnik::geometry_type::types::LineString,"\"LineString\"")
(mapnik::geometry_type::types::Polygon,"\"Polygon\"")
(mapnik::geometry_type::types::Point + 3,"\"MultiPoint\"")
(mapnik::geometry_type::types::LineString + 3,"\"MultiLineString\"")
(mapnik::geometry_type::types::Polygon + 3,"\"MultiPolygon\"")
;
start %= ( eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)]

View file

@ -29,7 +29,7 @@
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/scoped_ptr.hpp>
// stl
//#include <vector>
@ -49,7 +49,7 @@ public:
~geometry_parser();
bool parse(iterator_type first, iterator_type last, boost::ptr_vector<mapnik::geometry_type>&);
private:
boost::scoped_ptr<geometry_grammar<iterator_type> > grammar_;
const std::unique_ptr<geometry_grammar<iterator_type> > grammar_;
};
}}

View file

@ -30,14 +30,14 @@
// boost
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/optional.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
namespace mapnik
{
typedef boost::shared_ptr<boost::interprocess::mapped_region> mapped_region_ptr;
typedef std::shared_ptr<boost::interprocess::mapped_region> mapped_region_ptr;
class MAPNIK_DECL mapped_memory_cache :
public singleton<mapped_memory_cache, CreateStatic>,

View file

@ -36,7 +36,7 @@
// boost
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/optional.hpp>
#include <boost/make_shared.hpp>
@ -49,8 +49,8 @@ namespace mapnik
typedef agg::pod_bvector<mapnik::svg::path_attributes> attr_storage;
typedef mapnik::svg::svg_storage<mapnik::svg::svg_path_storage,attr_storage> svg_storage_type;
typedef boost::shared_ptr<svg_storage_type> svg_path_ptr;
typedef boost::shared_ptr<image_data_32> image_ptr;
typedef std::shared_ptr<svg_storage_type> svg_path_ptr;
typedef std::shared_ptr<image_data_32> image_ptr;
/**
* A class to hold either vector or bitmap marker data. This allows these to be treated equally
* in the image caches and most of the render paths.
@ -61,7 +61,7 @@ public:
marker()
{
// create default OGC 4x4 black pixel
bitmap_data_ = boost::optional<mapnik::image_ptr>(boost::make_shared<image_data_32>(4,4));
bitmap_data_ = boost::optional<mapnik::image_ptr>(std::make_shared<image_data_32>(4,4));
(*bitmap_data_)->set(0xff000000);
}

View file

@ -30,7 +30,7 @@
// boost
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/optional.hpp>
namespace mapnik
@ -38,7 +38,7 @@ namespace mapnik
class marker;
typedef boost::shared_ptr<marker> marker_ptr;
typedef std::shared_ptr<marker> marker_ptr;
class MAPNIK_DECL marker_cache :

View file

@ -94,11 +94,11 @@ struct vector_markers_rasterizer_dispatch
marker_placement_e placement_method = sym_.get_marker_placement();
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
path.type() == mapnik::geometry_type::types::Point)
{
double x = 0;
double y = 0;
if (path.type() == LineString)
if (path.type() == mapnik::geometry_type::types::LineString)
{
if (!label::middle_point(path, x, y))
return;
@ -206,11 +206,11 @@ struct raster_markers_rasterizer_dispatch
box2d<double> bbox_(0,0, src_.width(),src_.height());
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
path.type() == mapnik::geometry_type::types::Point)
{
double x = 0;
double y = 0;
if (path.type() == LineString)
if (path.type() == mapnik::geometry_type::types::LineString)
{
if (!label::middle_point(path, x, y))
return;
@ -477,7 +477,7 @@ void apply_markers_multi(feature_impl & feature, Converter& converter, markers_s
double x, y;
if (label::centroid_geoms(feature.paths().begin(), feature.paths().end(), x, y))
{
geometry_type pt(Point);
geometry_type pt(geometry_type::types::Point);
pt.move_to(x, y);
// unset any clipping since we're now dealing with a point
converter.template unset<clip_poly_tag>();
@ -491,7 +491,7 @@ void apply_markers_multi(feature_impl & feature, Converter& converter, markers_s
// TODO: consider using true area for polygon types
double maxarea = 0;
geometry_type* largest = 0;
BOOST_FOREACH(geometry_type & geom, feature.paths())
for (geometry_type & geom : feature.paths())
{
const box2d<double>& env = geom.envelope();
double area = env.width() * env.height();
@ -512,7 +512,7 @@ void apply_markers_multi(feature_impl & feature, Converter& converter, markers_s
{
MAPNIK_LOG_WARN(marker_symbolizer) << "marker_multi_policy != 'each' has no effect with marker_placement != 'point'";
}
BOOST_FOREACH(geometry_type & path, feature.paths())
for (geometry_type & path : feature.paths())
{
converter.apply(path);
}

View file

@ -25,7 +25,7 @@
// boost
#include <boost/variant/variant_fwd.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
// stl
#include <string>
@ -38,7 +38,7 @@ struct attribute;
typedef boost::variant<std::string, attribute> path_component;
typedef std::vector<path_component> path_expression;
typedef boost::shared_ptr<path_expression> path_expression_ptr;
typedef std::shared_ptr<path_expression> path_expression_ptr;
}

View file

@ -99,14 +99,14 @@ private:
// otherwise it will autodetect the orientation.
// If >= 50% of the characters end up upside down, it will be retried the other way.
// RETURN: 1/-1 depending which way up the string ends up being.
std::auto_ptr<text_path> get_placement_offset(std::vector<vertex2d> const& path_positions,
std::unique_ptr<text_path> get_placement_offset(std::vector<vertex2d> const& path_positions,
std::vector<double> const& path_distances,
int & orientation, std::size_t index, double distance);
///Tests whether the given text_path be placed without a collision
// Returns true if it can
// NOTE: This edits p.envelopes so it can be used afterwards (you must clear it otherwise)
bool test_placement(std::auto_ptr<text_path> const& current_placement, int orientation);
bool test_placement(std::unique_ptr<text_path> const& current_placement, int orientation);
///Does a line-circle intersect calculation
// NOTE: Follow the strict pre conditions

View file

@ -34,7 +34,7 @@
#include <zlib.h> // for Z_DEFAULT_COMPRESSION
// boost
#include <boost/scoped_array.hpp>
// stl
#include <cassert>
@ -123,7 +123,7 @@ void save_as_png(T1 & file,
png_set_IHDR(png_ptr, info_ptr,image.width(),image.height(),8,
(trans_mode == 0) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA,PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
boost::scoped_array<png_byte*> row_pointers(new png_bytep[image.height()]);
const std::unique_ptr<png_bytep[]> row_pointers(new png_bytep[image.height()]);
for (unsigned int i = 0; i < image.height(); i++)
{
row_pointers[i] = (png_bytep)image.getRow(i);

View file

@ -28,10 +28,11 @@
// mapnik
#include <mapnik/box2d.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/geometry.hpp>
// boost
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
@ -166,7 +167,7 @@ private:
continue;
}
prev_x = x;
prev_x = y;
prev_y = y;
if (ring_count == 1)
{
append(subject_poly, make<point_2d>(x,y));
@ -179,7 +180,13 @@ private:
}
polygon_list clipped_polygons;
#ifdef MAPNIK_LOG
double area = boost::geometry::area(subject_poly);
if (area < 0)
{
MAPNIK_LOG_ERROR(polygon_clipper) << "negative area detected for polygon indicating incorrect winding order";
}
#endif
try
{
boost::geometry::intersection(clip_box_, subject_poly, clipped_polygons);
@ -189,10 +196,10 @@ private:
std::cerr << ex.what() << std::endl;
}
BOOST_FOREACH(polygon_2d const& poly, clipped_polygons)
for (polygon_2d const& poly : clipped_polygons)
{
bool move_to = true;
BOOST_FOREACH(point_2d const& c, boost::geometry::exterior_ring(poly))
for (point_2d const& c : boost::geometry::exterior_ring(poly))
{
if (move_to)
{
@ -206,10 +213,10 @@ private:
}
output_.close_path();
// interior rings
BOOST_FOREACH(polygon_2d::inner_container_type::value_type const& ring, boost::geometry::interior_rings(poly))
for (polygon_2d::inner_container_type::value_type const& ring : boost::geometry::interior_rings(poly))
{
move_to = true;
BOOST_FOREACH(point_2d const& c, ring)
for (point_2d const& c : ring)
{
if (move_to)
{

View file

@ -29,7 +29,7 @@
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
#ifdef MAPNIK_THREADSAFE
#include <boost/thread/mutex.hpp>
#endif
@ -45,7 +45,7 @@ namespace mapnik
template <typename T,template <typename> class Creator>
class Pool : private mapnik::noncopyable
{
typedef boost::shared_ptr<T> HolderType;
typedef std::shared_ptr<T> HolderType;
typedef std::deque<HolderType> ContType;
Creator<T> creator_;

View file

@ -43,7 +43,7 @@
#include <mapnik/enumeration.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
// stl
#include <vector>
@ -200,7 +200,7 @@ public:
//!
//! \param[in, out] raster A raster stored in float32 single channel format, which gets colorized in place.
//! \param[in] f The feature used to find 'NODATA' information if available
void colorize(boost::shared_ptr<raster> const& raster, feature_impl const& f) const;
void colorize(std::shared_ptr<raster> const& raster, feature_impl const& f) const;
//! \brief Perform the translation of input to output
@ -227,7 +227,7 @@ private:
};
typedef boost::shared_ptr<raster_colorizer> raster_colorizer_ptr;
typedef std::shared_ptr<raster_colorizer> raster_colorizer_ptr;
} // mapnik namespace

View file

@ -27,10 +27,6 @@
#include <mapnik/rule.hpp>
#include <mapnik/feature_type_style.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/foreach.hpp>
// stl
#include <vector>
@ -39,6 +35,10 @@ namespace mapnik
class rule_cache : private noncopyable
{
private:
//latest MS compiler (VC++ 2012 november CTP) doesn't support deleting functions
//rule_cache(rule_cache const& other) = delete; // no copy ctor
//rule_cache& operator=(rule_cache const& other) = delete; // no assignment op
public:
typedef std::vector<rule const*> rule_ptrs;
rule_cache()
@ -46,6 +46,20 @@ public:
else_rules_(),
also_rules_() {}
rule_cache(rule_cache && rhs) // move ctor
: if_rules_(std::move(rhs.if_rules_)),
else_rules_(std::move(rhs.else_rules_)),
also_rules_(std::move(rhs.also_rules_))
{}
rule_cache& operator=(rule_cache && rhs) // move assign
{
std::swap(if_rules_, rhs.if_rules_);
std::swap(else_rules_,rhs.else_rules_);
std::swap(also_rules_, rhs.also_rules_);
return *this;
}
void add_rule(rule const& r)
{
if (r.has_else_filter())

View file

@ -38,7 +38,7 @@ namespace mapnik
struct MAPNIK_DECL shield_symbolizer : public text_symbolizer,
public symbolizer_with_image
{
// Note - we do not use boost::make_shared below as VC2008 and VC2010 are
// Note - we do not use std::make_shared below as VC2008 and VC2010 are
// not able to compile make_shared used within a constructor
shield_symbolizer(text_placements_ptr placements = text_placements_ptr(new text_placements_dummy));
shield_symbolizer(expression_ptr name,

View file

@ -30,7 +30,7 @@
// boost
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/make_shared.hpp>
namespace mapnik {
@ -74,7 +74,7 @@ public:
path_iterator(Container const& path)
: path_iterator::iterator_adaptor_(0),
path_(path),
first_value_(boost::make_shared<Value>(0,0,0))
first_value_(std::make_shared<Value>(0,0,0))
{}
/*!
@ -91,7 +91,7 @@ public:
explicit path_iterator(Value* first_element, Container const& path)
: path_iterator::iterator_adaptor_(first_element),
path_(path),
first_value_(boost::make_shared<Value>(0,0,0))
first_value_(std::make_shared<Value>(0,0,0))
{
this->increment();
}
@ -165,7 +165,7 @@ private:
}
Container const& path_;
boost::shared_ptr<Value> first_value_;
std::shared_ptr<Value> first_value_;
};
/*!

View file

@ -40,8 +40,8 @@
// boost
#include <boost/variant/static_visitor.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
// stl
#include <string>
@ -161,7 +161,7 @@ private:
svg::path_output_attributes path_attributes_;
freetype_engine font_engine_;
face_manager<freetype_engine> font_manager_;
boost::shared_ptr<label_collision_detector4> detector_;
std::shared_ptr<label_collision_detector4> detector_;
svg::svg_generator<OutputIterator> generator_;
box2d<double> query_extent_;
bool painted_;

View file

@ -35,7 +35,7 @@
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/foreach.hpp>
// agg
#include "agg_path_storage.h"
@ -142,7 +142,7 @@ public:
grad.get_control_points(x1,y1,x2,y2,radius);
m_gradient_lut.remove_all();
BOOST_FOREACH ( mapnik::stop_pair const& st, grad.get_stop_array() )
for ( mapnik::stop_pair const& st : grad.get_stop_array() )
{
mapnik::color const& stop_color = st.second;
unsigned r = stop_color.red();

View file

@ -30,7 +30,7 @@
#include <mapnik/simplify.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
// stl
#include <vector>
@ -45,7 +45,7 @@ namespace mapnik
// TODO - move these transform declares to own header
namespace detail { struct transform_node; }
typedef std::vector<detail::transform_node> transform_list;
typedef boost::shared_ptr<transform_list> transform_list_ptr;
typedef std::shared_ptr<transform_list> transform_list_ptr;
typedef transform_list_ptr transform_type;
class feature_impl;

View file

@ -41,7 +41,7 @@ struct symbolizer_hash
// specialisation for polygon_symbolizer
static std::size_t value(polygon_symbolizer const& sym)
{
std::size_t seed = Polygon;
std::size_t seed = geometry_type::types::Polygon;
boost::hash_combine(seed, sym.get_fill().rgba());
boost::hash_combine(seed, sym.get_opacity());
return seed;
@ -50,7 +50,7 @@ struct symbolizer_hash
// specialisation for line_symbolizer
static std::size_t value(line_symbolizer const& sym)
{
std::size_t seed = LineString;
std::size_t seed = geometry_type::types::LineString;
boost::hash_combine(seed, sym.get_stroke().get_color().rgba());
boost::hash_combine(seed, sym.get_stroke().get_width());
boost::hash_combine(seed, sym.get_stroke().get_opacity());

View file

@ -31,7 +31,7 @@
#include <mapnik/text_path.hpp>
//boost
#include <boost/scoped_ptr.hpp>
// agg
#include "agg_trans_affine.h"
@ -110,7 +110,7 @@ protected:
bool points_on_line_;
text_placement_info_ptr placement_;
boost::scoped_ptr<placement_finder<DetectorT> > finder_;
std::unique_ptr<placement_finder<DetectorT> > finder_;
};
template <typename FaceManagerT, typename DetectorT>

View file

@ -33,10 +33,9 @@
#include <vector>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/ptr_container/ptr_vector.hpp>
namespace mapnik
{
@ -197,9 +196,8 @@ public:
}
};
typedef boost::shared_ptr<text_path> text_path_ptr;
typedef std::shared_ptr<text_path> text_path_ptr;
typedef boost::ptr_vector<text_path> placements_type;
}
#endif // MAPNIK_TEXT_PATH_HPP

View file

@ -70,7 +70,7 @@ public:
double get_actual_minimum_padding() const { return scale_factor * properties.minimum_padding; }
};
typedef boost::shared_ptr<text_placement_info> text_placement_info_ptr;
typedef std::shared_ptr<text_placement_info> text_placement_info_ptr;
/** This object handles the management of all TextSymbolizer properties. It can
* be used as a base class for own objects which implement new processing
@ -108,7 +108,7 @@ public:
};
/** Pointer to object of class text_placements */
typedef boost::shared_ptr<text_placements> text_placements_ptr;
typedef std::shared_ptr<text_placements> text_placements_ptr;
} //ns mapnik

View file

@ -31,7 +31,7 @@
#include <mapnik/text_placements/dummy.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/make_shared.hpp>
// stl
@ -57,7 +57,7 @@ DEFINE_ENUM(halo_rasterizer_e, halo_rasterizer_enum);
struct MAPNIK_DECL text_symbolizer : public symbolizer_base
{
// Note - we do not use boost::make_shared below as VC2008 and VC2010 are
// Note - we do not use std::make_shared below as VC2008 and VC2010 are
// not able to compile make_shared used within a constructor
text_symbolizer(text_placements_ptr placements = text_placements_ptr(new text_placements_dummy));
text_symbolizer(expression_ptr name, std::string const& face_name,

View file

@ -28,7 +28,7 @@
// boost
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/variant/variant.hpp>
// fusion
@ -193,7 +193,7 @@ inline void clear(transform_node& val)
typedef detail::transform_node transform_node;
typedef std::vector<transform_node> transform_list;
typedef boost::shared_ptr<transform_list> transform_list_ptr;
typedef std::shared_ptr<transform_list> transform_list_ptr;
MAPNIK_DECL std::string to_expression_string(transform_node const& node);
MAPNIK_DECL std::string to_expression_string(transform_list const& list);

View file

@ -33,10 +33,10 @@
#include <mapnik/expression_evaluator.hpp>
// boost
#include <boost/foreach.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <boost/range/adaptor/reversed.hpp>
// agg
#include <agg_trans_affine.h>
@ -190,7 +190,7 @@ struct transform_processor
{
attribute_collector<Container> collect(names);
BOOST_FOREACH (transform_node const& node, list)
for (transform_node const& node : list)
{
boost::apply_visitor(collect, *node);
}
@ -205,7 +205,7 @@ struct transform_processor
MAPNIK_LOG_DEBUG(transform) << "transform: begin with " << to_string(matrix_node(tr));
#endif
BOOST_REVERSE_FOREACH (transform_node const& node, list)
for (transform_node const& node : boost::adaptors::reverse(list))
{
boost::apply_visitor(eval, *node);
#ifdef MAPNIK_LOG

View file

@ -175,7 +175,7 @@ namespace mapnik { namespace util {
svg = point | linestring | polygon
;
point = &uint_(mapnik::Point)[_1 = _type(_val)]
point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)]
<< svg_point [_1 = _first(_val)]
;
@ -185,11 +185,11 @@ namespace mapnik { namespace util {
<< lit('\"')
;
linestring = &uint_(mapnik::LineString)[_1 = _type(_val)]
linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)]
<< lit("d=\"") << svg_path << lit("\"")
;
polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)]
polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)]
<< lit("d=\"") << svg_path << lit("\"")
;

View file

@ -27,14 +27,10 @@
#include <mapnik/global.hpp>
#include <mapnik/geometry.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
// stl
#include <vector>
#include <cstdio>
#include <memory>
namespace mapnik { namespace util {
@ -137,17 +133,17 @@ struct wkb_buffer
char * data_;
};
typedef boost::shared_ptr<wkb_buffer> wkb_buffer_ptr;
typedef std::unique_ptr<wkb_buffer> wkb_buffer_ptr;
template<typename GeometryType>
wkb_buffer_ptr to_point_wkb( GeometryType const& g, wkbByteOrder byte_order)
{
assert(g.size() == 1);
std::size_t size = 1 + 4 + 8*2 ; // byteOrder + wkbType + Point
wkb_buffer_ptr wkb = boost::make_shared<wkb_buffer>(size);
wkb_buffer_ptr wkb(new wkb_buffer(size));
wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1);
int type = static_cast<int>(mapnik::Point);
int type = static_cast<int>(mapnik::geometry_type::types::Point);
write(ss,type,4,byte_order);
double x = 0;
double y = 0;
@ -155,7 +151,7 @@ wkb_buffer_ptr to_point_wkb( GeometryType const& g, wkbByteOrder byte_order)
write(ss,x,8,byte_order);
write(ss,y,8,byte_order);
assert(ss.good());
return wkb;
return std::move(wkb);
}
template<typename GeometryType>
@ -164,10 +160,10 @@ wkb_buffer_ptr to_line_string_wkb( GeometryType const& g, wkbByteOrder byte_orde
unsigned num_points = g.size();
assert(num_points > 1);
std::size_t size = 1 + 4 + 4 + 8*2*num_points ; // byteOrder + wkbType + numPoints + Point*numPoints
wkb_buffer_ptr wkb = boost::make_shared<wkb_buffer>(size);
wkb_buffer_ptr wkb(new wkb_buffer(size));
wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1);
int type = static_cast<int>(mapnik::LineString);
int type = static_cast<int>(mapnik::geometry_type::types::LineString);
write(ss,type,4,byte_order);
write(ss,num_points,4,byte_order);
double x = 0;
@ -179,7 +175,7 @@ wkb_buffer_ptr to_line_string_wkb( GeometryType const& g, wkbByteOrder byte_orde
write(ss,y,8,byte_order);
}
assert(ss.good());
return wkb;
return std::move(wkb);
}
template<typename GeometryType>
@ -212,18 +208,18 @@ wkb_buffer_ptr to_polygon_wkb( GeometryType const& g, wkbByteOrder byte_order)
}
}
unsigned num_rings = rings.size();
wkb_buffer_ptr wkb = boost::make_shared<wkb_buffer>(size);
wkb_buffer_ptr wkb(new wkb_buffer(size));
wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1);
int type = static_cast<int>(mapnik::Polygon);
int type = static_cast<int>(mapnik::geometry_type::types::Polygon);
write(ss,type,4,byte_order);
write(ss,num_rings,4,byte_order);
BOOST_FOREACH ( linear_ring const& ring, rings)
for ( linear_ring const& ring : rings)
{
unsigned num_ring_points = ring.size();
write(ss,num_ring_points,4,byte_order);
BOOST_FOREACH ( point_type const& pt, ring)
for ( point_type const& pt : ring)
{
write(ss,pt.first,8,byte_order);
write(ss,pt.second,8,byte_order);
@ -231,7 +227,7 @@ wkb_buffer_ptr to_polygon_wkb( GeometryType const& g, wkbByteOrder byte_order)
}
assert(ss.good());
return wkb;
return std::move(wkb);
}
template<typename GeometryType>
@ -241,13 +237,13 @@ wkb_buffer_ptr to_wkb(GeometryType const& g, wkbByteOrder byte_order )
switch (g.type())
{
case mapnik::Point:
case mapnik::geometry_type::types::Point:
wkb = to_point_wkb(g, byte_order);
break;
case mapnik::LineString:
case mapnik::geometry_type::types::LineString:
wkb = to_line_string_wkb(g, byte_order);
break;
case mapnik::Polygon:
case mapnik::geometry_type::types::Polygon:
wkb = to_polygon_wkb(g, byte_order);
break;
default:
@ -281,21 +277,21 @@ wkb_buffer_ptr to_wkb(geometry_container const& paths, wkbByteOrder byte_order )
if (multi_type > 0 && multi_type != itr->type())
collection = true;
multi_type = type;
wkb_cont.push_back(wkb);
wkb_cont.push_back(std::move(wkb));
}
wkb_buffer_ptr multi_wkb = boost::make_shared<wkb_buffer>(multi_size);
wkb_buffer_ptr multi_wkb( new wkb_buffer(multi_size));
wkb_stream ss(multi_wkb->buffer(), multi_wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1);
multi_type = collection ? 7 : multi_type + 3;
write(ss,multi_type, 4, byte_order);
write(ss,paths.size(),4,byte_order);
BOOST_FOREACH ( wkb_buffer_ptr const& wkb, wkb_cont)
for ( wkb_buffer_ptr const& wkb : wkb_cont)
{
ss.write(wkb->buffer(),wkb->size());
}
return multi_wkb;
return std::move(multi_wkb);
}
return wkb_buffer_ptr();

View file

@ -39,8 +39,6 @@
#include <boost/fusion/include/boost_tuple.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/math/special_functions/trunc.hpp> // trunc to avoid needing C++11
namespace boost { namespace spirit { namespace traits {
// make gcc and darwin toolsets happy.
@ -148,9 +146,8 @@ struct wkt_coordinate_policy : karma::real_policies<T>
static unsigned precision(T n)
{
if (n == 0.0) return 0;
return 6;
//using namespace boost::spirit; // for traits
//return std::max(6u, static_cast<unsigned>(15 - boost::math::trunc(log10(traits::get_absolute_value(n)))));
using namespace boost::spirit;
return static_cast<unsigned>(14 - std::trunc(std::log10(traits::get_absolute_value(n))));
}
template <typename OutputIterator>

View file

@ -34,7 +34,7 @@
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/variant.hpp>
#include <boost/scoped_array.hpp>
#include <boost/concept_check.hpp>
#include <boost/functional/hash.hpp>
#include "hash_variant.hpp"
@ -47,7 +47,6 @@
#include <unicode/unistr.h>
#include <unicode/ustring.h>
namespace mapnik {
inline void to_utf8(mapnik::value_unicode_string const& input, std::string & target)
@ -62,7 +61,7 @@ inline void to_utf8(mapnik::value_unicode_string const& input, std::string & tar
u_strToUTF8(buf, BUF_SIZE, &len, input.getBuffer(), input.length(), &err);
if (err == U_BUFFER_OVERFLOW_ERROR || err == U_STRING_NOT_TERMINATED_WARNING )
{
boost::scoped_array<char> buf_ptr(new char [len+1]);
const std::unique_ptr<char[]> buf_ptr(new char [len+1]);
err = U_ZERO_ERROR;
u_strToUTF8(buf_ptr.get() , len + 1, &len, input.getBuffer(), input.length(), &err);
target.assign(buf_ptr.get() , static_cast<std::size_t>(len));
@ -183,8 +182,9 @@ struct not_equals
// back compatibility shim to equate empty string with null for != test
// https://github.com/mapnik/mapnik/issues/1859
// TODO - consider removing entire specialization at Mapnik 3.x
bool operator() (value_null /*lhs*/, value_unicode_string const& rhs) const
bool operator() (value_null lhs, value_unicode_string const& rhs) const
{
boost::ignore_unused_variable_warning(lhs);
if (rhs.isEmpty()) return false;
return true;
}
@ -811,7 +811,7 @@ class value
friend const value operator%(value const&,value const&);
public:
value ()
value () noexcept //-- comment out for VC++11
: base_(value_null()) {}
value(value_integer val)
@ -840,6 +840,9 @@ public:
return *this;
}
value( value && other) noexcept
: base_(std::move(other.base_)) {}
bool operator==(value const& other) const
{
return boost::apply_visitor(impl::equals(),base_,other.base_);

View file

@ -46,6 +46,7 @@
#include <mapnik/offset_converter.hpp>
#include <mapnik/simplify_converter.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/polygon_clipper.hpp>
// agg
#include "agg_conv_clip_polygon.h"
@ -80,7 +81,7 @@ struct converter_traits
typedef T0 geometry_type;
typedef geometry_type conv_type;
template <typename Args>
static void setup(geometry_type & /*geom*/, Args const& /*args*/)
static void setup(geometry_type & , Args const& )
{
throw std::runtime_error("invalid call to setup");
}
@ -175,12 +176,12 @@ template <typename T>
struct converter_traits<T,mapnik::clip_poly_tag>
{
typedef T geometry_type;
typedef typename agg::conv_clip_polygon<geometry_type> conv_type;
typedef mapnik::polygon_clipper<geometry_type> conv_type;
template <typename Args>
static void setup(geometry_type & geom, Args const& args)
{
typename boost::mpl::at<Args,boost::mpl::int_<0> >::type box = boost::fusion::at_c<0>(args);
geom.clip_box(box.minx(),box.miny(),box.maxx(),box.maxy());
geom.set_clip_box(box);
}
};
@ -190,7 +191,7 @@ struct converter_traits<T,mapnik::close_poly_tag>
typedef T geometry_type;
typedef typename agg::conv_close_polygon<geometry_type> conv_type;
template <typename Args>
static void setup(geometry_type & /*geom*/, Args const& /*args*/)
static void setup(geometry_type & , Args const&)
{
// no-op
}
@ -265,7 +266,7 @@ template <>
struct converter_fwd<true>
{
template <typename Base, typename T0,typename T1,typename T2, typename Iter,typename End>
static void forward(Base& base, T0 & geom,T1 const& /*args*/)
static void forward(Base& base, T0 & geom,T1 const& args)
{
base.template dispatch<Iter,End>(geom, typename boost::is_same<Iter,End>::type());
}

View file

@ -55,7 +55,7 @@ public:
// required for iterators support
typedef boost::tuple<unsigned,coord_type,coord_type> value_type;
typedef std::size_t size_type;
typedef unsigned char command_size;
typedef std::uint8_t command_size;
private:
unsigned num_blocks_;
unsigned max_blocks_;

View file

@ -34,7 +34,7 @@
#include <string>
// boost
#include <boost/scoped_array.hpp>
namespace mapnik {

View file

@ -31,7 +31,7 @@
// boost
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/version.hpp>
// stl
@ -50,7 +50,7 @@ public:
wkt_parser();
bool parse(std::string const& wkt, boost::ptr_vector<geometry_type> & paths);
private:
boost::scoped_ptr<mapnik::wkt::wkt_collection_grammar<iterator_type> > grammar_;
const std::unique_ptr<mapnik::wkt::wkt_collection_grammar<iterator_type> > grammar_;
};
#endif

View file

@ -113,7 +113,7 @@ namespace mapnik { namespace wkt {
;
// <point tagged text> ::= point <point text>
point_tagged_text = no_case[lit("POINT")] [ _a = new_<geometry_type>(Point) ]
point_tagged_text = no_case[lit("POINT")] [ _a = new_<geometry_type>(geometry_type::types::Point) ]
>> ( point_text(_a) [push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
@ -124,7 +124,7 @@ namespace mapnik { namespace wkt {
;
// <linestring tagged text> ::= linestring <linestring text>
linestring_tagged_text = no_case[lit("LINESTRING")] [ _a = new_<geometry_type>(LineString) ]
linestring_tagged_text = no_case[lit("LINESTRING")] [ _a = new_<geometry_type>(geometry_type::types::LineString) ]
>> (linestring_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
@ -134,7 +134,7 @@ namespace mapnik { namespace wkt {
;
// <polygon tagged text> ::= polygon <polygon text>
polygon_tagged_text = no_case[lit("POLYGON")] [ _a = new_<geometry_type>(Polygon) ]
polygon_tagged_text = no_case[lit("POLYGON")] [ _a = new_<geometry_type>(geometry_type::types::Polygon) ]
>> ( polygon_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
@ -150,7 +150,7 @@ namespace mapnik { namespace wkt {
// <multipoint text> ::= <empty set> | <left paren> <point text> {<comma> <point text>}* <right paren>
multipoint_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(Point)]
>> ((eps[_a = new_<geometry_type>(geometry_type::types::Point)]
>> (point_text(_a) | empty_set) [push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]) % lit(','))
>> lit(')')) | empty_set
@ -162,7 +162,7 @@ namespace mapnik { namespace wkt {
// <multilinestring text> ::= <empty set> | <left paren> <linestring text> {<comma> <linestring text>}* <right paren>
multilinestring_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(LineString)]
>> ((eps[_a = new_<geometry_type>(geometry_type::types::LineString)]
>> ( points(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]))
% lit(','))
@ -175,7 +175,7 @@ namespace mapnik { namespace wkt {
// <multipolygon text> ::= <empty set> | <left paren> <polygon text> {<comma> <polygon text>}* <right paren>
multipolygon_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(Polygon)]
>> ((eps[_a = new_<geometry_type>(geometry_type::types::Polygon)]
>> ( polygon_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]))
% lit(','))

View file

@ -73,7 +73,7 @@ csv_datasource::csv_datasource(parameters const& params)
manual_headers_(mapnik::util::trim_copy(*params.get<std::string>("headers", ""))),
strict_(*params.get<mapnik::boolean>("strict", false)),
filesize_max_(*params.get<double>("filesize_max", 20.0)), // MB
ctx_(boost::make_shared<mapnik::context_type>())
ctx_(std::make_shared<mapnik::context_type>())
{
/* TODO:
general:
@ -773,7 +773,7 @@ void csv_datasource::parse_csv(T & stream,
{
if (parsed_x && parsed_y)
{
mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point);
mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::geometry_type::types::Point);
pt->move_to(x,y);
feature->add_geometry(pt);
features_.push_back(feature);
@ -938,7 +938,7 @@ mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const
}
++pos;
}
return boost::make_shared<mapnik::memory_featureset>(q.get_bbox(),features_);
return std::make_shared<mapnik::memory_featureset>(q.get_bbox(),features_);
}
mapnik::featureset_ptr csv_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const

View file

@ -217,7 +217,7 @@ featureset_ptr gdal_datasource::features(query const& q) const
gdal_query gq = q;
// TODO - move to boost::make_shared, but must reduce # of args to <= 9
// TODO - move to std::make_shared, but must reduce # of args to <= 9
return featureset_ptr(new gdal_featureset(*open_dataset(),
band_,
gq,
@ -238,7 +238,7 @@ featureset_ptr gdal_datasource::features_at_point(coord2d const& pt, double tol)
gdal_query gq = pt;
// TODO - move to boost::make_shared, but must reduce # of args to <= 9
// TODO - move to std::make_shared, but must reduce # of args to <= 9
return featureset_ptr(new gdal_featureset(*open_dataset(),
band_,
gq,

View file

@ -63,7 +63,7 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset,
double dy,
boost::optional<double> const& nodata)
: dataset_(dataset),
ctx_(boost::make_shared<mapnik::context_type>()),
ctx_(std::make_shared<mapnik::context_type>()),
band_(band),
gquery_(q),
raster_extent_(extent),
@ -215,7 +215,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
if (im_width > 0 && im_height > 0)
{
mapnik::raster_ptr raster = boost::make_shared<mapnik::raster>(intersect, im_width, im_height);
mapnik::raster_ptr raster = std::make_shared<mapnik::raster>(intersect, im_width, im_height);
feature->set_raster(raster);
mapnik::image_data_32 & image = raster->data_;
image.set(0xffffffff);
@ -523,7 +523,7 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt)
{
// construct feature
feature_ptr feature = feature_factory::create(ctx_,1);
geometry_type * point = new geometry_type(mapnik::Point);
geometry_type * point = new geometry_type(mapnik::geometry_type::types::Point);
point->move_to(pt.x, pt.y);
feature->add_geometry(point);
feature->put("value",value);

View file

@ -31,7 +31,7 @@
#include <boost/make_shared.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/spirit/include/support_multi_pass.hpp>
#include <boost/foreach.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry.hpp>
@ -130,7 +130,7 @@ geojson_datasource::geojson_datasource(parameters const& params)
boost::spirit::multi_pass<base_iterator_type> end =
boost::spirit::make_default_multi_pass(base_iterator_type());
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
mapnik::json::feature_collection_parser<boost::spirit::multi_pass<base_iterator_type> > p(ctx,*tr_);
bool result = p.parse(begin,end, features_);
if (!result)
@ -140,7 +140,7 @@ geojson_datasource::geojson_datasource(parameters const& params)
bool first = true;
std::size_t count=0;
BOOST_FOREACH (mapnik::feature_ptr f, features_)
for (mapnik::feature_ptr f : features_)
{
mapnik::box2d<double> const& box = f->envelope();
if (first)
@ -215,7 +215,7 @@ mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) cons
{
box_type box(point_type(b.minx(),b.miny()),point_type(b.maxx(),b.maxy()));
index_array_ = tree_.find(box);
return boost::make_shared<geojson_featureset>(features_, index_array_.begin(), index_array_.end());
return std::make_shared<geojson_featureset>(features_, index_array_.begin(), index_array_.end());
}
// otherwise return an empty featureset pointer
return mapnik::featureset_ptr();

View file

@ -35,7 +35,7 @@
// boost
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/algorithms/area.hpp>
@ -71,7 +71,7 @@ private:
mapnik::layer_descriptor desc_;
std::string file_;
mapnik::box2d<double> extent_;
boost::shared_ptr<mapnik::transcoder> tr_;
std::shared_ptr<mapnik::transcoder> tr_;
std::vector<mapnik::feature_ptr> features_;
spatial_index_type tree_;
mutable std::deque<std::size_t> index_array_;

View file

@ -523,7 +523,7 @@ featureset_ptr occi_datasource::features(query const& q) const
std::set<std::string> const& props = q.property_names();
std::set<std::string>::const_iterator pos = props.begin();
std::set<std::string>::const_iterator end = props.end();
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
for (; pos != end; ++pos)
{
s << ", " << *pos;
@ -562,7 +562,7 @@ featureset_ptr occi_datasource::features(query const& q) const
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
return boost::make_shared<occi_featureset>(pool_,
return std::make_shared<occi_featureset>(pool_,
conn_,
ctx,
s.str(),
@ -590,7 +590,7 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt, double tol)
}
std::vector<attribute_descriptor>::const_iterator itr = desc_.get_descriptors().begin();
std::vector<attribute_descriptor>::const_iterator end = desc_.get_descriptors().end();
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
while (itr != end)
{
s << ", " << itr->get_name();
@ -631,7 +631,7 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt, double tol)
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
return boost::make_shared<occi_featureset>(pool_,
return std::make_shared<occi_featureset>(pool_,
conn_,
ctx,
s.str(),

View file

@ -35,7 +35,7 @@
// boost
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
// stl
#include <vector>

View file

@ -122,7 +122,7 @@ feature_ptr occi_featureset::next()
}
else
{
boost::scoped_ptr<SDOGeometry> geom(dynamic_cast<SDOGeometry*>(rs_->getObject(1)));
const std::unique_ptr<SDOGeometry> geom(dynamic_cast<SDOGeometry*>(rs_->getObject(1)));
if (geom.get())
{
convert_geometry(geom.get(), feature);
@ -377,7 +377,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
}
void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
const mapnik::eGeomType& geom_type,
const mapnik::geometry::types& geom_type,
const std::vector<Number>& elem_info,
const std::vector<Number>& ordinates,
const int dimensions,
@ -404,7 +404,7 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
int next_interp = elem_info[i + 2];
bool is_linear_element = true;
bool is_unknown_etype = false;
mapnik::eGeomType gtype = mapnik::Point;
mapnik::geometry::types gtype = mapnik::Point;
switch (etype)
{

View file

@ -30,8 +30,8 @@
#include <mapnik/unicode.hpp>
// boost
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
// oci
#include "occi_types.hpp"
@ -55,7 +55,7 @@ public:
private:
void convert_geometry (SDOGeometry* geom, mapnik::feature_ptr feature);
void convert_ordinates (mapnik::feature_ptr feature,
const mapnik::eGeomType& geom_type,
const mapnik::geometry::types& geom_type,
const std::vector<oracle::occi::Number>& elem_info,
const std::vector<oracle::occi::Number>& ordinates,
const int dimensions,
@ -70,7 +70,7 @@ private:
occi_connection_ptr conn_;
oracle::occi::ResultSet* rs_;
boost::scoped_ptr<mapnik::transcoder> tr_;
const std::unique_ptr<mapnik::transcoder> tr_;
mapnik::value_integer feature_id_;
mapnik::context_ptr ctx_;
bool use_wkb_;

View file

@ -79,21 +79,21 @@ void ogr_converter::convert_geometry(OGRGeometry* geom, feature_ptr feature)
void ogr_converter::convert_point(OGRPoint* geom, feature_ptr feature)
{
std::auto_ptr<geometry_type> point(new geometry_type(mapnik::Point));
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::geometry_type::types::Point));
point->move_to(geom->getX(), geom->getY());
feature->paths().push_back(point);
feature->paths().push_back(point.release());
}
void ogr_converter::convert_linestring(OGRLineString* geom, feature_ptr feature)
{
int num_points = geom->getNumPoints();
std::auto_ptr<geometry_type> line(new geometry_type(mapnik::LineString));
std::unique_ptr<geometry_type> line(new geometry_type(mapnik::geometry_type::types::LineString));
line->move_to(geom->getX(0), geom->getY(0));
for (int i = 1; i < num_points; ++i)
{
line->line_to (geom->getX(i), geom->getY(i));
}
feature->paths().push_back(line);
feature->paths().push_back(line.release());
}
void ogr_converter::convert_polygon(OGRPolygon* geom, feature_ptr feature)
@ -108,7 +108,7 @@ void ogr_converter::convert_polygon(OGRPolygon* geom, feature_ptr feature)
capacity += interior->getNumPoints();
}
std::auto_ptr<geometry_type> poly(new geometry_type(mapnik::Polygon));
std::unique_ptr<geometry_type> poly(new geometry_type(mapnik::geometry_type::types::Polygon));
poly->move_to(exterior->getX(0), exterior->getY(0));
for (int i = 1; i < num_points; ++i)
@ -127,7 +127,7 @@ void ogr_converter::convert_polygon(OGRPolygon* geom, feature_ptr feature)
}
poly->close_path();
}
feature->paths().push_back(poly);
feature->paths().push_back(poly.release());
}
void ogr_converter::convert_multipoint(OGRMultiPoint* geom, feature_ptr feature)

View file

@ -478,7 +478,7 @@ featureset_ptr ogr_datasource::features(query const& q) const
std::vector<attribute_descriptor> const& desc_ar = desc_.get_descriptors();
// feature context (schema)
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
std::vector<attribute_descriptor>::const_iterator itr = desc_ar.begin();
std::vector<attribute_descriptor>::const_iterator end = desc_ar.end();
@ -521,7 +521,7 @@ featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol)
{
std::vector<attribute_descriptor> const& desc_ar = desc_.get_descriptors();
// feature context (schema)
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
std::vector<attribute_descriptor>::const_iterator itr = desc_ar.begin();
std::vector<attribute_descriptor>::const_iterator end = desc_ar.end();

Some files were not shown because too many files have changed in this diff Show more