diff --git a/SConstruct b/SConstruct index 08c403c10..f94286920 100644 --- a/SConstruct +++ b/SConstruct @@ -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,13 +1686,12 @@ 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 - # https://github.com/mapnik/mapnik/issues/1970 - if 'clang++' in env['CXX']: - env.Append(CXXFLAGS = '-Wno-c++11-narrowing') + env.Append(CPPDEFINES = '-DBOOST_SPIRIT_USE_PHOENIX_V3=1') + # - workaround boost gil channel_algorithm.hpp narrowing error + # TODO - remove when building against >= 1.55 + # https://github.com/mapnik/mapnik/issues/1970 + if 'clang++' in env['CXX']: + env.Append(CXXFLAGS = '-Wno-c++11-narrowing') # Enable logging in debug mode (always) and release mode (when specified) if env['DEFAULT_LOG_SEVERITY']: diff --git a/benchmark/run.cpp b/benchmark/run.cpp index 29b4ba235..03ab9e5f7 100644 --- a/benchmark/run.cpp +++ b/benchmark/run.cpp @@ -16,7 +16,7 @@ // boost #include -#include +#include #include #include @@ -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 reader1(mapnik::get_image_reader(dest_fn,"png")); + std::unique_ptr 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_ptr1 = boost::make_shared(reader1->width(),reader1->height()); + std::shared_ptr image_ptr1 = std::make_shared(reader1->width(),reader1->height()); reader1->read(0,0,image_ptr1->data()); - std::auto_ptr reader2(mapnik::get_image_reader(src_fn,"png")); + std::unique_ptr 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_ptr2 = boost::make_shared(reader2->width(),reader2->height()); + std::shared_ptr image_ptr2 = std::make_shared(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 im_; + std::shared_ptr im_; explicit test2(unsigned iterations, unsigned threads=0) : iter_(iterations), threads_(threads), im_() { std::string filename("./benchmark/data/multicolor.png"); - std::auto_ptr reader(mapnik::get_image_reader(filename,"png")); + std::unique_ptr reader(mapnik::get_image_reader(filename,"png")); if (!reader.get()) { throw mapnik::image_reader_exception("Failed to load: " + filename); } - im_ = boost::make_shared(reader->width(),reader->height()); + im_ = std::make_shared(reader->width(),reader->height()); reader->read(0,0,im_->data()); } @@ -450,7 +450,7 @@ struct test11 ps.close_polygon(); for (unsigned i=0;i create_datasource(dict const& d) +std::shared_ptr create_datasource(dict const& d) { mapnik::parameters params; boost::python::list keys=d.keys(); @@ -92,7 +92,7 @@ boost::shared_ptr create_datasource(dict const& d) return mapnik::datasource_cache::instance().create(params); } -boost::python::dict describe(boost::shared_ptr const& ds) +boost::python::dict describe(std::shared_ptr const& ds) { boost::python::dict description; mapnik::layer_descriptor ld = ds->get_descriptor(); @@ -103,7 +103,7 @@ boost::python::dict describe(boost::shared_ptr const& ds) return description; } -boost::python::list fields(boost::shared_ptr const& ds) +boost::python::list fields(std::shared_ptr const& ds) { boost::python::list flds; if (ds) @@ -119,7 +119,7 @@ boost::python::list fields(boost::shared_ptr const& ds) } return flds; } -boost::python::list field_types(boost::shared_ptr const& ds) +boost::python::list field_types(std::shared_ptr const& ds) { boost::python::list fld_types; if (ds) @@ -173,7 +173,7 @@ void export_datasource() .value("Collection",mapnik::datasource::Collection) ; - class_, + class_, boost::noncopyable>("Datasource",no_init) .def("type",&datasource::type) .def("geometry_type",&datasource::get_geometry_type) diff --git a/bindings/python/mapnik_datasource_cache.cpp b/bindings/python/mapnik_datasource_cache.cpp index f0230f80b..0ed03fc17 100644 --- a/bindings/python/mapnik_datasource_cache.cpp +++ b/bindings/python/mapnik_datasource_cache.cpp @@ -29,7 +29,7 @@ namespace { using namespace boost::python; -boost::shared_ptr create_datasource(const dict& d) +std::shared_ptr create_datasource(const dict& d) { mapnik::parameters params; boost::python::list keys=d.keys(); diff --git a/bindings/python/mapnik_feature.cpp b/bindings/python/mapnik_feature.cpp index d1e7fc272..057d9465e 100644 --- a/bindings/python/mapnik_feature.cpp +++ b/bindings/python/mapnik_feature.cpp @@ -228,7 +228,7 @@ void export_feature() .def("push", &context_type::push) ; - class_, + class_, boost::noncopyable>("Feature",init("Default ctor.")) .def("id",&mapnik::feature_impl::id) .def("__str__",&mapnik::feature_impl::to_string) diff --git a/bindings/python/mapnik_featureset.cpp b/bindings/python/mapnik_featureset.cpp index c1f7eecd4..eadb2b7df 100644 --- a/bindings/python/mapnik_featureset.cpp +++ b/bindings/python/mapnik_featureset.cpp @@ -65,7 +65,7 @@ inline mapnik::feature_ptr next(mapnik::featureset_ptr const& itr) void export_featureset() { using namespace boost::python; - class_, + class_, boost::noncopyable>("Featureset",no_init) .def("__iter__",pass_through) .def("next",next) diff --git a/bindings/python/mapnik_geometry.cpp b/bindings/python/mapnik_geometry.cpp index 8eeafc49f..6e5127f39 100644 --- a/bindings/python/mapnik_geometry.cpp +++ b/bindings/python/mapnik_geometry.cpp @@ -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 from_wkt_impl(std::string const& wkt) +std::shared_ptr from_wkt_impl(std::string const& wkt) { - boost::shared_ptr paths = boost::make_shared(); + std::shared_ptr paths = std::make_shared(); if (!mapnik::from_wkt(wkt, *paths)) throw std::runtime_error("Failed to parse WKT"); return paths; } -boost::shared_ptr from_wkb_impl(std::string const& wkb) +std::shared_ptr from_wkb_impl(std::string const& wkb) { - boost::shared_ptr paths = boost::make_shared(); + std::shared_ptr paths = std::make_shared(); 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 from_geojson_impl(std::string const& json) +std::shared_ptr from_geojson_impl(std::string const& json) { - boost::shared_ptr paths = boost::make_shared(); + std::shared_ptr paths = std::make_shared(); if (! mapnik::json::from_geojson(json, *paths)) throw std::runtime_error("Failed to parse geojson geometry"); return paths; @@ -107,7 +107,7 @@ mapnik::box2d envelope_impl(path_type & p) { mapnik::box2d 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_("GeometryType") - .value("Point",mapnik::Point) - .value("LineString",mapnik::LineString) - .value("Polygon",mapnik::Polygon) + enum_("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_, boost::noncopyable>("Geometry2d",no_init) + class_, 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_, boost::noncopyable>("Path") + class_, boost::noncopyable>("Path") .def("__getitem__", getitem_impl,return_value_policy()) .def("__len__", &path_type::size) .def("envelope",envelope_impl) diff --git a/bindings/python/mapnik_grid.cpp b/bindings/python/mapnik_grid.cpp index 09b21ee3d..b57b162e0 100644 --- a/bindings/python/mapnik_grid.cpp +++ b/bindings/python/mapnik_grid.cpp @@ -55,7 +55,7 @@ mapnik::grid::value_type get_pixel(mapnik::grid const& grid, int x, int y) void export_grid() { - class_ >( + class_ >( "Grid", "This class represents a feature hitgrid.", init( diff --git a/bindings/python/mapnik_grid_view.cpp b/bindings/python/mapnik_grid_view.cpp index 5e9d2745f..82e687ed2 100644 --- a/bindings/python/mapnik_grid_view.cpp +++ b/bindings/python/mapnik_grid_view.cpp @@ -41,7 +41,7 @@ static dict (*encode)( mapnik::grid_view const&, std::string const& , bool, unsi void export_grid_view() { class_ >("GridView", + std::shared_ptr >("GridView", "This class represents a feature hitgrid subset.",no_init) .def("width",&mapnik::grid_view::width) .def("height",&mapnik::grid_view::height) diff --git a/bindings/python/mapnik_image.cpp b/bindings/python/mapnik_image.cpp index 5b3db5e9e..9379037dc 100644 --- a/bindings/python/mapnik_image.cpp +++ b/bindings/python/mapnik_image.cpp @@ -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 open_from_file(std::string const& filename) +std::shared_ptr open_from_file(std::string const& filename) { boost::optional type = type_from_filename(filename); if (type) { - std::auto_ptr reader(get_image_reader(filename,*type)); + std::unique_ptr reader(get_image_reader(filename,*type)); if (reader.get()) { - boost::shared_ptr image_ptr = boost::make_shared(reader->width(),reader->height()); + std::shared_ptr image_ptr = std::make_shared(reader->width(),reader->height()); reader->read(0,0,image_ptr->data()); return image_ptr; } @@ -164,28 +164,28 @@ boost::shared_ptr open_from_file(std::string const& filename) throw mapnik::image_reader_exception("Unsupported image format:" + filename); } -boost::shared_ptr fromstring(std::string const& str) +std::shared_ptr fromstring(std::string const& str) { - std::auto_ptr reader(get_image_reader(str.c_str(),str.size())); + std::unique_ptr reader(get_image_reader(str.c_str(),str.size())); if (reader.get()) { - boost::shared_ptr image_ptr = boost::make_shared(reader->width(),reader->height()); + std::shared_ptr image_ptr = std::make_shared(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 frombuffer(PyObject * obj) +std::shared_ptr frombuffer(PyObject * obj) { void const* buffer=0; Py_ssize_t buffer_len; if (PyObject_AsReadBuffer(obj, &buffer, &buffer_len) == 0) { - std::auto_ptr reader(get_image_reader(reinterpret_cast(buffer),buffer_len)); + std::unique_ptr reader(get_image_reader(reinterpret_cast(buffer),buffer_len)); if (reader.get()) { - boost::shared_ptr image_ptr = boost::make_shared(reader->width(),reader->height()); + std::shared_ptr image_ptr = std::make_shared(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 from_cairo(PycairoSurface* py_surface) +std::shared_ptr from_cairo(PycairoSurface* py_surface) { mapnik::cairo_surface_ptr surface(py_surface->surface, mapnik::cairo_surface_closer()); - boost::shared_ptr image_ptr = boost::make_shared(surface); + std::shared_ptr image_ptr = std::make_shared(surface); return image_ptr; } #endif @@ -253,7 +253,7 @@ void export_image() .value("value", mapnik::_value) ; - class_ >("Image","This class represents a 32 bit RGBA image.",init()) + class_ >("Image","This class represents a 32 bit RGBA image.",init()) .def("width",&image_32::width) .def("height",&image_32::height) .def("view",&image_32::get_view) diff --git a/bindings/python/mapnik_label_collision_detector.cpp b/bindings/python/mapnik_label_collision_detector.cpp index 55747e41f..e3b047d89 100644 --- a/bindings/python/mapnik_label_collision_detector.cpp +++ b/bindings/python/mapnik_label_collision_detector.cpp @@ -35,27 +35,26 @@ using mapnik::label_collision_detector4; using mapnik::box2d; using mapnik::Map; -using boost::make_shared; namespace { -boost::shared_ptr +std::shared_ptr create_label_collision_detector_from_extent(box2d const &extent) { - return make_shared(extent); + return std::make_shared(extent); } -boost::shared_ptr +std::shared_ptr create_label_collision_detector_from_map(Map const &m) { double buffer = m.buffer_size(); box2d extent(-buffer, -buffer, m.width() + buffer, m.height() + buffer); - return make_shared(extent); + return std::make_shared(extent); } boost::python::list -make_label_boxes(boost::shared_ptr det) +make_label_boxes(std::shared_ptr det) { boost::python::list boxes; @@ -77,7 +76,7 @@ void export_label_collision_detector() // for overload resolution void (label_collision_detector4::*insert_box)(box2d const &) = &label_collision_detector4::insert; - class_, boost::noncopyable> + class_, boost::noncopyable> ("LabelCollisionDetector", "Object to detect collisions between labels, used in the rendering process.", no_init) diff --git a/bindings/python/mapnik_palette.cpp b/bindings/python/mapnik_palette.cpp index d28f081c8..203694768 100644 --- a/bindings/python/mapnik_palette.cpp +++ b/bindings/python/mapnik_palette.cpp @@ -31,7 +31,7 @@ // stl #include -static boost::shared_ptr make_palette( std::string const& palette, std::string const& format ) +static std::shared_ptr 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 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(palette, type); + return std::make_shared(palette, type); } void export_palette () @@ -48,7 +48,7 @@ void export_palette () using namespace boost::python; class_, + std::shared_ptr, boost::noncopyable >("Palette",no_init) //, init( // ( arg("palette"), arg("type")), diff --git a/bindings/python/mapnik_parameters.cpp b/bindings/python/mapnik_parameters.cpp index eb213e2d1..2a8884374 100644 --- a/bindings/python/mapnik_parameters.cpp +++ b/bindings/python/mapnik_parameters.cpp @@ -176,22 +176,22 @@ mapnik::value_holder get_param(mapnik::parameter const& p, int index) } } -boost::shared_ptr create_parameter(mapnik::value_unicode_string const& key, mapnik::value_holder const& value) +std::shared_ptr 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(key_utf8,value); + return std::make_shared(key_utf8,value); } // needed for Python_Unicode to std::string (utf8) conversion -boost::shared_ptr create_parameter_from_string(mapnik::value_unicode_string const& key, mapnik::value_unicode_string const& ustr) +std::shared_ptr 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(key_utf8, ustr_utf8); + return std::make_shared(key_utf8, ustr_utf8); } void export_parameters() @@ -202,7 +202,7 @@ void export_parameters() implicitly_convertible(); implicitly_convertible(); - class_ >("Parameter",no_init) + class_ >("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") diff --git a/bindings/python/mapnik_python.cpp b/bindings/python/mapnik_python.cpp index 7a97867f2..b932a98d0 100644 --- a/bindings/python/mapnik_python.cpp +++ b/bindings/python/mapnik_python.cpp @@ -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 detector, + std::shared_ptr 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 detector) + std::shared_ptr 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 detector, + std::shared_ptr 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 detector) + std::shared_ptr 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 detector, + std::shared_ptr detector, double scale_factor = 1.0, unsigned offset_x = 0u, unsigned offset_y = 0u) diff --git a/bindings/python/mapnik_query.cpp b/bindings/python/mapnik_query.cpp index 3c6138a23..a991f2e12 100644 --- a/bindings/python/mapnik_query.cpp +++ b/bindings/python/mapnik_query.cpp @@ -22,7 +22,7 @@ // boost #include -#include + // mapnik #include @@ -55,7 +55,7 @@ struct names_to_list static PyObject* convert(std::set 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()) ) .def("add_property_name", &query::add_property_name); } - - - diff --git a/bindings/python/mapnik_style.cpp b/bindings/python/mapnik_style.cpp index 7eb9e449b..cbf032bf3 100644 --- a/bindings/python/mapnik_style.cpp +++ b/bindings/python/mapnik_style.cpp @@ -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 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() diff --git a/bindings/python/mapnik_text_placement.cpp b/bindings/python/mapnik_text_placement.cpp index c2b08eb50..deaae18bb 100644 --- a/bindings/python/mapnik_text_placement.cpp +++ b/bindings/python/mapnik_text_placement.cpp @@ -432,17 +432,17 @@ void export_text_placement() ; class_, + std::shared_ptr, 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 >(); + register_ptr_to_python >(); class_, + std::shared_ptr, boost::noncopyable> ("TextPlacementInfo", init()) @@ -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 >(); + register_ptr_to_python >(); class_, + std::shared_ptr, boost::noncopyable> ("ProcessedText", no_init) .def("push_back", &processed_text::push_back) @@ -466,7 +466,7 @@ void export_text_placement() class_, + std::shared_ptr, boost::noncopyable> ("ExpressionSet") .def("insert", &insert_expression); @@ -475,7 +475,7 @@ void export_text_placement() //TODO: Python namespace class_, + std::shared_ptr, 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 >(); + register_ptr_to_python >(); class_, + std::shared_ptr, bases, boost::noncopyable> ("FormattingText", init()) @@ -497,11 +497,11 @@ void export_text_placement() &formatting::text_node::get_text, &formatting::text_node::set_text) ; - register_ptr_to_python >(); + register_ptr_to_python >(); class_with_converter, + std::shared_ptr, bases, 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 >(); + register_ptr_to_python >(); class_, + std::shared_ptr, bases, boost::noncopyable> ("FormattingList", init<>()) @@ -538,10 +538,10 @@ void export_text_placement() .def("append", &ListNodeWrap::append) ; - register_ptr_to_python >(); + register_ptr_to_python >(); class_, + std::shared_ptr, bases, 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 >(); + register_ptr_to_python >(); //TODO: registry } diff --git a/bindings/python/mapnik_wkt_reader.cpp b/bindings/python/mapnik_wkt_reader.cpp index 3e9fa9be4..14465a0b9 100644 --- a/bindings/python/mapnik_wkt_reader.cpp +++ b/bindings/python/mapnik_wkt_reader.cpp @@ -23,7 +23,7 @@ // boost #include #include -#include +#include #include #include // mapnik @@ -34,9 +34,9 @@ namespace impl { typedef boost::ptr_vector path_type; -boost::shared_ptr from_wkt(mapnik::wkt_parser & p, std::string const& wkt) +std::shared_ptr from_wkt(mapnik::wkt_parser & p, std::string const& wkt) { - boost::shared_ptr paths = boost::make_shared(); + std::shared_ptr paths = std::make_shared(); if (!p.parse(wkt, *paths)) throw std::runtime_error("Failed to parse WKT"); return paths; diff --git a/bindings/python/python_grid_utils.cpp b/bindings/python/python_grid_utils.cpp index 7e9e1e52f..31e12e7db 100644 --- a/bindings/python/python_grid_utils.cpp +++ b/bindings/python/python_grid_utils.cpp @@ -24,8 +24,6 @@ // boost #include -#include -#include // mapnik #include @@ -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 line(new Py_UNICODE[array_size]); + const std::unique_ptr 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 line(new Py_UNICODE[array_size]); + const std::unique_ptr 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 line(new Py_UNICODE[array_size]); + const std::unique_ptr 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 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); } diff --git a/boost/geometry/extensions/index/rtree/rtree.hpp b/boost/geometry/extensions/index/rtree/rtree.hpp index 372a27d03..2cf579658 100644 --- a/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/boost/geometry/extensions/index/rtree/rtree.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include @@ -32,8 +32,8 @@ class rtree { public: - typedef boost::shared_ptr > node_pointer; - typedef boost::shared_ptr > leaf_pointer; + typedef std::shared_ptr > node_pointer; + typedef std::shared_ptr > 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 - diff --git a/boost/geometry/extensions/index/rtree/rtree_leaf.hpp b/boost/geometry/extensions/index/rtree/rtree_leaf.hpp index 95d1a86b1..733e1819d 100644 --- a/boost/geometry/extensions/index/rtree/rtree_leaf.hpp +++ b/boost/geometry/extensions/index/rtree/rtree_leaf.hpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include @@ -33,7 +33,7 @@ class rtree_leaf : public rtree_node public: /// container type for the leaves - typedef boost::shared_ptr > node_pointer; + typedef std::shared_ptr > node_pointer; typedef std::vector > leaf_map; /** @@ -250,4 +250,3 @@ private: }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_LEAF_HPP - diff --git a/boost/geometry/extensions/index/rtree/rtree_node.hpp b/boost/geometry/extensions/index/rtree/rtree_node.hpp index de35ef270..ec9efad98 100644 --- a/boost/geometry/extensions/index/rtree/rtree_node.hpp +++ b/boost/geometry/extensions/index/rtree/rtree_node.hpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include @@ -37,8 +37,8 @@ class rtree_node { public: - typedef boost::shared_ptr > node_pointer; - typedef boost::shared_ptr > leaf_pointer; + typedef std::shared_ptr > node_pointer; + typedef std::shared_ptr > leaf_pointer; /// type for the node map typedef std::vector > node_map; diff --git a/demo/viewer/layerlistmodel.cpp b/demo/viewer/layerlistmodel.cpp index a85645174..4b1a89a8d 100644 --- a/demo/viewer/layerlistmodel.cpp +++ b/demo/viewer/layerlistmodel.cpp @@ -27,7 +27,7 @@ using mapnik::Map; -LayerListModel::LayerListModel(boost::shared_ptr map,QObject *parent) +LayerListModel::LayerListModel(std::shared_ptr map,QObject *parent) : QAbstractListModel(parent), map_(map) {} @@ -117,8 +117,3 @@ boost::optional LayerListModel::map_layer(int i) } return boost::optional(); } - - - - - diff --git a/demo/viewer/layerlistmodel.hpp b/demo/viewer/layerlistmodel.hpp index 7c155d95e..f25a81f59 100644 --- a/demo/viewer/layerlistmodel.hpp +++ b/demo/viewer/layerlistmodel.hpp @@ -34,7 +34,7 @@ class LayerListModel : public QAbstractListModel { Q_OBJECT public: - LayerListModel(boost::shared_ptr map, QObject * parent = 0); + LayerListModel(std::shared_ptr 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 map_layer(int i); private: - boost::shared_ptr map_; + std::shared_ptr map_; }; #endif //LAYER_LIST_MODEL_HPP diff --git a/demo/viewer/mainwindow.cpp b/demo/viewer/mainwindow.cpp index e87e7a0d4..f2099e4c4 100644 --- a/demo/viewer/mainwindow.cpp +++ b/demo/viewer/mainwindow.cpp @@ -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 map(new mapnik::Map(width,height)); + std::shared_ptr 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 map_ptr = mapWidget_->getMap(); + std::shared_ptr 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 map_ptr = mapWidget_->getMap(); + std::shared_ptr map_ptr = mapWidget_->getMap(); if (map_ptr) { map_ptr->zoom_all(); diff --git a/demo/viewer/mapwidget.cpp b/demo/viewer/mapwidget.cpp index dfe4bd682..9364ac8fe 100644 --- a/demo/viewer/mapwidget.cpp +++ b/demo/viewer/mapwidget.cpp @@ -606,12 +606,12 @@ void MapWidget::updateMap() } } -boost::shared_ptr MapWidget::getMap() +std::shared_ptr MapWidget::getMap() { return map_; } -void MapWidget::setMap(boost::shared_ptr map) +void MapWidget::setMap(std::shared_ptr map) { map_ = map; } diff --git a/demo/viewer/mapwidget.hpp b/demo/viewer/mapwidget.hpp index 11026a546..e3cff1a98 100644 --- a/demo/viewer/mapwidget.hpp +++ b/demo/viewer/mapwidget.hpp @@ -28,8 +28,8 @@ #include #include #include -#include -#include +#include + #ifndef Q_MOC_RUN #include @@ -55,7 +55,7 @@ public: }; private: - boost::shared_ptr map_; + std::shared_ptr map_; int selected_; QPixmap pix_; mapnik::box2d extent_; @@ -73,9 +73,9 @@ private: public: MapWidget(QWidget *parent=0); void setTool(eTool tool); - boost::shared_ptr getMap(); + std::shared_ptr getMap(); inline QPixmap const& pixmap() const { return pix_;} - void setMap(boost::shared_ptr map); + void setMap(std::shared_ptr map); void defaultView(); void zoomToBox(mapnik::box2d const& box); void zoomIn(); diff --git a/demo/viewer/styles_model.cpp b/demo/viewer/styles_model.cpp index 208669ac0..64ec4cc92 100644 --- a/demo/viewer/styles_model.cpp +++ b/demo/viewer/styles_model.cpp @@ -26,7 +26,7 @@ // boost #include -#include + // qt #include #include @@ -114,7 +114,7 @@ public: } private: - boost::scoped_ptr impl_; + const std::unique_ptr impl_; QList children_; node * parent_; }; @@ -199,7 +199,7 @@ struct symbolizer_icon : public boost::static_visitor { // FIXME! /* - boost::shared_ptr symbol = sym.get_image(); + std::shared_ptr 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 map) + explicit map_node(std::shared_ptr map) : map_(map) {} ~map_node() {} @@ -318,10 +318,10 @@ public: } private: - boost::shared_ptr map_; + std::shared_ptr map_; }; -StyleModel::StyleModel(boost::shared_ptr map, QObject * parent) +StyleModel::StyleModel(std::shared_ptr map, QObject * parent) : QAbstractItemModel(parent), root_(new node(map_node(map))) { diff --git a/demo/viewer/styles_model.hpp b/demo/viewer/styles_model.hpp index 5dfb9190f..17af661ed 100644 --- a/demo/viewer/styles_model.hpp +++ b/demo/viewer/styles_model.hpp @@ -27,14 +27,14 @@ #include #endif -#include + class node; class StyleModel : public QAbstractItemModel { Q_OBJECT public: - StyleModel(boost::shared_ptr map, QObject * parent=0); + StyleModel(std::shared_ptr 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 map_; - boost::scoped_ptr root_; + //std::shared_ptr map_; + const std::unique_ptr root_; }; #endif // STYLE_MODEL_HPP diff --git a/include/mapnik/agg_renderer.hpp b/include/mapnik/agg_renderer.hpp index be248ea94..7d29dc856 100644 --- a/include/mapnik/agg_renderer.hpp +++ b/include/mapnik/agg_renderer.hpp @@ -37,8 +37,8 @@ #include // boost -#include -#include + +#include // 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 detector, + agg_renderer(Map const &m, T & pixmap, std::shared_ptr 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 internal_buffer_; + std::shared_ptr 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 font_manager_; - boost::shared_ptr detector_; - boost::scoped_ptr ras_ptr; + std::shared_ptr detector_; + const std::unique_ptr ras_ptr; box2d query_extent_; gamma_method_e gamma_method_; double gamma_; diff --git a/include/mapnik/box2d.hpp b/include/mapnik/box2d.hpp index d37cd81ab..6133ffbe5 100644 --- a/include/mapnik/box2d.hpp +++ b/include/mapnik/box2d.hpp @@ -64,6 +64,7 @@ public: box2d(coord const& c0, coord 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; diff --git a/include/mapnik/cairo_context.hpp b/include/mapnik/cairo_context.hpp index 369edaf94..6c9596255 100644 --- a/include/mapnik/cairo_context.hpp +++ b/include/mapnik/cairo_context.hpp @@ -37,7 +37,7 @@ #include // boost -#include +#include // cairo #include @@ -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 const& engine, face_ptr const& face); + cairo_face(std::shared_ptr const& engine, face_ptr const& face); ~cairo_face(); cairo_font_face_t * face() const; private: class handle { public: - handle(boost::shared_ptr const& engine, face_ptr const& face) + handle(std::shared_ptr const& engine, face_ptr const& face) : engine_(engine), face_(face) {} private: - boost::shared_ptr engine_; + std::shared_ptr engine_; face_ptr face_; }; @@ -104,17 +104,17 @@ private: cairo_font_face_t *c_face_; }; -typedef boost::shared_ptr cairo_face_ptr; +typedef std::shared_ptr cairo_face_ptr; class cairo_face_manager : private mapnik::noncopyable { public: - cairo_face_manager(boost::shared_ptr engine); + cairo_face_manager(std::shared_ptr engine); cairo_face_ptr get_face(face_ptr face); private: typedef std::map cairo_face_cache; - boost::shared_ptr font_engine_; + std::shared_ptr 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 (stop_color.red())/255.0; @@ -268,8 +268,8 @@ struct cairo_surface_closer } }; -typedef boost::shared_ptr cairo_ptr; -typedef boost::shared_ptr cairo_surface_ptr; +typedef std::shared_ptr cairo_ptr; +typedef std::shared_ptr cairo_surface_ptr; inline cairo_ptr create_context(cairo_surface_ptr const& surface) { diff --git a/include/mapnik/cairo_renderer.hpp b/include/mapnik/cairo_renderer.hpp index c2278231d..1d18bcf28 100644 --- a/include/mapnik/cairo_renderer.hpp +++ b/include/mapnik/cairo_renderer.hpp @@ -41,7 +41,7 @@ #include // boost -#include + 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 detector, + std::shared_ptr 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 font_engine_; + std::shared_ptr font_engine_; face_manager font_manager_; cairo_face_manager face_manager_; - boost::shared_ptr detector_; + std::shared_ptr detector_; box2d 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 detector, + std::shared_ptr detector, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0); diff --git a/include/mapnik/char_info.hpp b/include/mapnik/char_info.hpp index e5a6a5baa..bd21aeab3 100644 --- a/include/mapnik/char_info.hpp +++ b/include/mapnik/char_info.hpp @@ -23,7 +23,7 @@ #ifndef MAPNIK_CHAR_INFO_HPP #define MAPNIK_CHAR_INFO_HPP -#include +#include namespace mapnik { struct char_properties; diff --git a/include/mapnik/datasource.hpp b/include/mapnik/datasource.hpp index 947fc056a..c65db2338 100644 --- a/include/mapnik/datasource.hpp +++ b/include/mapnik/datasource.hpp @@ -33,7 +33,7 @@ #include // boost -#include +#include #include // stl @@ -48,7 +48,7 @@ struct MAPNIK_DECL Featureset : private mapnik::noncopyable virtual ~Featureset() {} }; -typedef boost::shared_ptr featureset_ptr; +typedef std::shared_ptr featureset_ptr; class MAPNIK_DECL datasource_exception : public std::exception { @@ -140,7 +140,7 @@ public: } }; -typedef boost::shared_ptr datasource_ptr; +typedef std::shared_ptr datasource_ptr; #ifdef MAPNIK_STATIC_PLUGINS #define DATASOURCE_PLUGIN(classname) diff --git a/include/mapnik/datasource_cache.hpp b/include/mapnik/datasource_cache.hpp index 74a70c992..5e1fbc72e 100644 --- a/include/mapnik/datasource_cache.hpp +++ b/include/mapnik/datasource_cache.hpp @@ -30,7 +30,7 @@ #include // boost -#include +#include // stl #include @@ -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 create(parameters const& params); + std::shared_ptr create(parameters const& params); private: datasource_cache(); ~datasource_cache(); - std::map > plugins_; + std::map > plugins_; bool registered_; std::vector plugin_directories_; }; diff --git a/include/mapnik/expression.hpp b/include/mapnik/expression.hpp index 8672074ee..9f8009b89 100644 --- a/include/mapnik/expression.hpp +++ b/include/mapnik/expression.hpp @@ -28,7 +28,7 @@ #include // boost -#include +#include // stl #include @@ -39,7 +39,7 @@ namespace mapnik // fwd declare to reduce compile time template struct expression_grammar; -typedef boost::shared_ptr expression_ptr; +typedef std::shared_ptr expression_ptr; typedef std::set expression_set; diff --git a/include/mapnik/expression_string.hpp b/include/mapnik/expression_string.hpp index 565bc13f4..14a017a38 100644 --- a/include/mapnik/expression_string.hpp +++ b/include/mapnik/expression_string.hpp @@ -28,7 +28,7 @@ #include // boost -#include +#include // stl #include @@ -56,7 +56,7 @@ std::string to_expression_string(T const* expr_node_ptr) } template -std::string to_expression_string(boost::shared_ptr const& expr_node_ptr) +std::string to_expression_string(std::shared_ptr 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 diff --git a/include/mapnik/factory.hpp b/include/mapnik/factory.hpp index 775329c09..8b1c938fa 100644 --- a/include/mapnik/factory.hpp +++ b/include/mapnik/factory.hpp @@ -31,42 +31,23 @@ #include namespace mapnik { -template -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 class factory_error_policy=default_factory_error -> +typename ...Args > class factory : public singleton >, - factory_error_policy + Args...> > { private: + typedef product_type* (*product_creator)(Args...); typedef std::map 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; } diff --git a/include/mapnik/feature.hpp b/include/mapnik/feature.hpp index ebe5f77e5..bf2c547ab 100644 --- a/include/mapnik/feature.hpp +++ b/include/mapnik/feature.hpp @@ -33,7 +33,7 @@ #include // boost -#include +#include #include // stl @@ -48,7 +48,7 @@ namespace mapnik { class raster; class feature_impl; -typedef boost::shared_ptr raster_ptr; +typedef std::shared_ptr raster_ptr; template class context : private mapnik::noncopyable @@ -88,7 +88,7 @@ private: }; typedef context > context_type; -typedef boost::shared_ptr context_ptr; +typedef std::shared_ptr context_ptr; static const value default_value; @@ -116,22 +116,22 @@ public: template inline void put(context_type::key_type const& key, T const& val) { - put(key,value(val)); + put(key, std::move(value(val))); } template 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 result; bool first = true; - for (unsigned i=0;i 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_ptr; +typedef std::shared_ptr feature_ptr; } diff --git a/include/mapnik/feature_factory.hpp b/include/mapnik/feature_factory.hpp index 7896ef04b..f939c4f8f 100644 --- a/include/mapnik/feature_factory.hpp +++ b/include/mapnik/feature_factory.hpp @@ -35,11 +35,11 @@ namespace mapnik { struct feature_factory { - static boost::shared_ptr create (context_ptr const& ctx, mapnik::value_integer fid) + static std::shared_ptr create (context_ptr const& ctx, mapnik::value_integer fid) { //return boost::allocate_shared(boost::pool_allocator(),fid); //return boost::allocate_shared(boost::fast_pool_allocator(),fid); - return boost::make_shared(ctx,fid); + return std::make_shared(ctx,fid); } }; } diff --git a/include/mapnik/feature_style_processor_context.hpp b/include/mapnik/feature_style_processor_context.hpp index 376886b9d..b4fec1ed7 100644 --- a/include/mapnik/feature_style_processor_context.hpp +++ b/include/mapnik/feature_style_processor_context.hpp @@ -23,13 +23,10 @@ #ifndef FEATURE_STYLE_PROCESSOR_CONTEXT_HPP #define FEATURE_STYLE_PROCESSOR_CONTEXT_HPP -// boost -#include -#include - // stl #include #include +#include namespace mapnik { @@ -39,9 +36,9 @@ public: virtual ~IProcessorContext() {} }; -typedef boost::shared_ptr processor_context_ptr; +typedef std::shared_ptr processor_context_ptr; typedef std::map feature_style_context_map; } -#endif /* FEATURE_STYLE_PROCESSOR_CONTEXT_HPP */ +#endif // FEATURE_STYLE_PROCESSOR_CONTEXT_HPP diff --git a/include/mapnik/feature_style_processor_impl.hpp b/include/mapnik/feature_style_processor_impl.hpp index 2bd7fda97..60b75ece8 100644 --- a/include/mapnik/feature_style_processor_impl.hpp +++ b/include/mapnik/feature_style_processor_impl.hpp @@ -135,7 +135,7 @@ struct layer_rendering_material { box2d layer_ext2_; std::vector active_styles_; std::vector featureset_ptr_list_; - boost::ptr_vector rule_caches_; + std::vector 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_ptr; +typedef std::shared_ptr layer_rendering_material_ptr; template @@ -180,12 +180,12 @@ void feature_style_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 names; - layer_rendering_material_ptr mat = boost::make_shared(lyr, proj); + layer_rendering_material_ptr mat = std::make_shared(lyr, proj); prepare_layer(*mat, ctx_map, @@ -207,7 +207,7 @@ void feature_style_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::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 style=m_.find_style(style_name); if (!style) @@ -435,11 +435,11 @@ void feature_style_processor::prepare_layer(layer_rendering_material height/qh); query q(layer_ext,res,scale_denom,extent); - boost::ptr_vector & rule_caches = mat.rule_caches_; + std::vector & 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 style=m_.find_style(style_name); if (!style) @@ -453,19 +453,19 @@ void feature_style_processor::prepare_layer(layer_rendering_material std::vector const& rules = style->get_rules(); bool active_rules = false; - std::auto_ptr 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::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::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::render_material(layer_rendering_materia layer const& lay = mat.lay_; - boost::ptr_vector & rule_caches = mat.rule_caches_; + std::vector & rule_caches = mat.rule_caches_; proj_transform prj_trans(mat.proj0_,mat.proj1_); @@ -554,7 +554,7 @@ void feature_style_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 cache = boost::make_shared(); + std::shared_ptr cache = std::make_shared(); feature_ptr feature, prev; while ((feature = features->next())) @@ -564,7 +564,7 @@ void feature_style_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::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::render_material(layer_rendering_materia } else if (cache_features) { - boost::shared_ptr cache = boost::make_shared(); + std::shared_ptr cache = std::make_shared(); 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::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::render_material(layer_rendering_materia { int i = 0; std::vector::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::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),*expr); @@ -664,7 +664,7 @@ void feature_style_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::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::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); } diff --git a/include/mapnik/font_engine_freetype.hpp b/include/mapnik/font_engine_freetype.hpp index 8e0e846ee..1e046e4bc 100644 --- a/include/mapnik/font_engine_freetype.hpp +++ b/include/mapnik/font_engine_freetype.hpp @@ -39,10 +39,10 @@ #include // boost -#include +#include #include #include -#include + #ifdef MAPNIK_THREADSAFE #include #endif @@ -63,7 +63,7 @@ struct char_properties; class stroker; struct glyph_t; -typedef boost::shared_ptr face_ptr; +typedef std::shared_ptr face_ptr; class MAPNIK_DECL font_glyph : private mapnik::noncopyable { @@ -85,7 +85,7 @@ private: unsigned index_; }; -typedef boost::shared_ptr glyph_ptr; +typedef std::shared_ptr glyph_ptr; @@ -111,8 +111,8 @@ private: std::map dimension_cache_; }; -typedef boost::shared_ptr face_set_ptr; -typedef boost::shared_ptr stroker_ptr; +typedef std::shared_ptr face_set_ptr; +typedef std::shared_ptr 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(); + face_set_ptr face_set = std::make_shared(); 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 const& names = fset.get_face_names(); - face_set_ptr face_set = boost::make_shared(); - BOOST_FOREACH( std::string const& name, names) + face_set_ptr face_set = std::make_shared(); + for ( std::string const& name : names) { face_ptr face = get_face(name); if (face) diff --git a/include/mapnik/formatting/base.hpp b/include/mapnik/formatting/base.hpp index 023917326..ccb699f5e 100644 --- a/include/mapnik/formatting/base.hpp +++ b/include/mapnik/formatting/base.hpp @@ -38,7 +38,7 @@ struct char_properties; namespace formatting { class node; -typedef boost::shared_ptr node_ptr; +typedef std::shared_ptr node_ptr; class MAPNIK_DECL node { diff --git a/include/mapnik/geometry.hpp b/include/mapnik/geometry.hpp index c3f616f5f..92927a3a5 100644 --- a/include/mapnik/geometry.hpp +++ b/include/mapnik/geometry.hpp @@ -29,30 +29,34 @@ #include // boost -#include +#include #include namespace mapnik { -enum eGeomType { - Unknown = 0, - Point = 1, - LineString = 2, - Polygon = 3 -}; - template 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 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(type_ & types::Polygon); } - void set_type(eGeomType type) + bool interior() const + { + return static_cast(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 geometry_type; -typedef boost::shared_ptr geometry_ptr; +typedef std::shared_ptr geometry_ptr; typedef boost::ptr_vector geometry_container; } diff --git a/include/mapnik/grid/grid_marker_helpers.hpp b/include/mapnik/grid/grid_marker_helpers.hpp index 5acb73a5d..0d1b0bb2e 100644 --- a/include/mapnik/grid/grid_marker_helpers.hpp +++ b/include/mapnik/grid/grid_marker_helpers.hpp @@ -79,11 +79,11 @@ struct raster_markers_rasterizer_dispatch_grid marker_placement_e placement_method = sym_.get_marker_placement(); box2d 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 - diff --git a/include/mapnik/grid/grid_renderer.hpp b/include/mapnik/grid/grid_renderer.hpp index 8abf326be..12ed6b1c4 100644 --- a/include/mapnik/grid/grid_renderer.hpp +++ b/include/mapnik/grid/grid_renderer.hpp @@ -37,8 +37,8 @@ #include // boost -#include -#include + +#include // 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 font_manager_; - boost::shared_ptr detector_; - boost::scoped_ptr ras_ptr; + std::shared_ptr detector_; + const std::unique_ptr ras_ptr; box2d query_extent_; void setup(Map const& m); }; diff --git a/include/mapnik/hextree.hpp b/include/mapnik/hextree.hpp index 299945a11..486d98455 100644 --- a/include/mapnik/hextree.hpp +++ b/include/mapnik/hextree.hpp @@ -33,7 +33,7 @@ #if BOOST_VERSION >= 104600 #include #endif -#include + // stl #include @@ -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 root_; + const std::unique_ptr root_; // working palette for quantization, sorted on mean(r,g,b,a) for easier searching NN std::vector sorted_pal_; // index remaping of sorted_pal_ indexes to indexes of returned image palette diff --git a/include/mapnik/hit_test_filter.hpp b/include/mapnik/hit_test_filter.hpp index b9c1f6a6b..cb9c6f1ec 100644 --- a/include/mapnik/hit_test_filter.hpp +++ b/include/mapnik/hit_test_filter.hpp @@ -27,7 +27,7 @@ #include #include // boost -#include + 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; diff --git a/include/mapnik/image_filter.hpp b/include/mapnik/image_filter.hpp index 4d41ea4a6..0b349cf85 100644 --- a/include/mapnik/image_filter.hpp +++ b/include/mapnik/image_filter.hpp @@ -32,7 +32,7 @@ #include #include #include -#include + // 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; diff --git a/include/mapnik/image_reader.hpp b/include/mapnik/image_reader.hpp index c30d1da6f..a3a6545e7 100644 --- a/include/mapnik/image_reader.hpp +++ b/include/mapnik/image_reader.hpp @@ -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 +bool register_image_reader(std::string const& type, image_reader* (* fun)(Args...)) +{ + return factory::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); diff --git a/include/mapnik/json/feature_collection_parser.hpp b/include/mapnik/json/feature_collection_parser.hpp index 63473712e..3ce5361bd 100644 --- a/include/mapnik/json/feature_collection_parser.hpp +++ b/include/mapnik/json/feature_collection_parser.hpp @@ -30,7 +30,7 @@ #include // boost -#include + // stl #include @@ -49,7 +49,7 @@ public: ~feature_collection_parser(); bool parse(iterator_type first, iterator_type last, std::vector & features); private: - boost::scoped_ptr > grammar_; + const std::unique_ptr > grammar_; }; }} diff --git a/include/mapnik/json/feature_parser.hpp b/include/mapnik/json/feature_parser.hpp index e3c3ed8d6..e55d757cb 100644 --- a/include/mapnik/json/feature_parser.hpp +++ b/include/mapnik/json/feature_parser.hpp @@ -30,7 +30,7 @@ #include // boost -#include + // stl #include @@ -49,7 +49,7 @@ public: ~feature_parser(); bool parse(iterator_type first, iterator_type last, mapnik::feature_impl & f); private: - boost::scoped_ptr > grammar_; + const std::unique_ptr > grammar_; }; }} diff --git a/include/mapnik/json/geojson_generator.hpp b/include/mapnik/json/geojson_generator.hpp index ac342b6af..b3049e6ca 100644 --- a/include/mapnik/json/geojson_generator.hpp +++ b/include/mapnik/json/geojson_generator.hpp @@ -27,7 +27,7 @@ #include #include -#include + #include #include @@ -46,7 +46,7 @@ public: ~feature_generator(); bool generate(std::string & geojson, mapnik::feature_impl const& f); private: - boost::scoped_ptr > grammar_; + const std::unique_ptr > 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 > grammar_; + const std::unique_ptr > grammar_; }; #else diff --git a/include/mapnik/json/geometry_generator_grammar.hpp b/include/mapnik/json/geometry_generator_grammar.hpp index dd6950ca5..e10b24f42 100644 --- a/include/mapnik/json/geometry_generator_grammar.hpp +++ b/include/mapnik/json/geometry_generator_grammar.hpp @@ -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)] diff --git a/include/mapnik/json/geometry_parser.hpp b/include/mapnik/json/geometry_parser.hpp index 76985f9a5..7a617a060 100644 --- a/include/mapnik/json/geometry_parser.hpp +++ b/include/mapnik/json/geometry_parser.hpp @@ -29,7 +29,7 @@ #include // boost -#include + // stl //#include @@ -49,7 +49,7 @@ public: ~geometry_parser(); bool parse(iterator_type first, iterator_type last, boost::ptr_vector&); private: - boost::scoped_ptr > grammar_; + const std::unique_ptr > grammar_; }; }} diff --git a/include/mapnik/mapped_memory_cache.hpp b/include/mapnik/mapped_memory_cache.hpp index 2526e5855..7f876a88e 100644 --- a/include/mapnik/mapped_memory_cache.hpp +++ b/include/mapnik/mapped_memory_cache.hpp @@ -30,14 +30,14 @@ // boost #include -#include +#include #include #include namespace mapnik { -typedef boost::shared_ptr mapped_region_ptr; +typedef std::shared_ptr mapped_region_ptr; class MAPNIK_DECL mapped_memory_cache : public singleton, diff --git a/include/mapnik/marker.hpp b/include/mapnik/marker.hpp index 568f56550..40c418972 100644 --- a/include/mapnik/marker.hpp +++ b/include/mapnik/marker.hpp @@ -36,7 +36,7 @@ // boost #include -#include +#include #include #include @@ -49,8 +49,8 @@ namespace mapnik typedef agg::pod_bvector attr_storage; typedef mapnik::svg::svg_storage svg_storage_type; -typedef boost::shared_ptr svg_path_ptr; -typedef boost::shared_ptr image_ptr; +typedef std::shared_ptr svg_path_ptr; +typedef std::shared_ptr 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(boost::make_shared(4,4)); + bitmap_data_ = boost::optional(std::make_shared(4,4)); (*bitmap_data_)->set(0xff000000); } diff --git a/include/mapnik/marker_cache.hpp b/include/mapnik/marker_cache.hpp index eca2decd3..e7f7be267 100644 --- a/include/mapnik/marker_cache.hpp +++ b/include/mapnik/marker_cache.hpp @@ -30,7 +30,7 @@ // boost #include -#include +#include #include namespace mapnik @@ -38,7 +38,7 @@ namespace mapnik class marker; -typedef boost::shared_ptr marker_ptr; +typedef std::shared_ptr marker_ptr; class MAPNIK_DECL marker_cache : diff --git a/include/mapnik/marker_helpers.hpp b/include/mapnik/marker_helpers.hpp index f5bcce8fe..008386552 100644 --- a/include/mapnik/marker_helpers.hpp +++ b/include/mapnik/marker_helpers.hpp @@ -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 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(); @@ -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& 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); } diff --git a/include/mapnik/path_expression.hpp b/include/mapnik/path_expression.hpp index b031f4512..9fa0767b3 100644 --- a/include/mapnik/path_expression.hpp +++ b/include/mapnik/path_expression.hpp @@ -25,7 +25,7 @@ // boost #include -#include +#include // stl #include @@ -38,7 +38,7 @@ struct attribute; typedef boost::variant path_component; typedef std::vector path_expression; -typedef boost::shared_ptr path_expression_ptr; +typedef std::shared_ptr path_expression_ptr; } diff --git a/include/mapnik/placement_finder.hpp b/include/mapnik/placement_finder.hpp index 01b0dee4b..722aee251 100644 --- a/include/mapnik/placement_finder.hpp +++ b/include/mapnik/placement_finder.hpp @@ -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 get_placement_offset(std::vector const& path_positions, + std::unique_ptr get_placement_offset(std::vector const& path_positions, std::vector 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 const& current_placement, int orientation); + bool test_placement(std::unique_ptr const& current_placement, int orientation); ///Does a line-circle intersect calculation // NOTE: Follow the strict pre conditions diff --git a/include/mapnik/png_io.hpp b/include/mapnik/png_io.hpp index 3de152960..a1b7095ba 100644 --- a/include/mapnik/png_io.hpp +++ b/include/mapnik/png_io.hpp @@ -34,7 +34,7 @@ #include // for Z_DEFAULT_COMPRESSION // boost -#include + // stl #include @@ -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 row_pointers(new png_bytep[image.height()]); + const std::unique_ptr row_pointers(new png_bytep[image.height()]); for (unsigned int i = 0; i < image.height(); i++) { row_pointers[i] = (png_bytep)image.getRow(i); diff --git a/include/mapnik/polygon_clipper.hpp b/include/mapnik/polygon_clipper.hpp index 7bcb65b85..470f06fbc 100644 --- a/include/mapnik/polygon_clipper.hpp +++ b/include/mapnik/polygon_clipper.hpp @@ -28,10 +28,11 @@ // mapnik #include +#include #include // boost -#include + #include #include #include @@ -101,7 +102,7 @@ struct polygon_clipper } - polygon_clipper( box2d const& clip_box,Geometry & geom) + polygon_clipper(box2d const& clip_box, Geometry & geom) : clip_box_(clip_box), geom_(geom) { @@ -166,7 +167,7 @@ private: continue; } prev_x = x; - prev_x = y; + prev_y = y; if (ring_count == 1) { append(subject_poly, make(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) { diff --git a/include/mapnik/pool.hpp b/include/mapnik/pool.hpp index ba22cd7fa..707103d98 100644 --- a/include/mapnik/pool.hpp +++ b/include/mapnik/pool.hpp @@ -29,7 +29,7 @@ #include // boost -#include +#include #ifdef MAPNIK_THREADSAFE #include #endif @@ -45,7 +45,7 @@ namespace mapnik template class Creator> class Pool : private mapnik::noncopyable { - typedef boost::shared_ptr HolderType; + typedef std::shared_ptr HolderType; typedef std::deque ContType; Creator creator_; diff --git a/include/mapnik/raster_colorizer.hpp b/include/mapnik/raster_colorizer.hpp index 76c09fd94..e36d54608 100644 --- a/include/mapnik/raster_colorizer.hpp +++ b/include/mapnik/raster_colorizer.hpp @@ -43,7 +43,7 @@ #include // boost -#include +#include // stl #include @@ -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 const& raster, feature_impl const& f) const; + void colorize(std::shared_ptr 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_ptr; +typedef std::shared_ptr raster_colorizer_ptr; } // mapnik namespace diff --git a/include/mapnik/rule_cache.hpp b/include/mapnik/rule_cache.hpp index cff26b82b..32f7b4423 100644 --- a/include/mapnik/rule_cache.hpp +++ b/include/mapnik/rule_cache.hpp @@ -27,10 +27,6 @@ #include #include #include - -// boost -#include - // stl #include @@ -39,12 +35,30 @@ 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_ptrs; rule_cache() - : if_rules_(), - else_rules_(), - also_rules_() {} + : if_rules_(), + 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) { @@ -66,12 +80,12 @@ public: { return if_rules_; } - + rule_ptrs const& get_else_rules() const { return else_rules_; } - + rule_ptrs const& get_also_rules() const { return also_rules_; diff --git a/include/mapnik/shield_symbolizer.hpp b/include/mapnik/shield_symbolizer.hpp index be2af2926..6b28826f2 100644 --- a/include/mapnik/shield_symbolizer.hpp +++ b/include/mapnik/shield_symbolizer.hpp @@ -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, diff --git a/include/mapnik/svg/output/svg_path_iterator.hpp b/include/mapnik/svg/output/svg_path_iterator.hpp index c58c2ef7a..c27f61bd9 100644 --- a/include/mapnik/svg/output/svg_path_iterator.hpp +++ b/include/mapnik/svg/output/svg_path_iterator.hpp @@ -30,7 +30,7 @@ // boost #include #include -#include +#include #include namespace mapnik { @@ -74,7 +74,7 @@ public: path_iterator(Container const& path) : path_iterator::iterator_adaptor_(0), path_(path), - first_value_(boost::make_shared(0,0,0)) + first_value_(std::make_shared(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(0,0,0)) + first_value_(std::make_shared(0,0,0)) { this->increment(); } @@ -165,7 +165,7 @@ private: } Container const& path_; - boost::shared_ptr first_value_; + std::shared_ptr first_value_; }; /*! diff --git a/include/mapnik/svg/output/svg_renderer.hpp b/include/mapnik/svg/output/svg_renderer.hpp index 1e98fee09..05e1f931f 100644 --- a/include/mapnik/svg/output/svg_renderer.hpp +++ b/include/mapnik/svg/output/svg_renderer.hpp @@ -40,8 +40,8 @@ // boost #include -#include -#include + +#include // stl #include @@ -161,7 +161,7 @@ private: svg::path_output_attributes path_attributes_; freetype_engine font_engine_; face_manager font_manager_; - boost::shared_ptr detector_; + std::shared_ptr detector_; svg::svg_generator generator_; box2d query_extent_; bool painted_; diff --git a/include/mapnik/svg/svg_renderer_agg.hpp b/include/mapnik/svg/svg_renderer_agg.hpp index cf76e0a99..9ddd0e7b2 100644 --- a/include/mapnik/svg/svg_renderer_agg.hpp +++ b/include/mapnik/svg/svg_renderer_agg.hpp @@ -35,7 +35,7 @@ #include // boost -#include + // 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(); diff --git a/include/mapnik/symbolizer.hpp b/include/mapnik/symbolizer.hpp index 3e9f58fd3..9d6a7843f 100644 --- a/include/mapnik/symbolizer.hpp +++ b/include/mapnik/symbolizer.hpp @@ -30,7 +30,7 @@ #include // boost -#include +#include // stl #include @@ -45,7 +45,7 @@ namespace mapnik // TODO - move these transform declares to own header namespace detail { struct transform_node; } typedef std::vector transform_list; -typedef boost::shared_ptr transform_list_ptr; +typedef std::shared_ptr transform_list_ptr; typedef transform_list_ptr transform_type; class feature_impl; diff --git a/include/mapnik/symbolizer_hash.hpp b/include/mapnik/symbolizer_hash.hpp index db89ff8a9..2b34f4b44 100644 --- a/include/mapnik/symbolizer_hash.hpp +++ b/include/mapnik/symbolizer_hash.hpp @@ -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()); diff --git a/include/mapnik/symbolizer_helpers.hpp b/include/mapnik/symbolizer_helpers.hpp index 1b4956f87..555871fc7 100644 --- a/include/mapnik/symbolizer_helpers.hpp +++ b/include/mapnik/symbolizer_helpers.hpp @@ -31,7 +31,7 @@ #include //boost -#include + // agg #include "agg_trans_affine.h" @@ -110,7 +110,7 @@ protected: bool points_on_line_; text_placement_info_ptr placement_; - boost::scoped_ptr > finder_; + std::unique_ptr > finder_; }; template diff --git a/include/mapnik/text_path.hpp b/include/mapnik/text_path.hpp index 1b71176d0..654f6aafe 100644 --- a/include/mapnik/text_path.hpp +++ b/include/mapnik/text_path.hpp @@ -33,10 +33,9 @@ #include // boost -#include +#include #include - namespace mapnik { @@ -197,9 +196,8 @@ public: } }; -typedef boost::shared_ptr text_path_ptr; +typedef std::shared_ptr text_path_ptr; typedef boost::ptr_vector placements_type; - } #endif // MAPNIK_TEXT_PATH_HPP diff --git a/include/mapnik/text_placements/base.hpp b/include/mapnik/text_placements/base.hpp index 99a7f1cd1..df375bc92 100644 --- a/include/mapnik/text_placements/base.hpp +++ b/include/mapnik/text_placements/base.hpp @@ -70,7 +70,7 @@ public: double get_actual_minimum_padding() const { return scale_factor * properties.minimum_padding; } }; -typedef boost::shared_ptr text_placement_info_ptr; +typedef std::shared_ptr 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_ptr; +typedef std::shared_ptr text_placements_ptr; } //ns mapnik diff --git a/include/mapnik/text_symbolizer.hpp b/include/mapnik/text_symbolizer.hpp index 3a8945ded..8aa17848a 100644 --- a/include/mapnik/text_symbolizer.hpp +++ b/include/mapnik/text_symbolizer.hpp @@ -31,7 +31,7 @@ #include // boost -#include +#include #include // 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, diff --git a/include/mapnik/transform_expression.hpp b/include/mapnik/transform_expression.hpp index 7b5b55c75..d36c5bcf3 100644 --- a/include/mapnik/transform_expression.hpp +++ b/include/mapnik/transform_expression.hpp @@ -28,7 +28,7 @@ // boost #include -#include +#include #include // fusion @@ -193,7 +193,7 @@ inline void clear(transform_node& val) typedef detail::transform_node transform_node; typedef std::vector transform_list; -typedef boost::shared_ptr transform_list_ptr; +typedef std::shared_ptr 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); diff --git a/include/mapnik/transform_processor.hpp b/include/mapnik/transform_processor.hpp index d720c4350..71cfb42e0 100644 --- a/include/mapnik/transform_processor.hpp +++ b/include/mapnik/transform_processor.hpp @@ -33,10 +33,10 @@ #include // boost -#include + #include #include - +#include // agg #include @@ -190,7 +190,7 @@ struct transform_processor { attribute_collector 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 diff --git a/include/mapnik/util/geometry_svg_generator.hpp b/include/mapnik/util/geometry_svg_generator.hpp index 9fec4ae65..150bf6ccf 100644 --- a/include/mapnik/util/geometry_svg_generator.hpp +++ b/include/mapnik/util/geometry_svg_generator.hpp @@ -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("\"") ; diff --git a/include/mapnik/util/geometry_to_wkb.hpp b/include/mapnik/util/geometry_to_wkb.hpp index 78cff90b3..6aaeb629a 100644 --- a/include/mapnik/util/geometry_to_wkb.hpp +++ b/include/mapnik/util/geometry_to_wkb.hpp @@ -27,14 +27,10 @@ #include #include -// boost -#include -#include -#include - // stl #include #include +#include namespace mapnik { namespace util { @@ -137,17 +133,17 @@ struct wkb_buffer char * data_; }; -typedef boost::shared_ptr wkb_buffer_ptr; +typedef std::unique_ptr wkb_buffer_ptr; template 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(size); + wkb_buffer_ptr wkb(new wkb_buffer(size)); wkb_stream ss(wkb->buffer(), wkb->size()); ss.write(reinterpret_cast(&byte_order),1); - int type = static_cast(mapnik::Point); + int type = static_cast(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 @@ -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(size); + wkb_buffer_ptr wkb(new wkb_buffer(size)); wkb_stream ss(wkb->buffer(), wkb->size()); ss.write(reinterpret_cast(&byte_order),1); - int type = static_cast(mapnik::LineString); + int type = static_cast(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 @@ -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(size); + wkb_buffer_ptr wkb(new wkb_buffer(size)); wkb_stream ss(wkb->buffer(), wkb->size()); ss.write(reinterpret_cast(&byte_order),1); - int type = static_cast(mapnik::Polygon); + int type = static_cast(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 @@ -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(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(&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(); diff --git a/include/mapnik/util/geometry_wkt_generator.hpp b/include/mapnik/util/geometry_wkt_generator.hpp index d1ee75902..74dd1be70 100644 --- a/include/mapnik/util/geometry_wkt_generator.hpp +++ b/include/mapnik/util/geometry_wkt_generator.hpp @@ -39,8 +39,6 @@ #include #include -#include // 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 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(15 - boost::math::trunc(log10(traits::get_absolute_value(n))))); + using namespace boost::spirit; + return static_cast(14 - std::trunc(std::log10(traits::get_absolute_value(n)))); } template diff --git a/include/mapnik/value.hpp b/include/mapnik/value.hpp index 18979d8df..1ad24e0b7 100644 --- a/include/mapnik/value.hpp +++ b/include/mapnik/value.hpp @@ -34,7 +34,7 @@ #include #include #include -#include + #include #include #include "hash_variant.hpp" @@ -47,7 +47,6 @@ #include #include - 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 buf_ptr(new char [len+1]); + const std::unique_ptr 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(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_); diff --git a/include/mapnik/vertex_converters.hpp b/include/mapnik/vertex_converters.hpp index 71ee74e55..fa9a5ea42 100644 --- a/include/mapnik/vertex_converters.hpp +++ b/include/mapnik/vertex_converters.hpp @@ -46,6 +46,7 @@ #include #include #include +#include // agg #include "agg_conv_clip_polygon.h" @@ -80,7 +81,7 @@ struct converter_traits typedef T0 geometry_type; typedef geometry_type conv_type; template - 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 struct converter_traits { typedef T geometry_type; - typedef typename agg::conv_clip_polygon conv_type; + typedef mapnik::polygon_clipper conv_type; template static void setup(geometry_type & geom, Args const& args) { typename boost::mpl::at >::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 typedef T geometry_type; typedef typename agg::conv_close_polygon conv_type; template - 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 { template - static void forward(Base& base, T0 & geom,T1 const& /*args*/) + static void forward(Base& base, T0 & geom,T1 const& args) { base.template dispatch(geom, typename boost::is_same::type()); } diff --git a/include/mapnik/vertex_vector.hpp b/include/mapnik/vertex_vector.hpp index 836628cd6..82b878f7a 100644 --- a/include/mapnik/vertex_vector.hpp +++ b/include/mapnik/vertex_vector.hpp @@ -55,7 +55,7 @@ public: // required for iterators support typedef boost::tuple 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_; diff --git a/include/mapnik/webp_io.hpp b/include/mapnik/webp_io.hpp index a697b39c9..de57349a1 100644 --- a/include/mapnik/webp_io.hpp +++ b/include/mapnik/webp_io.hpp @@ -34,7 +34,7 @@ #include // boost -#include + namespace mapnik { diff --git a/include/mapnik/wkt/wkt_factory.hpp b/include/mapnik/wkt/wkt_factory.hpp index a35299b9b..20436b843 100644 --- a/include/mapnik/wkt/wkt_factory.hpp +++ b/include/mapnik/wkt/wkt_factory.hpp @@ -31,7 +31,7 @@ // boost #include -#include + #include // stl @@ -50,7 +50,7 @@ public: wkt_parser(); bool parse(std::string const& wkt, boost::ptr_vector & paths); private: - boost::scoped_ptr > grammar_; + const std::unique_ptr > grammar_; }; #endif diff --git a/include/mapnik/wkt/wkt_grammar.hpp b/include/mapnik/wkt/wkt_grammar.hpp index ff233d65d..09d634531 100644 --- a/include/mapnik/wkt/wkt_grammar.hpp +++ b/include/mapnik/wkt/wkt_grammar.hpp @@ -113,7 +113,7 @@ namespace mapnik { namespace wkt { ; // ::= point - point_tagged_text = no_case[lit("POINT")] [ _a = new_(Point) ] + point_tagged_text = no_case[lit("POINT")] [ _a = new_(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 - linestring_tagged_text = no_case[lit("LINESTRING")] [ _a = new_(LineString) ] + linestring_tagged_text = no_case[lit("LINESTRING")] [ _a = new_(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 - polygon_tagged_text = no_case[lit("POLYGON")] [ _a = new_(Polygon) ] + polygon_tagged_text = no_case[lit("POLYGON")] [ _a = new_(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 = (lit('(') - >> ((eps[_a = new_(Point)] + >> ((eps[_a = new_(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 = (lit('(') - >> ((eps[_a = new_(LineString)] + >> ((eps[_a = new_(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 = (lit('(') - >> ((eps[_a = new_(Polygon)] + >> ((eps[_a = new_(geometry_type::types::Polygon)] >> ( polygon_text(_a)[push_back(_val,_a)] | eps[cleanup_(_a)][_pass = false])) % lit(',')) diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index e1478cd36..9891aa968 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -73,7 +73,7 @@ csv_datasource::csv_datasource(parameters const& params) manual_headers_(mapnik::util::trim_copy(*params.get("headers", ""))), strict_(*params.get("strict", false)), filesize_max_(*params.get("filesize_max", 20.0)), // MB - ctx_(boost::make_shared()) + ctx_(std::make_shared()) { /* 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(q.get_bbox(),features_); + return std::make_shared(q.get_bbox(),features_); } mapnik::featureset_ptr csv_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const diff --git a/plugins/input/gdal/gdal_datasource.cpp b/plugins/input/gdal/gdal_datasource.cpp index ceb6fc86d..841d62631 100644 --- a/plugins/input/gdal/gdal_datasource.cpp +++ b/plugins/input/gdal/gdal_datasource.cpp @@ -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, diff --git a/plugins/input/gdal/gdal_featureset.cpp b/plugins/input/gdal/gdal_featureset.cpp index b87555add..642ca2eda 100644 --- a/plugins/input/gdal/gdal_featureset.cpp +++ b/plugins/input/gdal/gdal_featureset.cpp @@ -63,7 +63,7 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset, double dy, boost::optional const& nodata) : dataset_(dataset), - ctx_(boost::make_shared()), + ctx_(std::make_shared()), 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(intersect, im_width, im_height); + mapnik::raster_ptr raster = std::make_shared(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); diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index 10e320ef9..87c9185b9 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -31,7 +31,7 @@ #include #include #include -#include + #include #include #include @@ -130,7 +130,7 @@ geojson_datasource::geojson_datasource(parameters const& params) boost::spirit::multi_pass end = boost::spirit::make_default_multi_pass(base_iterator_type()); - mapnik::context_ptr ctx = boost::make_shared(); + mapnik::context_ptr ctx = std::make_shared(); mapnik::json::feature_collection_parser > 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 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(features_, index_array_.begin(), index_array_.end()); + return std::make_shared(features_, index_array_.begin(), index_array_.end()); } // otherwise return an empty featureset pointer return mapnik::featureset_ptr(); diff --git a/plugins/input/geojson/geojson_datasource.hpp b/plugins/input/geojson/geojson_datasource.hpp index 7cad44b08..b6314db37 100644 --- a/plugins/input/geojson/geojson_datasource.hpp +++ b/plugins/input/geojson/geojson_datasource.hpp @@ -35,7 +35,7 @@ // boost #include -#include +#include #include #include #include @@ -54,7 +54,7 @@ public: typedef boost::geometry::model::d2::point_xy point_type; typedef boost::geometry::model::box box_type; typedef boost::geometry::index::rtree spatial_index_type; - + // constructor geojson_datasource(mapnik::parameters const& params); virtual ~geojson_datasource (); @@ -71,7 +71,7 @@ private: mapnik::layer_descriptor desc_; std::string file_; mapnik::box2d extent_; - boost::shared_ptr tr_; + std::shared_ptr tr_; std::vector features_; spatial_index_type tree_; mutable std::deque index_array_; diff --git a/plugins/input/occi/occi_datasource.cpp b/plugins/input/occi/occi_datasource.cpp index 6111c7049..1815efbad 100644 --- a/plugins/input/occi/occi_datasource.cpp +++ b/plugins/input/occi/occi_datasource.cpp @@ -523,7 +523,7 @@ featureset_ptr occi_datasource::features(query const& q) const std::set const& props = q.property_names(); std::set::const_iterator pos = props.begin(); std::set::const_iterator end = props.end(); - mapnik::context_ptr ctx = boost::make_shared(); + mapnik::context_ptr ctx = std::make_shared(); 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(pool_, + return std::make_shared(pool_, conn_, ctx, s.str(), @@ -590,7 +590,7 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt, double tol) } std::vector::const_iterator itr = desc_.get_descriptors().begin(); std::vector::const_iterator end = desc_.get_descriptors().end(); - mapnik::context_ptr ctx = boost::make_shared(); + mapnik::context_ptr ctx = std::make_shared(); 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(pool_, + return std::make_shared(pool_, conn_, ctx, s.str(), diff --git a/plugins/input/occi/occi_datasource.hpp b/plugins/input/occi/occi_datasource.hpp index 10261f19a..0aa6f3891 100644 --- a/plugins/input/occi/occi_datasource.hpp +++ b/plugins/input/occi/occi_datasource.hpp @@ -35,7 +35,7 @@ // boost #include -#include +#include // stl #include diff --git a/plugins/input/occi/occi_featureset.cpp b/plugins/input/occi/occi_featureset.cpp index fe0455742..393e4ed8b 100644 --- a/plugins/input/occi/occi_featureset.cpp +++ b/plugins/input/occi/occi_featureset.cpp @@ -122,7 +122,7 @@ feature_ptr occi_featureset::next() } else { - boost::scoped_ptr geom(dynamic_cast(rs_->getObject(1))); + const std::unique_ptr geom(dynamic_cast(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& elem_info, const std::vector& 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) { diff --git a/plugins/input/occi/occi_featureset.hpp b/plugins/input/occi/occi_featureset.hpp index cb4e7cb9e..cb879ea04 100644 --- a/plugins/input/occi/occi_featureset.hpp +++ b/plugins/input/occi/occi_featureset.hpp @@ -30,8 +30,8 @@ #include // boost -#include -#include + +#include // 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& elem_info, const std::vector& ordinates, const int dimensions, @@ -70,7 +70,7 @@ private: occi_connection_ptr conn_; oracle::occi::ResultSet* rs_; - boost::scoped_ptr tr_; + const std::unique_ptr tr_; mapnik::value_integer feature_id_; mapnik::context_ptr ctx_; bool use_wkb_; diff --git a/plugins/input/ogr/ogr_converter.cpp b/plugins/input/ogr/ogr_converter.cpp index 8892ef1f9..19beeae1d 100644 --- a/plugins/input/ogr/ogr_converter.cpp +++ b/plugins/input/ogr/ogr_converter.cpp @@ -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 point(new geometry_type(mapnik::Point)); + std::unique_ptr 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 line(new geometry_type(mapnik::LineString)); + std::unique_ptr 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 poly(new geometry_type(mapnik::Polygon)); + std::unique_ptr 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) diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index dd8a62307..4d686c407 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -478,7 +478,7 @@ featureset_ptr ogr_datasource::features(query const& q) const std::vector const& desc_ar = desc_.get_descriptors(); // feature context (schema) - mapnik::context_ptr ctx = boost::make_shared(); + mapnik::context_ptr ctx = std::make_shared(); std::vector::const_iterator itr = desc_ar.begin(); std::vector::const_iterator end = desc_ar.end(); @@ -521,7 +521,7 @@ featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol) { std::vector const& desc_ar = desc_.get_descriptors(); // feature context (schema) - mapnik::context_ptr ctx = boost::make_shared(); + mapnik::context_ptr ctx = std::make_shared(); std::vector::const_iterator itr = desc_ar.begin(); std::vector::const_iterator end = desc_ar.end(); diff --git a/plugins/input/ogr/ogr_datasource.hpp b/plugins/input/ogr/ogr_datasource.hpp index ebff6c548..7be996c4d 100644 --- a/plugins/input/ogr/ogr_datasource.hpp +++ b/plugins/input/ogr/ogr_datasource.hpp @@ -34,7 +34,7 @@ // boost #include -#include +#include // stl #include @@ -56,7 +56,7 @@ public: mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; - + private: void init(mapnik::parameters const& params); mapnik::box2d extent_; diff --git a/plugins/input/ogr/ogr_featureset.hpp b/plugins/input/ogr/ogr_featureset.hpp index 29f707f7f..861ff27fd 100644 --- a/plugins/input/ogr/ogr_featureset.hpp +++ b/plugins/input/ogr/ogr_featureset.hpp @@ -30,7 +30,7 @@ #include // boost -#include + // ogr #include @@ -54,7 +54,7 @@ private: mapnik::context_ptr ctx_; OGRLayer& layer_; OGRFeatureDefn* layerdef_; - boost::scoped_ptr tr_; + const std::unique_ptr tr_; const char* fidcolumn_; mutable int count_; }; diff --git a/plugins/input/ogr/ogr_index_featureset.hpp b/plugins/input/ogr/ogr_index_featureset.hpp index 9972935e4..83645da00 100644 --- a/plugins/input/ogr/ogr_index_featureset.hpp +++ b/plugins/input/ogr/ogr_index_featureset.hpp @@ -25,7 +25,7 @@ #include #include -#include + #include #include "ogr_featureset.hpp" @@ -48,7 +48,7 @@ private: filterT filter_; std::vector ids_; std::vector::iterator itr_; - boost::scoped_ptr tr_; + const std::unique_ptr tr_; const char* fidcolumn_; OGREnvelope feature_envelope_; }; diff --git a/plugins/input/osm/osm_datasource.cpp b/plugins/input/osm/osm_datasource.cpp index 0a18b4975..9db56a458 100644 --- a/plugins/input/osm/osm_datasource.cpp +++ b/plugins/input/osm/osm_datasource.cpp @@ -99,14 +99,13 @@ osm_datasource::osm_datasource(const parameters& params) // Add the attributes to the datasource descriptor - assume they are // all of type String - for (std::set::iterator i = keys.begin(); i != keys.end(); i++) + for (auto const& key : keys) { - desc_.add_descriptor(attribute_descriptor(*i, tagtypes.get_type(*i))); + desc_.add_descriptor(attribute_descriptor(key, tagtypes.get_type(key))); } - // Get the bounds of the data and set extent_ accordingly bounds b = osm_data_->get_bounds(); - extent_ = box2d(b.w, b.s, b.e, b.n); + extent_ = box2d(b.w,b.s,b.e,b.n); } osm_datasource::~osm_datasource() @@ -135,7 +134,7 @@ featureset_ptr osm_datasource::features(const query& q) const filter_in_box filter(q.get_bbox()); // so we need to filter osm features by bbox here... - return boost::make_shared >(filter, + return std::make_shared >(filter, osm_data_, q.property_names(), desc_.get_encoding()); @@ -156,7 +155,7 @@ featureset_ptr osm_datasource::features_at_point(coord2d const& pt, double tol) ++itr; } - return boost::make_shared >(filter, + return std::make_shared >(filter, osm_data_, names, desc_.get_encoding()); diff --git a/plugins/input/osm/osm_datasource.hpp b/plugins/input/osm/osm_datasource.hpp index efdd20d68..fb9fcb3fa 100644 --- a/plugins/input/osm/osm_datasource.hpp +++ b/plugins/input/osm/osm_datasource.hpp @@ -34,7 +34,7 @@ // boost #include -#include +#include // stl #include diff --git a/plugins/input/osm/osm_featureset.cpp b/plugins/input/osm/osm_featureset.cpp index e72c597ff..be60826bc 100644 --- a/plugins/input/osm/osm_featureset.cpp +++ b/plugins/input/osm/osm_featureset.cpp @@ -48,7 +48,7 @@ osm_featureset::osm_featureset(const filterT& filter, tr_(new transcoder(encoding)), dataset_ (dataset), attribute_names_ (attribute_names), - ctx_(boost::make_shared()) + ctx_(std::make_shared()) { dataset_->rewind(); } @@ -65,7 +65,7 @@ feature_ptr osm_featureset::next() feature = feature_factory::create(ctx_, cur_item->id); double lat = static_cast(cur_item)->lat; double lon = static_cast(cur_item)->lon; - geometry_type* point = new geometry_type(mapnik::Point); + geometry_type* point = new geometry_type(mapnik::geometry_type::types::Point); point->move_to(lon, lat); feature->add_geometry(point); } @@ -86,11 +86,11 @@ feature_ptr osm_featureset::next() geometry_type* geom; if (static_cast(cur_item)->is_polygon()) { - geom = new geometry_type(mapnik::Polygon); + geom = new geometry_type(mapnik::geometry_type::types::Polygon); } else { - geom = new geometry_type(mapnik::LineString); + geom = new geometry_type(mapnik::geometry_type::types::LineString); } geom->move_to(static_cast(cur_item)->nodes[0]->lon, diff --git a/plugins/input/osm/osm_featureset.hpp b/plugins/input/osm/osm_featureset.hpp index bf9510ed9..ebf11c755 100644 --- a/plugins/input/osm/osm_featureset.hpp +++ b/plugins/input/osm/osm_featureset.hpp @@ -27,7 +27,7 @@ #include // boost -#include + // mapnik #include @@ -57,7 +57,7 @@ public: private: filterT filter_; box2d query_ext_; - boost::scoped_ptr tr_; + const std::unique_ptr tr_; std::vector attr_ids_; mutable box2d feature_ext_; mutable int total_geom_size; diff --git a/plugins/input/postgis/asyncresultset.hpp b/plugins/input/postgis/asyncresultset.hpp index a5f838ad8..44b4be2eb 100644 --- a/plugins/input/postgis/asyncresultset.hpp +++ b/plugins/input/postgis/asyncresultset.hpp @@ -29,16 +29,17 @@ #include "connection_manager.hpp" #include "resultset.hpp" #include +#include class postgis_processor_context; -typedef boost::shared_ptr postgis_processor_context_ptr; +typedef std::shared_ptr postgis_processor_context_ptr; class AsyncResultSet : public IResultSet, private mapnik::noncopyable { public: AsyncResultSet(postgis_processor_context_ptr const& ctx, - boost::shared_ptr< Pool > const& pool, - boost::shared_ptr const& conn, std::string const& sql ) + std::shared_ptr< Pool > const& pool, + std::shared_ptr const& conn, std::string const& sql ) : ctx_(ctx), pool_(pool), conn_(conn), @@ -145,10 +146,10 @@ public: private: postgis_processor_context_ptr ctx_; - boost::shared_ptr< Pool > pool_; - boost::shared_ptr conn_; + std::shared_ptr< Pool > pool_; + std::shared_ptr conn_; std::string sql_; - boost::shared_ptr rs_; + std::shared_ptr rs_; bool is_closed_; void prepare() @@ -176,14 +177,14 @@ public: : num_async_requests_(0) {} ~postgis_processor_context() {} - void add_request(boost::shared_ptr const& req) + void add_request(std::shared_ptr const& req) { q_.push(req); } - boost::shared_ptr pop_next_request() + std::shared_ptr pop_next_request() { - boost::shared_ptr r; + std::shared_ptr r; if (!q_.empty()) { r = q_.front(); @@ -195,7 +196,7 @@ public: int num_async_requests_; private: - typedef std::queue > async_queue; + typedef std::queue > async_queue; async_queue q_; }; @@ -203,7 +204,7 @@ private: inline void AsyncResultSet::prepare_next() { // ensure cnx pool has unused cnx - boost::shared_ptr next = ctx_->pop_next_request(); + std::shared_ptr next = ctx_->pop_next_request(); if (next) { next->prepare(); diff --git a/plugins/input/postgis/connection.hpp b/plugins/input/postgis/connection.hpp index 8c764225f..c716cd54e 100644 --- a/plugins/input/postgis/connection.hpp +++ b/plugins/input/postgis/connection.hpp @@ -28,10 +28,8 @@ #include #include -// boost -#include - // std +#include #include #include @@ -87,7 +85,7 @@ public: return ok; } - boost::shared_ptr executeQuery(std::string const& sql, int type = 0) const + std::shared_ptr executeQuery(std::string const& sql, int type = 0) const { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, std::string("postgis_connection::execute_query ") + sql); @@ -117,7 +115,7 @@ public: throw mapnik::datasource_exception(err_msg); } - return boost::make_shared(result); + return std::make_shared(result); } std::string status() const @@ -160,7 +158,7 @@ public: } - boost::shared_ptr getNextAsyncResult() + std::shared_ptr getNextAsyncResult() { PGresult *result = PQgetResult(conn_); if( result && (PQresultStatus(result) != PGRES_TUPLES_OK)) @@ -174,10 +172,10 @@ public: close(); throw mapnik::datasource_exception(err_msg); } - return boost::make_shared(result); + return std::make_shared(result); } - boost::shared_ptr getAsyncResult() + std::shared_ptr getAsyncResult() { PGresult *result = PQgetResult(conn_); if ( !result || (PQresultStatus(result) != PGRES_TUPLES_OK)) @@ -191,7 +189,7 @@ public: close(); throw mapnik::datasource_exception(err_msg); } - return boost::make_shared(result); + return std::make_shared(result); } std::string client_encoding() const diff --git a/plugins/input/postgis/connection_manager.hpp b/plugins/input/postgis/connection_manager.hpp index d457da393..e359702fc 100644 --- a/plugins/input/postgis/connection_manager.hpp +++ b/plugins/input/postgis/connection_manager.hpp @@ -30,13 +30,13 @@ #include // boost -#include -#include +#include #include // stl #include #include +#include using mapnik::Pool; using mapnik::singleton; @@ -107,8 +107,8 @@ public: private: friend class CreateStatic; - typedef std::map > ContType; - typedef boost::shared_ptr HolderType; + typedef std::map > ContType; + typedef std::shared_ptr HolderType; ContType pools_; public: @@ -126,20 +126,20 @@ public: { return pools_.insert( std::make_pair(creator.id(), - boost::make_shared(creator,initialSize,maxSize))).second; + std::make_shared(creator,initialSize,maxSize))).second; } return false; } - boost::shared_ptr getPool(std::string const& key) + std::shared_ptr getPool(std::string const& key) { ContType::const_iterator itr=pools_.find(key); if (itr!=pools_.end()) { return itr->second; } - static const boost::shared_ptr emptyPool; + static const std::shared_ptr emptyPool; return emptyPool; } diff --git a/plugins/input/postgis/cursorresultset.hpp b/plugins/input/postgis/cursorresultset.hpp index 59b4e2dfc..87f4df215 100644 --- a/plugins/input/postgis/cursorresultset.hpp +++ b/plugins/input/postgis/cursorresultset.hpp @@ -31,7 +31,7 @@ class CursorResultSet : public IResultSet, private mapnik::noncopyable { public: - CursorResultSet(boost::shared_ptr const &conn, std::string cursorName, int fetch_count) + CursorResultSet(std::shared_ptr const &conn, std::string cursorName, int fetch_count) : conn_(conn), cursorName_(cursorName), fetch_size_(fetch_count), @@ -135,9 +135,9 @@ private: MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: FETCH result (" << cursorName_ << "): " << rs_->size() << " rows"; } - boost::shared_ptr conn_; + std::shared_ptr conn_; std::string cursorName_; - boost::shared_ptr rs_; + std::shared_ptr rs_; int fetch_size_; bool is_closed_; diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index bc858d7b0..447b00e45 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -38,9 +38,9 @@ // boost #include #include -#include // stl +#include #include #include #include @@ -53,7 +53,7 @@ const double postgis_datasource::FMAX = std::numeric_limits::max(); const std::string postgis_datasource::GEOMETRY_COLUMNS = "geometry_columns"; const std::string postgis_datasource::SPATIAL_REF_SYS = "spatial_ref_system"; -using boost::shared_ptr; +using std::shared_ptr; using mapnik::attribute_descriptor; postgis_datasource::postgis_datasource(parameters const& params) @@ -579,7 +579,7 @@ std::string postgis_datasource::populate_tokens(std::string const& sql, double s } -boost::shared_ptr postgis_datasource::get_resultset(boost::shared_ptr &conn, std::string const& sql, CnxPool_ptr const& pool, processor_context_ptr ctx) const +std::shared_ptr postgis_datasource::get_resultset(std::shared_ptr &conn, std::string const& sql, CnxPool_ptr const& pool, processor_context_ptr ctx) const { if (!ctx) @@ -599,7 +599,7 @@ boost::shared_ptr postgis_datasource::get_resultset(boost::shared_pt throw mapnik::datasource_exception("Postgis Plugin: error creating cursor for data select." ); } - return boost::make_shared(conn, cursor_name, cursor_fetch_size_); + return std::make_shared(conn, cursor_name, cursor_fetch_size_); } else @@ -611,17 +611,17 @@ boost::shared_ptr postgis_datasource::get_resultset(boost::shared_pt else { // asynchronous requests - boost::shared_ptr pgis_ctxt = boost::static_pointer_cast(ctx); + std::shared_ptr pgis_ctxt = std::static_pointer_cast(ctx); if (conn) { // lauch async req & create asyncresult with conn conn->executeAsyncQuery(sql, 1); - return boost::make_shared(pgis_ctxt, pool, conn, sql); + return std::make_shared(pgis_ctxt, pool, conn, sql); } else { // create asyncresult with null connection - boost::shared_ptr res = boost::make_shared(pgis_ctxt, pool, conn, sql); + std::shared_ptr res = std::make_shared(pgis_ctxt, pool, conn, sql); pgis_ctxt->add_request(res); return res; } @@ -643,7 +643,7 @@ processor_context_ptr postgis_datasource::get_context(feature_style_context_map } else { - return ctx.insert(std::make_pair(ds_name,boost::make_shared())).first->second; + return ctx.insert(std::make_pair(ds_name,std::make_shared())).first->second; } } @@ -652,7 +652,7 @@ featureset_ptr postgis_datasource::features(query const& q) const // if the driver is in asynchronous mode, return the appropriate fetaures if (asynchronous_request_ ) { - return features_with_context(q,boost::make_shared()); + return features_with_context(q,std::make_shared()); } else { @@ -680,7 +680,7 @@ featureset_ptr postgis_datasource::features_with_context(query const& q,processo if ( asynchronous_request_ ) { // limit use to num_async_request_ => if reached don't borrow the last connexion object - boost::shared_ptr pgis_ctxt = boost::static_pointer_cast(proc_ctx); + std::shared_ptr pgis_ctxt = std::static_pointer_cast(proc_ctx); if ( pgis_ctxt->num_async_requests_ < max_async_connections_ ) { conn = pool->borrowObject(); @@ -743,7 +743,7 @@ featureset_ptr postgis_datasource::features_with_context(query const& q,processo s << ") AS geom"; - mapnik::context_ptr ctx = boost::make_shared(); + mapnik::context_ptr ctx = std::make_shared(); std::set const& props = q.property_names(); std::set::const_iterator pos = props.begin(); std::set::const_iterator end = props.end(); @@ -780,8 +780,8 @@ featureset_ptr postgis_datasource::features_with_context(query const& q,processo s << " LIMIT " << row_limit_; } - boost::shared_ptr rs = get_resultset(conn, s.str(), pool, proc_ctx); - return boost::make_shared(rs, ctx, desc_.get_encoding(), !key_field_.empty()); + std::shared_ptr rs = get_resultset(conn, s.str(), pool, proc_ctx); + return std::make_shared(rs, ctx, desc_.get_encoding(), !key_field_.empty()); } @@ -827,7 +827,7 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double t std::ostringstream s; s << "SELECT ST_AsBinary(\"" << geometryColumn_ << "\") AS geom"; - mapnik::context_ptr ctx = boost::make_shared(); + mapnik::context_ptr ctx = std::make_shared(); std::vector::const_iterator itr = desc_.get_descriptors().begin(); std::vector::const_iterator end = desc_.get_descriptors().end(); @@ -863,8 +863,8 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double t s << " LIMIT " << row_limit_; } - boost::shared_ptr rs = get_resultset(conn, s.str(), pool); - return boost::make_shared(rs, ctx, desc_.get_encoding(), !key_field_.empty()); + std::shared_ptr rs = get_resultset(conn, s.str(), pool); + return std::make_shared(rs, ctx, desc_.get_encoding(), !key_field_.empty()); } } diff --git a/plugins/input/postgis/postgis_datasource.hpp b/plugins/input/postgis/postgis_datasource.hpp index c55af9812..af9bd5a2e 100644 --- a/plugins/input/postgis/postgis_datasource.hpp +++ b/plugins/input/postgis/postgis_datasource.hpp @@ -36,10 +36,9 @@ // boost #include -#include -#include // stl +#include #include #include @@ -59,7 +58,7 @@ using mapnik::query; using mapnik::parameters; using mapnik::coord2d; -typedef boost::shared_ptr< ConnectionManager::PoolType> CnxPool_ptr; +typedef std::shared_ptr< ConnectionManager::PoolType> CnxPool_ptr; class postgis_datasource : public datasource { @@ -80,7 +79,7 @@ private: std::string sql_bbox(box2d const& env) const; std::string populate_tokens(std::string const& sql, double scale_denom, box2d const& env, double pixel_width, double pixel_height) const; std::string populate_tokens(std::string const& sql) const; - boost::shared_ptr get_resultset(boost::shared_ptr &conn, std::string const& sql, CnxPool_ptr const& pool, processor_context_ptr ctx= processor_context_ptr()) const; + std::shared_ptr get_resultset(std::shared_ptr &conn, std::string const& sql, CnxPool_ptr const& pool, processor_context_ptr ctx= processor_context_ptr()) const; static const std::string GEOMETRY_COLUMNS; static const std::string SPATIAL_REF_SYS; static const double FMAX; diff --git a/plugins/input/postgis/postgis_featureset.cpp b/plugins/input/postgis/postgis_featureset.cpp index d23c8edba..c0c23c939 100644 --- a/plugins/input/postgis/postgis_featureset.cpp +++ b/plugins/input/postgis/postgis_featureset.cpp @@ -34,8 +34,6 @@ #include #include #include // for int2net -#include - // boost #include // for boost::int16_t @@ -43,6 +41,7 @@ // stl #include #include +#include using mapnik::geometry_type; using mapnik::byte; @@ -50,7 +49,7 @@ using mapnik::geometry_utils; using mapnik::feature_factory; using mapnik::context_ptr; -postgis_featureset::postgis_featureset(boost::shared_ptr const& rs, +postgis_featureset::postgis_featureset(std::shared_ptr const& rs, context_ptr const& ctx, std::string const& encoding, bool key_field) @@ -238,7 +237,7 @@ std::string numeric2string(const char* buf) boost::int16_t sign = int2net(buf+4); boost::int16_t dscale = int2net(buf+6); - boost::scoped_array digits(new boost::int16_t[ndigits]); + const std::unique_ptr digits(new boost::int16_t[ndigits]); for (int n=0; n < ndigits ;++n) { digits[n] = int2net(buf+8+n*2); diff --git a/plugins/input/postgis/postgis_featureset.hpp b/plugins/input/postgis/postgis_featureset.hpp index e4ead4ab6..a3a2cbf1e 100644 --- a/plugins/input/postgis/postgis_featureset.hpp +++ b/plugins/input/postgis/postgis_featureset.hpp @@ -1,4 +1,3 @@ - /***************************************************************************** * * This file is part of Mapnik (c++ mapping toolkit) @@ -30,9 +29,6 @@ #include #include -// boost -#include - using mapnik::Featureset; using mapnik::box2d; using mapnik::feature_ptr; @@ -44,7 +40,7 @@ class IResultSet; class postgis_featureset : public mapnik::Featureset { public: - postgis_featureset(boost::shared_ptr const& rs, + postgis_featureset(std::shared_ptr const& rs, context_ptr const& ctx, std::string const& encoding, bool key_field = false); @@ -52,9 +48,9 @@ public: ~postgis_featureset(); private: - boost::shared_ptr rs_; + std::shared_ptr rs_; context_ptr ctx_; - boost::scoped_ptr tr_; + const std::unique_ptr tr_; unsigned totalGeomSize_; mapnik::value_integer feature_id_; bool key_field_; diff --git a/plugins/input/python/python_datasource.cpp b/plugins/input/python/python_datasource.cpp index 45a461b7c..bc490384a 100644 --- a/plugins/input/python/python_datasource.cpp +++ b/plugins/input/python/python_datasource.cpp @@ -7,7 +7,7 @@ #include // boost -#include + #include #include #include @@ -26,7 +26,7 @@ python_datasource::python_datasource(parameters const& params) factory_(*params.get("factory", "")) { // extract any remaining parameters as keyword args for the factory - BOOST_FOREACH(const mapnik::parameters::value_type& kv, params) + for (const mapnik::parameters::value_type& kv : params) { if((kv.first != "type") && (kv.first != "factory")) { @@ -73,7 +73,7 @@ python_datasource::python_datasource(parameters const& params) // prepare the arguments boost::python::dict kwargs; typedef std::map::value_type kv_type; - BOOST_FOREACH(const kv_type& kv, kwargs_) + for (kv_type const& kv : kwargs_) { kwargs[boost::python::str(kv.first)] = boost::python::str(kv.second); } @@ -202,7 +202,7 @@ mapnik::featureset_ptr python_datasource::features(mapnik::query const& q) const { return mapnik::featureset_ptr(); } - return boost::make_shared(features); + return std::make_shared(features); } // otherwise return an empty featureset pointer return mapnik::featureset_ptr(); @@ -226,7 +226,7 @@ mapnik::featureset_ptr python_datasource::features_at_point(mapnik::coord2d cons return mapnik::featureset_ptr(); } // otherwise, return a feature set which can iterate over the iterator - return boost::make_shared(features); + return std::make_shared(features); } catch ( boost::python::error_already_set ) { diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 5c1779836..3ba2a43e3 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -118,7 +118,7 @@ raster_datasource::raster_datasource(parameters const& params) try { - std::auto_ptr reader(mapnik::get_image_reader(filename_, format_)); + std::unique_ptr reader(mapnik::get_image_reader(filename_, format_)); if (reader.get()) { width_ = reader->width(); @@ -189,7 +189,7 @@ featureset_ptr raster_datasource::features(query const& q) const tiled_multi_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_, tile_stride_); - return boost::make_shared >(policy, extent_, q); + return std::make_shared >(policy, extent_, q); } else if (width * height > static_cast(tile_size_ * tile_size_ << 2)) { @@ -197,7 +197,7 @@ featureset_ptr raster_datasource::features(query const& q) const tiled_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_); - return boost::make_shared >(policy, extent_, q); + return std::make_shared >(policy, extent_, q); } else { @@ -206,7 +206,7 @@ featureset_ptr raster_datasource::features(query const& q) const raster_info info(filename_, format_, extent_, width_, height_); single_file_policy policy(info); - return boost::make_shared >(policy, extent_, q); + return std::make_shared >(policy, extent_, q); } } diff --git a/plugins/input/raster/raster_datasource.hpp b/plugins/input/raster/raster_datasource.hpp index 381a6568f..96bcaf16b 100644 --- a/plugins/input/raster/raster_datasource.hpp +++ b/plugins/input/raster/raster_datasource.hpp @@ -34,7 +34,7 @@ // boost #include -#include +#include // stl #include diff --git a/plugins/input/raster/raster_featureset.cpp b/plugins/input/raster/raster_featureset.cpp index 6a337cfd8..370d497ce 100644 --- a/plugins/input/raster/raster_featureset.cpp +++ b/plugins/input/raster/raster_featureset.cpp @@ -49,7 +49,7 @@ raster_featureset::raster_featureset(LookupPolicy const& policy, query const& q) : policy_(policy), feature_id_(1), - ctx_(boost::make_shared()), + ctx_(std::make_shared()), extent_(extent), bbox_(q.get_bbox()), curIter_(policy_.begin()), @@ -71,7 +71,7 @@ feature_ptr raster_featureset::next() try { - std::auto_ptr reader(mapnik::get_image_reader(curIter_->file(),curIter_->format())); + std::unique_ptr reader(mapnik::get_image_reader(curIter_->file(),curIter_->format())); MAPNIK_LOG_DEBUG(raster) << "raster_featureset: Reader=" << curIter_->format() << "," << curIter_->file() << ",size(" << curIter_->width() << "," << curIter_->height() << ")"; @@ -114,7 +114,7 @@ feature_ptr raster_featureset::next() rem.maxy() + y_off + height); intersect = t.backward(feature_raster_extent); - mapnik::raster_ptr raster = boost::make_shared(intersect, width, height); + mapnik::raster_ptr raster = std::make_shared(intersect, width, height); reader->read(x_off, y_off, raster->data_); raster->premultiplied_alpha_ = reader->premultiplied_alpha(); feature->set_raster(raster); diff --git a/plugins/input/rasterlite/rasterlite_datasource.cpp b/plugins/input/rasterlite/rasterlite_datasource.cpp index 7b9d67861..ecc9d9af9 100644 --- a/plugins/input/rasterlite/rasterlite_datasource.cpp +++ b/plugins/input/rasterlite/rasterlite_datasource.cpp @@ -182,12 +182,11 @@ layer_descriptor rasterlite_datasource::get_descriptor() const featureset_ptr rasterlite_datasource::features(query const& q) const { rasterlite_query gq = q; - return boost::make_shared(open_dataset(), gq); + return std::make_shared(open_dataset(), gq); } featureset_ptr rasterlite_datasource::features_at_point(coord2d const& pt, double tol) const { rasterlite_query gq = pt; - return boost::make_shared(open_dataset(), gq); + return std::make_shared(open_dataset(), gq); } - diff --git a/plugins/input/rasterlite/rasterlite_datasource.hpp b/plugins/input/rasterlite/rasterlite_datasource.hpp index f5b46584b..da5257766 100644 --- a/plugins/input/rasterlite/rasterlite_datasource.hpp +++ b/plugins/input/rasterlite/rasterlite_datasource.hpp @@ -34,7 +34,7 @@ // boost #include -#include +#include // stl #include diff --git a/plugins/input/rasterlite/rasterlite_featureset.cpp b/plugins/input/rasterlite/rasterlite_featureset.cpp index 7eb7a0ee7..52554d7aa 100644 --- a/plugins/input/rasterlite/rasterlite_featureset.cpp +++ b/plugins/input/rasterlite/rasterlite_featureset.cpp @@ -48,7 +48,7 @@ rasterlite_featureset::rasterlite_featureset(void* dataset, : dataset_(dataset), gquery_(q), first_(true), - ctx_(boost::make_shared()) + ctx_(std::make_shared()) { rasterliteSetBackgroundColor(dataset_, 255, 0, 255); rasterliteSetTransparentColor(dataset_, 255, 0, 255); @@ -129,7 +129,7 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q) { if (size > 0) { - mapnik::raster_ptr rasterp = boost::make_shared(intersect, width, height); + mapnik::raster_ptr rasterp = std::make_shared(intersect, width, height); mapnik::image_data_32 & image = rasterp->data_; image.set(0xffffffff); diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index f147bb5a9..3077b7440 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -96,7 +96,7 @@ shape_datasource::shape_datasource(const parameters ¶ms) mapnik::progress_timer __stats2__(std::clog, "shape_datasource::init(get_column_description)"); #endif - boost::shared_ptr shape_ref = boost::make_shared(shape_name_); + std::shared_ptr shape_ref = std::make_shared(shape_name_); init(*shape_ref); for (int i=0;idbf().num_fields();++i) { @@ -237,7 +237,7 @@ featureset_ptr shape_datasource::features(const query& q) const if (indexed_) { shape_->shp().seek(0); - // TODO - use boost::make_shared - #760 + // TODO - use std::make_shared - #760 return featureset_ptr (new shape_index_featureset(filter, *shape_, @@ -248,7 +248,7 @@ featureset_ptr shape_datasource::features(const query& q) const } else { - return boost::make_shared >(filter, + return std::make_shared >(filter, shape_name_, q.property_names(), desc_.get_encoding(), @@ -279,7 +279,7 @@ featureset_ptr shape_datasource::features_at_point(coord2d const& pt, double tol if (indexed_) { shape_->shp().seek(0); - // TODO - use boost::make_shared - #760 + // TODO - use std::make_shared - #760 return featureset_ptr (new shape_index_featureset(filter, *shape_, @@ -290,7 +290,7 @@ featureset_ptr shape_datasource::features_at_point(coord2d const& pt, double tol } else { - return boost::make_shared >(filter, + return std::make_shared >(filter, shape_name_, names, desc_.get_encoding(), diff --git a/plugins/input/shape/shape_datasource.hpp b/plugins/input/shape/shape_datasource.hpp index 9f98e3065..f4821bde6 100644 --- a/plugins/input/shape/shape_datasource.hpp +++ b/plugins/input/shape/shape_datasource.hpp @@ -35,7 +35,7 @@ // boost #include -#include +#include // stl #include @@ -68,7 +68,7 @@ private: datasource::datasource_t type_; std::string shape_name_; - boost::shared_ptr shape_; + std::shared_ptr shape_; shape_io::shapeType shape_type_; long file_length_; box2d extent_; diff --git a/plugins/input/shape/shape_featureset.cpp b/plugins/input/shape/shape_featureset.cpp index 4550d832b..540f58d0f 100644 --- a/plugins/input/shape/shape_featureset.cpp +++ b/plugins/input/shape/shape_featureset.cpp @@ -53,7 +53,7 @@ shape_featureset::shape_featureset(filterT const& filter, file_length_(file_length), row_limit_(row_limit), count_(0), - ctx_(boost::make_shared()) + ctx_(std::make_shared()) { shape_.shp().skip(100); setup_attributes(ctx_, attribute_names, shape_name, shape_,attr_ids_); @@ -89,9 +89,9 @@ feature_ptr shape_featureset::next() double y = record.read_double(); if (!filter_.pass(mapnik::box2d(x,y,x,y))) continue; - std::auto_ptr point(new geometry_type(mapnik::Point)); + std::unique_ptr point(new geometry_type(mapnik::geometry_type::types::Point)); point->move_to(x, y); - feature->paths().push_back(point); + feature->paths().push_back(point.release()); break; } case shape_io::shape_multipoint: @@ -105,9 +105,9 @@ feature_ptr shape_featureset::next() { double x = record.read_double(); double y = record.read_double(); - std::auto_ptr point(new geometry_type(mapnik::Point)); + std::unique_ptr point(new geometry_type(mapnik::geometry_type::types::Point)); point->move_to(x, y); - feature->paths().push_back(point); + feature->paths().push_back(point.release()); } break; } diff --git a/plugins/input/shape/shape_featureset.hpp b/plugins/input/shape/shape_featureset.hpp index cc643a511..a71e59e65 100644 --- a/plugins/input/shape/shape_featureset.hpp +++ b/plugins/input/shape/shape_featureset.hpp @@ -33,7 +33,7 @@ #include "shape_io.hpp" //boost -#include + #include using mapnik::Featureset; @@ -60,7 +60,7 @@ private: shape_io shape_; box2d query_ext_; mutable box2d feature_bbox_; - boost::scoped_ptr tr_; + const std::unique_ptr tr_; long file_length_; std::vector attr_ids_; mapnik::value_integer row_limit_; diff --git a/plugins/input/shape/shape_index_featureset.cpp b/plugins/input/shape/shape_index_featureset.cpp index 6c1b0f46b..5b402c9f5 100644 --- a/plugins/input/shape/shape_index_featureset.cpp +++ b/plugins/input/shape/shape_index_featureset.cpp @@ -49,7 +49,7 @@ shape_index_featureset::shape_index_featureset(filterT const& filter, std::string const& shape_name, int row_limit) : filter_(filter), - ctx_(boost::make_shared()), + ctx_(std::make_shared()), shape_(shape), tr_(new mapnik::transcoder(encoding)), row_limit_(row_limit), @@ -59,7 +59,7 @@ shape_index_featureset::shape_index_featureset(filterT const& filter, shape_.shp().skip(100); setup_attributes(ctx_, attribute_names, shape_name, shape_,attr_ids_); - boost::shared_ptr index = shape_.index(); + std::shared_ptr index = shape_.index(); if (index) { #ifdef SHAPE_MEMORY_MAPPED_FILE @@ -101,9 +101,9 @@ feature_ptr shape_index_featureset::next() { double x = record.read_double(); double y = record.read_double(); - std::auto_ptr point(new geometry_type(mapnik::Point)); + std::unique_ptr point(new geometry_type(mapnik::geometry_type::types::Point)); point->move_to(x, y); - feature->paths().push_back(point); + feature->paths().push_back(point.release()); break; } case shape_io::shape_multipoint: @@ -117,9 +117,9 @@ feature_ptr shape_index_featureset::next() { double x = record.read_double(); double y = record.read_double(); - std::auto_ptr point(new geometry_type(mapnik::Point)); + std::unique_ptr point(new geometry_type(mapnik::geometry_type::types::Point)); point->move_to(x, y); - feature->paths().push_back(point); + feature->paths().push_back(point.release()); } break; } diff --git a/plugins/input/shape/shape_index_featureset.hpp b/plugins/input/shape/shape_index_featureset.hpp index 5863b3246..0d860792f 100644 --- a/plugins/input/shape/shape_index_featureset.hpp +++ b/plugins/input/shape/shape_index_featureset.hpp @@ -34,7 +34,7 @@ #include // boost -#include + #include #include "shape_datasource.hpp" @@ -62,7 +62,7 @@ private: filterT filter_; context_ptr ctx_; shape_io & shape_; - boost::scoped_ptr tr_; + const std::unique_ptr tr_; std::vector offsets_; std::vector::iterator itr_; std::vector attr_ids_; diff --git a/plugins/input/shape/shape_io.cpp b/plugins/input/shape/shape_io.cpp index bbeb14276..a2c9ce680 100644 --- a/plugins/input/shape/shape_io.cpp +++ b/plugins/input/shape/shape_io.cpp @@ -53,7 +53,7 @@ shape_io::shape_io(std::string const& shape_name, bool open_index) { try { - index_= boost::make_shared(shape_name + INDEX); + index_= std::make_shared(shape_name + INDEX); } catch (...) { @@ -96,7 +96,7 @@ void shape_io::read_polyline( shape_file::record_type & record, mapnik::geometry int num_points = record.read_ndr_integer(); if (num_parts == 1) { - std::auto_ptr line(new geometry_type(mapnik::LineString)); + std::unique_ptr line(new geometry_type(mapnik::geometry_type::types::LineString)); record.skip(4); double x = record.read_double(); double y = record.read_double(); @@ -107,7 +107,7 @@ void shape_io::read_polyline( shape_file::record_type & record, mapnik::geometry y = record.read_double(); line->line_to(x, y); } - geom.push_back(line); + geom.push_back(line.release()); } else { @@ -120,7 +120,7 @@ void shape_io::read_polyline( shape_file::record_type & record, mapnik::geometry int start, end; for (int k = 0; k < num_parts; ++k) { - std::auto_ptr line(new geometry_type(mapnik::LineString)); + std::unique_ptr line(new geometry_type(mapnik::geometry_type::types::LineString)); start = parts[k]; if (k == num_parts - 1) { @@ -141,7 +141,7 @@ void shape_io::read_polyline( shape_file::record_type & record, mapnik::geometry y = record.read_double(); line->line_to(x, y); } - geom.push_back(line); + geom.push_back(line.release()); } } } @@ -159,7 +159,7 @@ void shape_io::read_polygon(shape_file::record_type & record, mapnik::geometry_c for (int k = 0; k < num_parts; ++k) { - std::auto_ptr poly(new geometry_type(mapnik::Polygon)); + std::unique_ptr poly(new geometry_type(mapnik::geometry_type::types::Polygon)); int start = parts[k]; int end; if (k == num_parts - 1) @@ -181,6 +181,6 @@ void shape_io::read_polygon(shape_file::record_type & record, mapnik::geometry_c poly->line_to(x, y); } poly->close_path(); - geom.push_back(poly); + geom.push_back(poly.release()); } } diff --git a/plugins/input/shape/shape_io.hpp b/plugins/input/shape/shape_io.hpp index 34d091f8f..24111f655 100644 --- a/plugins/input/shape/shape_io.hpp +++ b/plugins/input/shape/shape_io.hpp @@ -29,7 +29,7 @@ #include // boost -#include +#include #include "dbfile.hpp" #include "shapefile.hpp" @@ -61,7 +61,7 @@ public: shape_file& shp(); dbf_file& dbf(); - inline boost::shared_ptr& index() + inline std::shared_ptr& index() { return index_; } @@ -79,7 +79,7 @@ public: shapeType type_; shape_file shp_; dbf_file dbf_; - boost::shared_ptr index_; + std::shared_ptr index_; unsigned reclength_; unsigned id_; box2d cur_extent_; diff --git a/plugins/input/sqlite/sqlite_connection.hpp b/plugins/input/sqlite/sqlite_connection.hpp index 54908434b..e508740bd 100644 --- a/plugins/input/sqlite/sqlite_connection.hpp +++ b/plugins/input/sqlite/sqlite_connection.hpp @@ -32,7 +32,7 @@ #include // boost -#include +#include #include #include @@ -116,7 +116,7 @@ public: throw mapnik::datasource_exception (s.str()); } - boost::shared_ptr execute_query(std::string const& sql) + std::shared_ptr execute_query(std::string const& sql) { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, std::string("sqlite_resultset::execute_query ") + sql); @@ -129,7 +129,7 @@ public: throw_sqlite_error(sql); } - return boost::make_shared(stmt); + return std::make_shared(stmt); } void execute(std::string const& sql) diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index f8e6e8da1..a4705e8b4 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -139,7 +139,7 @@ sqlite_datasource::sqlite_datasource(parameters const& params) } // now actually create the connection and start executing setup sql - dataset_ = boost::make_shared(dataset_name_); + dataset_ = std::make_shared(dataset_name_); boost::optional table_by_index = params.get("table_by_index"); @@ -300,7 +300,7 @@ sqlite_datasource::sqlite_datasource(parameters const& params) mapnik::progress_timer __stats2__(std::clog, "sqlite_datasource::init(create_spatial_index)"); #endif - boost::shared_ptr rs = dataset_->execute_query(query.str()); + std::shared_ptr rs = dataset_->execute_query(query.str()); if (sqlite_utils::create_spatial_index(index_db,index_table_,rs)) { //extent_initialized_ = true; @@ -437,7 +437,7 @@ boost::optional sqlite_datasource::get_geometry_ { s << " LIMIT 5"; } - boost::shared_ptr rs = dataset_->execute_query(s.str()); + std::shared_ptr rs = dataset_->execute_query(s.str()); int multi_type = 0; while (rs->is_valid() && rs->step_next()) { @@ -483,7 +483,7 @@ featureset_ptr sqlite_datasource::features(query const& q) const mapnik::box2d const& e = q.get_bbox(); std::ostringstream s; - mapnik::context_ptr ctx = boost::make_shared(); + mapnik::context_ptr ctx = std::make_shared(); s << "SELECT " << geometry_field_; if (!key_field_.empty()) @@ -536,9 +536,9 @@ featureset_ptr sqlite_datasource::features(query const& q) const MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: " << s.str(); - boost::shared_ptr rs(dataset_->execute_query(s.str())); + std::shared_ptr rs(dataset_->execute_query(s.str())); - return boost::make_shared(rs, + return std::make_shared(rs, ctx, desc_.get_encoding(), e, @@ -561,7 +561,7 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double to mapnik::box2d e(pt.x, pt.y, pt.x, pt.y); e.pad(tol); std::ostringstream s; - mapnik::context_ptr ctx = boost::make_shared(); + mapnik::context_ptr ctx = std::make_shared(); s << "SELECT " << geometry_field_; if (!key_field_.empty()) @@ -617,9 +617,9 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double to MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: " << s.str(); - boost::shared_ptr rs(dataset_->execute_query(s.str())); + std::shared_ptr rs(dataset_->execute_query(s.str())); - return boost::make_shared(rs, + return std::make_shared(rs, ctx, desc_.get_encoding(), e, diff --git a/plugins/input/sqlite/sqlite_datasource.hpp b/plugins/input/sqlite/sqlite_datasource.hpp index 516d632f6..db0bcfa07 100644 --- a/plugins/input/sqlite/sqlite_datasource.hpp +++ b/plugins/input/sqlite/sqlite_datasource.hpp @@ -36,7 +36,7 @@ // boost #include -#include +#include // stl #include @@ -68,7 +68,7 @@ private: bool extent_initialized_; mapnik::datasource::datasource_t type_; std::string dataset_name_; - boost::shared_ptr dataset_; + std::shared_ptr dataset_; std::string table_; std::string fields_; std::string metadata_; diff --git a/plugins/input/sqlite/sqlite_featureset.cpp b/plugins/input/sqlite/sqlite_featureset.cpp index 56b59effb..11530809d 100644 --- a/plugins/input/sqlite/sqlite_featureset.cpp +++ b/plugins/input/sqlite/sqlite_featureset.cpp @@ -43,7 +43,7 @@ using mapnik::geometry_utils; using mapnik::transcoder; using mapnik::feature_factory; -sqlite_featureset::sqlite_featureset(boost::shared_ptr rs, +sqlite_featureset::sqlite_featureset(std::shared_ptr rs, mapnik::context_ptr const& ctx, std::string const& encoding, mapnik::box2d const& bbox, diff --git a/plugins/input/sqlite/sqlite_featureset.hpp b/plugins/input/sqlite/sqlite_featureset.hpp index 9fc5356a7..6fc53602f 100644 --- a/plugins/input/sqlite/sqlite_featureset.hpp +++ b/plugins/input/sqlite/sqlite_featureset.hpp @@ -29,8 +29,8 @@ #include // boost -#include -#include + +#include // sqlite #include "sqlite_resultset.hpp" @@ -39,7 +39,7 @@ class sqlite_featureset : public mapnik::Featureset { public: - sqlite_featureset(boost::shared_ptr rs, + sqlite_featureset(std::shared_ptr rs, mapnik::context_ptr const& ctx, std::string const& encoding, mapnik::box2d const& bbox, @@ -50,9 +50,9 @@ public: mapnik::feature_ptr next(); private: - boost::shared_ptr rs_; + std::shared_ptr rs_; mapnik::context_ptr ctx_; - boost::scoped_ptr tr_; + const std::unique_ptr tr_; mapnik::box2d bbox_; mapnik::wkbFormat format_; bool spatial_index_; diff --git a/plugins/input/sqlite/sqlite_prepared.hpp b/plugins/input/sqlite/sqlite_prepared.hpp index f10ad7288..e05e5db62 100644 --- a/plugins/input/sqlite/sqlite_prepared.hpp +++ b/plugins/input/sqlite/sqlite_prepared.hpp @@ -31,7 +31,7 @@ #include // boost -#include +#include // stl #include @@ -47,7 +47,7 @@ class prepared_index_statement : mapnik::noncopyable { public: - prepared_index_statement(boost::shared_ptr ds, std::string const& sql) + prepared_index_statement(std::shared_ptr ds, std::string const& sql) : ds_(ds), stmt_(0) { @@ -133,7 +133,7 @@ public: } private: - boost::shared_ptr ds_; + std::shared_ptr ds_; sqlite3_stmt * stmt_; }; diff --git a/plugins/input/sqlite/sqlite_utils.hpp b/plugins/input/sqlite/sqlite_utils.hpp index b3cc4c025..bfb511870 100644 --- a/plugins/input/sqlite/sqlite_utils.hpp +++ b/plugins/input/sqlite/sqlite_utils.hpp @@ -38,7 +38,7 @@ #include // boost -#include +#include #include #include @@ -146,7 +146,7 @@ public: return false; } - static void get_tables(boost::shared_ptr ds, + static void get_tables(std::shared_ptr ds, std::vector & tables) { std::ostringstream sql; @@ -165,7 +165,7 @@ public: const int rc = sqlite3_prepare_v2 (*(*ds), sql.str().c_str(), -1, &stmt, 0); if (rc == SQLITE_OK) { - boost::shared_ptr rs = boost::make_shared(stmt); + std::shared_ptr rs = std::make_shared(stmt); while (rs->is_valid() && rs->step_next()) { const int type_oid = rs->column_type(0); @@ -181,7 +181,7 @@ public: } } - static void query_extent(boost::shared_ptr rs, + static void query_extent(std::shared_ptr rs, mapnik::box2d& extent) { @@ -218,7 +218,7 @@ public: static bool create_spatial_index(std::string const& index_db, std::string const& index_table, - boost::shared_ptr rs) + std::shared_ptr rs) { /* TODO - speedups @@ -236,7 +236,7 @@ public: #endif bool existed = mapnik::util::exists(index_db); - boost::shared_ptr ds = boost::make_shared(index_db,flags); + std::shared_ptr ds = std::make_shared(index_db,flags); bool one_success = false; try @@ -356,7 +356,7 @@ public: mapnik::box2d bbox; } rtree_type; - static void build_tree(boost::shared_ptr rs, + static void build_tree(std::shared_ptr rs, std::vector & rtree_list) { @@ -414,8 +414,8 @@ public: #endif bool existed = mapnik::util::exists(index_db);; - - boost::shared_ptr ds = boost::make_shared(index_db,flags); + + std::shared_ptr ds = std::make_shared(index_db,flags); bool one_success = false; try @@ -484,7 +484,7 @@ public: return false; } - static bool detect_extent(boost::shared_ptr ds, + static bool detect_extent(std::shared_ptr ds, bool has_spatial_index, mapnik::box2d & extent, std::string const& index_table, @@ -501,7 +501,7 @@ public: s << "SELECT xmin, ymin, xmax, ymax FROM " << metadata; s << " WHERE LOWER(f_table_name) = LOWER('" << geometry_table << "')"; MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: executing: '" << s.str() << "'"; - boost::shared_ptr rs(ds->execute_query(s.str())); + std::shared_ptr rs(ds->execute_query(s.str())); if (rs->is_valid() && rs->step_next()) { double xmin = rs->column_double(0); @@ -518,7 +518,7 @@ public: s << "SELECT MIN(xmin), MIN(ymin), MAX(xmax), MAX(ymax) FROM " << index_table; MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: executing: '" << s.str() << "'"; - boost::shared_ptr rs(ds->execute_query(s.str())); + std::shared_ptr rs(ds->execute_query(s.str())); if (rs->is_valid() && rs->step_next()) { if (! rs->column_isnull(0)) @@ -539,20 +539,20 @@ public: s << "SELECT " << geometry_field << "," << key_field << " FROM (" << table << ")"; MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: executing: '" << s.str() << "'"; - boost::shared_ptr rs(ds->execute_query(s.str())); + std::shared_ptr rs(ds->execute_query(s.str())); sqlite_utils::query_extent(rs,extent); return true; } return false; } - static bool has_rtree(std::string const& index_table,boost::shared_ptr ds) + static bool has_rtree(std::string const& index_table,std::shared_ptr ds) { try { std::ostringstream s; s << "SELECT pkid,xmin,xmax,ymin,ymax FROM " << index_table << " LIMIT 1"; - boost::shared_ptr rs = ds->execute_query(s.str()); + std::shared_ptr rs = ds->execute_query(s.str()); if (rs->is_valid() && rs->step_next()) { return true; @@ -569,10 +569,10 @@ public: static bool detect_types_from_subquery(std::string const& query, std::string & geometry_field, mapnik::layer_descriptor & desc, - boost::shared_ptr ds) + std::shared_ptr ds) { bool found = false; - boost::shared_ptr rs(ds->execute_query(query)); + std::shared_ptr rs(ds->execute_query(query)); if (rs->is_valid() && rs->step_next()) { for (int i = 0; i < rs->column_count(); ++i) @@ -627,7 +627,7 @@ public: std::string & field, std::string & table, mapnik::layer_descriptor & desc, - boost::shared_ptr ds) + std::shared_ptr ds) { // http://www.sqlite.org/pragma.html#pragma_table_info @@ -636,7 +636,7 @@ public: // if the subquery-based type detection failed std::ostringstream s; s << "PRAGMA table_info(" << table << ")"; - boost::shared_ptr rs(ds->execute_query(s.str())); + std::shared_ptr rs(ds->execute_query(s.str())); bool found_table = false; bool found_pk = false; while (rs->is_valid() && rs->step_next()) diff --git a/plugins/input/templates/helloworld/hello_datasource.cpp b/plugins/input/templates/helloworld/hello_datasource.cpp index 38b1d0e10..40cddd0d6 100644 --- a/plugins/input/templates/helloworld/hello_datasource.cpp +++ b/plugins/input/templates/helloworld/hello_datasource.cpp @@ -62,7 +62,7 @@ mapnik::featureset_ptr hello_datasource::features(mapnik::query const& q) const // if the query box intersects our world extent then query for features if (extent_.intersects(q.get_bbox())) { - return boost::make_shared(q.get_bbox(),desc_.get_encoding()); + return std::make_shared(q.get_bbox(),desc_.get_encoding()); } // otherwise return an empty featureset pointer diff --git a/plugins/input/templates/helloworld/hello_datasource.hpp b/plugins/input/templates/helloworld/hello_datasource.hpp index 018ff6f2f..432489dbe 100644 --- a/plugins/input/templates/helloworld/hello_datasource.hpp +++ b/plugins/input/templates/helloworld/hello_datasource.hpp @@ -12,7 +12,7 @@ // boost #include -#include +#include // stl #include diff --git a/plugins/input/templates/helloworld/hello_featureset.cpp b/plugins/input/templates/helloworld/hello_featureset.cpp index deaabdff3..90a122006 100644 --- a/plugins/input/templates/helloworld/hello_featureset.cpp +++ b/plugins/input/templates/helloworld/hello_featureset.cpp @@ -12,7 +12,7 @@ hello_featureset::hello_featureset(mapnik::box2d const& box, std::string : box_(box), feature_id_(1), tr_(new mapnik::transcoder(encoding)), - ctx_(boost::make_shared()) { } + ctx_(std::make_shared()) { } hello_featureset::~hello_featureset() { } @@ -69,4 +69,3 @@ mapnik::feature_ptr hello_featureset::next() // otherwise return an empty feature return mapnik::feature_ptr(); } - diff --git a/plugins/input/templates/helloworld/hello_featureset.hpp b/plugins/input/templates/helloworld/hello_featureset.hpp index b73f15070..43f338fad 100644 --- a/plugins/input/templates/helloworld/hello_featureset.hpp +++ b/plugins/input/templates/helloworld/hello_featureset.hpp @@ -7,7 +7,7 @@ #include // boost -#include // needed for wrapping the transcoder + // needed for wrapping the transcoder class hello_featureset : public mapnik::Featureset { @@ -25,7 +25,7 @@ private: // members are up to you, but these are recommended mapnik::box2d box_; mapnik::value_integer feature_id_; - boost::scoped_ptr tr_; + const std::unique_ptr tr_; mapnik::context_ptr ctx_; }; diff --git a/src/agg/agg_renderer.cpp b/src/agg/agg_renderer.cpp index 0c3367496..2ce356e35 100644 --- a/src/agg/agg_renderer.cpp +++ b/src/agg/agg_renderer.cpp @@ -77,7 +77,7 @@ agg_renderer::agg_renderer(Map const& m, T & pixmap, double scale_factor, uns t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), font_engine_(), font_manager_(font_engine_), - detector_(boost::make_shared(box2d(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size()))), + detector_(std::make_shared(box2d(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size()))), ras_ptr(new rasterizer), query_extent_(), gamma_method_(GAMMA_POWER), @@ -99,7 +99,7 @@ agg_renderer::agg_renderer(Map const& m, request const& req, T & pixmap, doub t_(req.width(),req.height(),req.extent(),offset_x,offset_y), font_engine_(), font_manager_(font_engine_), - detector_(boost::make_shared(box2d(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))), + detector_(std::make_shared(box2d(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))), ras_ptr(new rasterizer), query_extent_(), gamma_method_(GAMMA_POWER), @@ -109,7 +109,7 @@ agg_renderer::agg_renderer(Map const& m, request const& req, T & pixmap, doub } template -agg_renderer::agg_renderer(Map const& m, T & pixmap, boost::shared_ptr detector, +agg_renderer::agg_renderer(Map const& m, T & pixmap, std::shared_ptr detector, double scale_factor, unsigned offset_x, unsigned offset_y) : feature_style_processor(m, scale_factor), pixmap_(pixmap), @@ -240,7 +240,7 @@ void agg_renderer::start_style_processing(feature_type_style const& st) { if (!internal_buffer_) { - internal_buffer_ = boost::make_shared(pixmap_.width(),pixmap_.height()); + internal_buffer_ = std::make_shared(pixmap_.width(),pixmap_.height()); } else { @@ -264,7 +264,7 @@ void agg_renderer::end_style_processing(feature_type_style const& st) { blend_from = true; mapnik::filter::filter_visitor visitor(*current_buffer_); - BOOST_FOREACH(mapnik::filter::filter_type const& filter_tag, st.image_filters()) + for (mapnik::filter::filter_type const& filter_tag : st.image_filters()) { boost::apply_visitor(visitor, filter_tag); } @@ -281,7 +281,7 @@ void agg_renderer::end_style_processing(feature_type_style const& st) } // apply any 'direct' image filters mapnik::filter::filter_visitor visitor(pixmap_); - BOOST_FOREACH(mapnik::filter::filter_type const& filter_tag, st.direct_image_filters()) + for (mapnik::filter::filter_type const& filter_tag : st.direct_image_filters()) { boost::apply_visitor(visitor, filter_tag); } diff --git a/src/agg/process_building_symbolizer.cpp b/src/agg/process_building_symbolizer.cpp index 314b02ca1..1c3b80e89 100644 --- a/src/agg/process_building_symbolizer.cpp +++ b/src/agg/process_building_symbolizer.cpp @@ -31,7 +31,7 @@ #include // boost -#include + // stl #include @@ -91,8 +91,8 @@ void agg_renderer::process(building_symbolizer const& sym, geometry_type const& geom = feature.get_geometry(i); if (geom.size() > 2) { - boost::scoped_ptr frame(new geometry_type(LineString)); - boost::scoped_ptr roof(new geometry_type(Polygon)); + const std::unique_ptr frame(new geometry_type(geometry_type::types::LineString)); + const std::unique_ptr roof(new geometry_type(geometry_type::types::Polygon)); std::deque face_segments; double x0 = 0; double y0 = 0; @@ -124,7 +124,7 @@ void agg_renderer::process(building_symbolizer const& sym, for (; itr!=end; ++itr) { - boost::scoped_ptr faces(new geometry_type(Polygon)); + const std::unique_ptr faces(new geometry_type(geometry_type::types::Polygon)); faces->move_to(itr->get<0>(),itr->get<1>()); faces->line_to(itr->get<2>(),itr->get<3>()); faces->line_to(itr->get<2>(),itr->get<3>() + height); diff --git a/src/agg/process_line_pattern_symbolizer.cpp b/src/agg/process_line_pattern_symbolizer.cpp index fd18d4242..d7b49e408 100644 --- a/src/agg/process_line_pattern_symbolizer.cpp +++ b/src/agg/process_line_pattern_symbolizer.cpp @@ -50,7 +50,7 @@ #include "agg_conv_clip_polyline.h" // boost -#include + namespace { @@ -151,7 +151,7 @@ void agg_renderer::process(line_pattern_symbolizer const& sym, if (fabs(sym.offset()) > 0.0) converter.set(); // parallel offset if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH(geometry_type & geom, feature.paths()) + for (geometry_type & geom : feature.paths()) { if (geom.size() > 1) { diff --git a/src/agg/process_line_symbolizer.cpp b/src/agg/process_line_symbolizer.cpp index bf7dcd2fb..00e5ce200 100644 --- a/src/agg/process_line_symbolizer.cpp +++ b/src/agg/process_line_symbolizer.cpp @@ -45,7 +45,7 @@ #include "agg_rasterizer_outline_aa.h" // boost -#include + // stl #include @@ -129,7 +129,7 @@ void agg_renderer::process(line_symbolizer const& sym, if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH( geometry_type & geom, feature.paths()) + for (geometry_type & geom : feature.paths()) { if (geom.size() > 1) { @@ -152,7 +152,7 @@ void agg_renderer::process(line_symbolizer const& sym, if (stroke_.has_dash()) converter.set(); converter.set(); //always stroke - BOOST_FOREACH( geometry_type & geom, feature.paths()) + for (geometry_type & geom : feature.paths()) { if (geom.size() > 1) { diff --git a/src/agg/process_markers_symbolizer.cpp b/src/agg/process_markers_symbolizer.cpp index 2e8b5469d..33e207413 100644 --- a/src/agg/process_markers_symbolizer.cpp +++ b/src/agg/process_markers_symbolizer.cpp @@ -142,8 +142,8 @@ void agg_renderer::process(markers_symbolizer const& sym, converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) { - eGeomType type = feature.paths()[0].type(); - if (type == Polygon) + geometry_type::types type = feature.paths()[0].type(); + if (type == geometry_type::types::Polygon) converter.template set(); // line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426 //else if (type == LineString) @@ -182,8 +182,8 @@ void agg_renderer::process(markers_symbolizer const& sym, converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) { - eGeomType type = feature.paths()[0].type(); - if (type == Polygon) + geometry_type::types type = feature.paths()[0].type(); + if (type == geometry_type::types::Polygon) converter.template set(); // line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426 //else if (type == LineString) @@ -220,13 +220,13 @@ void agg_renderer::process(markers_symbolizer const& sym, if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) { - eGeomType type = feature.paths()[0].type(); - if (type == Polygon) + geometry_type::types type = feature.paths()[0].type(); + if (type == geometry_type::types::Polygon) converter.template set(); // line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426 - //else if (type == LineString) + //else if (type == geometry_type::types::LineString) // converter.template set(); - // don't clip if type==Point + // don't clip if type==geometry_type::types::Point } converter.template set(); //always transform if (sym.smooth() > 0.0) converter.template set(); // optional smooth converter diff --git a/src/agg/process_point_symbolizer.cpp b/src/agg/process_point_symbolizer.cpp index 9046455b5..e7c3631a3 100644 --- a/src/agg/process_point_symbolizer.cpp +++ b/src/agg/process_point_symbolizer.cpp @@ -60,7 +60,7 @@ void agg_renderer::process(point_symbolizer const& sym, } else { - marker.reset(boost::make_shared()); + marker.reset(std::make_shared()); } if (marker) diff --git a/src/agg/process_polygon_pattern_symbolizer.cpp b/src/agg/process_polygon_pattern_symbolizer.cpp index 71e5b0def..a38cbb093 100644 --- a/src/agg/process_polygon_pattern_symbolizer.cpp +++ b/src/agg/process_polygon_pattern_symbolizer.cpp @@ -21,7 +21,7 @@ *****************************************************************************/ // boost -#include + // mapnik #include @@ -157,7 +157,7 @@ void agg_renderer::process(polygon_pattern_symbolizer const& sym, if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH( geometry_type & geom, feature.paths()) + for ( geometry_type & geom : feature.paths()) { if (geom.size() > 2) { diff --git a/src/agg/process_polygon_symbolizer.cpp b/src/agg/process_polygon_symbolizer.cpp index 25e2f09a2..360b41783 100644 --- a/src/agg/process_polygon_symbolizer.cpp +++ b/src/agg/process_polygon_symbolizer.cpp @@ -21,7 +21,7 @@ *****************************************************************************/ // boost -#include + // mapnik #include @@ -70,7 +70,7 @@ void agg_renderer::process(polygon_symbolizer const& sym, if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH( geometry_type & geom, feature.paths()) + for (geometry_type & geom : feature.paths()) { if (geom.size() > 2) { diff --git a/src/box2d.cpp b/src/box2d.cpp index bb04615f4..6f7001feb 100644 --- a/src/box2d.cpp +++ b/src/box2d.cpp @@ -70,6 +70,13 @@ box2d::box2d(box2d_type const& rhs) maxx_(rhs.maxx_), maxy_(rhs.maxy_) {} +template +box2d::box2d(box2d_type && rhs) + : minx_(std::move(rhs.minx_)), + miny_(std::move(rhs.miny_)), + maxx_(std::move(rhs.maxx_)), + maxy_(std::move(rhs.maxy_)) {} + template box2d& box2d::operator=(box2d_type other) { diff --git a/src/cairo_context.cpp b/src/cairo_context.cpp index cf04116f3..e2eebc217 100644 --- a/src/cairo_context.cpp +++ b/src/cairo_context.cpp @@ -31,7 +31,7 @@ #include namespace mapnik { -cairo_face::cairo_face(boost::shared_ptr const& engine, face_ptr const& face) +cairo_face::cairo_face(std::shared_ptr const& engine, face_ptr const& face) : face_(face) { static cairo_user_data_key_t key; diff --git a/src/cairo_renderer.cpp b/src/cairo_renderer.cpp index 9d58202e0..aa1207256 100644 --- a/src/cairo_renderer.cpp +++ b/src/cairo_renderer.cpp @@ -96,7 +96,7 @@ struct cairo_save_restore }; -cairo_face_manager::cairo_face_manager(boost::shared_ptr engine) +cairo_face_manager::cairo_face_manager(std::shared_ptr engine) : font_engine_(engine) { } @@ -112,7 +112,7 @@ cairo_face_ptr cairo_face_manager::get_face(face_ptr face) } else { - entry = boost::make_shared(font_engine_, face); + entry = std::make_shared(font_engine_, face); cache_.insert(std::make_pair(face, entry)); } @@ -131,10 +131,10 @@ cairo_renderer_base::cairo_renderer_base(Map const& m, height_(m.height()), scale_factor_(scale_factor), t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), - font_engine_(boost::make_shared()), + font_engine_(std::make_shared()), font_manager_(*font_engine_), face_manager_(font_engine_), - detector_(boost::make_shared( + detector_(std::make_shared( box2d(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size(), m.height() + m.buffer_size()))) { @@ -153,10 +153,10 @@ cairo_renderer_base::cairo_renderer_base(Map const& m, height_(req.height()), scale_factor_(scale_factor), t_(req.width(),req.height(),req.extent(),offset_x,offset_y), - font_engine_(boost::make_shared()), + font_engine_(std::make_shared()), font_manager_(*font_engine_), face_manager_(font_engine_), - detector_(boost::make_shared( + detector_(std::make_shared( box2d(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size(), req.height() + req.buffer_size()))) { @@ -165,7 +165,7 @@ cairo_renderer_base::cairo_renderer_base(Map const& m, cairo_renderer_base::cairo_renderer_base(Map const& m, cairo_ptr const& cairo, - boost::shared_ptr detector, + std::shared_ptr detector, double scale_factor, unsigned offset_x, unsigned offset_y) @@ -175,7 +175,7 @@ cairo_renderer_base::cairo_renderer_base(Map const& m, height_(m.height()), scale_factor_(scale_factor), t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), - font_engine_(boost::make_shared()), + font_engine_(std::make_shared()), font_manager_(*font_engine_), face_manager_(font_engine_), detector_(detector) @@ -204,12 +204,12 @@ cairo_renderer::cairo_renderer(Map const& m, request const& r cairo_renderer_base(m,req, create_context(surface),scale_factor,offset_x,offset_y) {} template <> -cairo_renderer::cairo_renderer(Map const& m, cairo_ptr const& cairo, boost::shared_ptr detector, double scale_factor, unsigned offset_x, unsigned offset_y) +cairo_renderer::cairo_renderer(Map const& m, cairo_ptr const& cairo, std::shared_ptr detector, double scale_factor, unsigned offset_x, unsigned offset_y) : feature_style_processor(m,scale_factor), cairo_renderer_base(m,cairo,detector,scale_factor,offset_x,offset_y) {} template <> -cairo_renderer::cairo_renderer(Map const& m, cairo_surface_ptr const& surface, boost::shared_ptr detector, double scale_factor, unsigned offset_x, unsigned offset_y) +cairo_renderer::cairo_renderer(Map const& m, cairo_surface_ptr const& surface, std::shared_ptr detector, double scale_factor, unsigned offset_x, unsigned offset_y) : feature_style_processor(m,scale_factor), cairo_renderer_base(m,create_context(surface),detector,scale_factor,offset_x,offset_y) {} @@ -327,7 +327,7 @@ void cairo_renderer_base::process(polygon_symbolizer const& sym, if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH( geometry_type & geom, feature.paths()) + for ( geometry_type & geom : feature.paths()) { if (geom.size() > 2) { @@ -360,8 +360,8 @@ void cairo_renderer_base::process(building_symbolizer const& sym, if (geom.size() > 2) { - boost::scoped_ptr frame(new geometry_type(LineString)); - boost::scoped_ptr roof(new geometry_type(Polygon)); + const std::unique_ptr frame(new geometry_type(geometry_type::types::LineString)); + const std::unique_ptr roof(new geometry_type(geometry_type::types::Polygon)); std::deque face_segments; double x0 = 0; double y0 = 0; @@ -392,7 +392,7 @@ void cairo_renderer_base::process(building_symbolizer const& sym, std::deque::const_iterator end=face_segments.end(); for (; itr != end; ++itr) { - boost::scoped_ptr faces(new geometry_type(Polygon)); + const std::unique_ptr faces(new geometry_type(geometry_type::types::Polygon)); faces->move_to(itr->get<0>(), itr->get<1>()); faces->line_to(itr->get<2>(), itr->get<3>()); faces->line_to(itr->get<2>(), itr->get<3>() + height); @@ -490,7 +490,7 @@ void cairo_renderer_base::process(line_symbolizer const& sym, if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH( geometry_type & geom, feature.paths()) + for (geometry_type & geom : feature.paths()) { if (geom.size() > 1) { @@ -658,7 +658,7 @@ void cairo_renderer_base::process(point_symbolizer const& sym, } else { - marker.reset(boost::make_shared()); + marker.reset(std::make_shared()); } @@ -865,7 +865,7 @@ void cairo_renderer_base::process(polygon_pattern_symbolizer const& sym, if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH( geometry_type & geom, feature.paths()) + for ( geometry_type & geom : feature.paths()) { if (geom.size() > 2) { @@ -987,11 +987,11 @@ struct markers_dispatch 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; @@ -1076,11 +1076,11 @@ struct markers_dispatch_2 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; @@ -1200,13 +1200,13 @@ void cairo_renderer_base::process(markers_symbolizer const& sym, if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) { - eGeomType type = feature.paths()[0].type(); - if (type == Polygon) + geometry_type::types type = feature.paths()[0].type(); + if (type == geometry_type::types::Polygon) converter.set(); // line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426 - //else if (type == LineString) + //else if (type == geometry_type::types::LineString) // converter.template set(); - // don't clip if type==Point + // don't clip if type==geometry_type::types::Point } converter.set(); //always transform if (sym.smooth() > 0.0) converter.set(); // optional smooth converter @@ -1225,13 +1225,13 @@ void cairo_renderer_base::process(markers_symbolizer const& sym, if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) { - eGeomType type = feature.paths()[0].type(); - if (type == Polygon) + geometry_type::types type = feature.paths()[0].type(); + if (type == geometry_type::types::Polygon) converter.set(); // line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426 - //else if (type == LineString) + //else if (type == geometry_type::types::LineString) // converter.template set(); - // don't clip if type==Point + // don't clip if type==geometry_type::types::Point } converter.set(); //always transform if (sym.smooth() > 0.0) converter.set(); // optional smooth converter @@ -1255,13 +1255,13 @@ void cairo_renderer_base::process(markers_symbolizer const& sym, if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) { - eGeomType type = feature.paths()[0].type(); - if (type == Polygon) + geometry_type::types type = feature.paths()[0].type(); + if (type == geometry_type::types::Polygon) converter.set(); // line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426 - //else if (type == LineString) + //else if (type == geometry_type::types::LineString) // converter.template set(); - // don't clip if type==Point + // don't clip if type==geometry_type::types::Point } converter.set(); //always transform if (sym.smooth() > 0.0) converter.set(); // optional smooth converter diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 9773bb2be..57b46547d 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -82,7 +82,7 @@ datasource_ptr datasource_cache::create(parameters const& params) mutex::scoped_lock lock(mutex_); #endif - std::map >::iterator itr=plugins_.find(*type); + std::map >::iterator itr=plugins_.find(*type); if (itr == plugins_.end()) { std::string s("Could not create datasource for type: '"); @@ -152,7 +152,7 @@ std::vector datasource_cache::plugin_names() names = get_static_datasource_names(); #endif - std::map >::const_iterator itr; + std::map >::const_iterator itr; for (itr = plugins_.begin(); itr != plugins_.end(); ++itr) { names.push_back(itr->first); @@ -198,7 +198,7 @@ bool datasource_cache::register_datasource(std::string const& filename) bool success = false; try { - boost::shared_ptr plugin = boost::make_shared(filename,"datasource_name"); + std::shared_ptr plugin = std::make_shared(filename,"datasource_name"); if (plugin->valid()) { if (plugin->name().empty()) diff --git a/src/datasource_cache_static.cpp b/src/datasource_cache_static.cpp index 07e178ca4..93305dff4 100644 --- a/src/datasource_cache_static.cpp +++ b/src/datasource_cache_static.cpp @@ -87,7 +87,7 @@ namespace mapnik { template datasource_ptr ds_generator(parameters const& params) { - return boost::make_shared(params); + return std::make_shared(params); } typedef datasource_ptr (*ds_generator_ptr)(parameters const& params); diff --git a/src/deepcopy.cpp b/src/deepcopy.cpp index e34b7f36a..9ba0b9662 100644 --- a/src/deepcopy.cpp +++ b/src/deepcopy.cpp @@ -44,7 +44,7 @@ // boost #include -#include + namespace mapnik { namespace util { @@ -100,12 +100,12 @@ namespace mapnik { namespace util { // fontsets typedef std::map fontsets; - BOOST_FOREACH ( fontsets::value_type const& kv,map_in.fontsets()) + for (fontsets::value_type const& kv : map_in.fontsets()) { map_out.insert_fontset(kv.first,kv.second); } - BOOST_FOREACH ( layer const& lyr_in, map_in.layers()) + for ( layer const& lyr_in : map_in.layers()) { layer lyr_out(lyr_in); datasource_ptr ds_in = lyr_in.datasource(); @@ -126,7 +126,7 @@ namespace mapnik { namespace util { typedef style_cont::value_type value_type; style_cont const& styles = map_in.styles(); - BOOST_FOREACH ( value_type const& kv, styles ) + for ( value_type const& kv : styles ) { feature_type_style const& style_in = kv.second; feature_type_style style_out(style_in,true); // deep copy diff --git a/src/expression.cpp b/src/expression.cpp index 44629de63..0de07ff65 100644 --- a/src/expression.cpp +++ b/src/expression.cpp @@ -50,7 +50,7 @@ expression_ptr parse_expression(std::string const& str, bool r = boost::spirit::qi::phrase_parse(itr, end, g, boost::spirit::standard_wide::space, node); if (r && itr == end) { - return boost::make_shared(node); + return std::make_shared(node); } else { diff --git a/src/feature_type_style.cpp b/src/feature_type_style.cpp index f850a86f8..733a73d8e 100644 --- a/src/feature_type_style.cpp +++ b/src/feature_type_style.cpp @@ -25,7 +25,7 @@ #include // boost -#include + namespace mapnik { @@ -92,7 +92,7 @@ rules& feature_type_style::get_rules_nonconst() bool feature_type_style::active(double scale_denom) const { - BOOST_FOREACH(rule const& r, rules_) + for (rule const& r : rules_) { if (r.active(scale_denom)) { diff --git a/src/font_engine_freetype.cpp b/src/font_engine_freetype.cpp index 9917de86c..bc69e2756 100644 --- a/src/font_engine_freetype.cpp +++ b/src/font_engine_freetype.cpp @@ -238,7 +238,7 @@ face_ptr freetype_engine::create_face(std::string const& family_name) itr->second.first, // face index &face); - if (!error) return boost::make_shared(face); + if (!error) return std::make_shared(face); } else { @@ -257,7 +257,7 @@ face_ptr freetype_engine::create_face(std::string const& family_name) static_cast(buffer.size()), itr->second.first, &face); - if (!error) return boost::make_shared(face); + if (!error) return std::make_shared(face); else { // we can't load font, erase it. @@ -274,7 +274,7 @@ stroker_ptr freetype_engine::create_stroker() FT_Error error = FT_Stroker_New(library_, &s); if (!error) { - return boost::make_shared(s); + return std::make_shared(s); } return stroker_ptr(); } @@ -292,14 +292,14 @@ font_face_set::size_type font_face_set::size() const glyph_ptr font_face_set::get_glyph(unsigned c) const { - BOOST_FOREACH ( face_ptr const& face, faces_) + for ( face_ptr const& face : faces_) { FT_UInt g = face->get_char(c); - if (g) return boost::make_shared(face, g); + if (g) return std::make_shared(face, g); } // Final fallback to empty square if nothing better in any font - return boost::make_shared(*faces_.begin(), 0); + return std::make_shared(*faces_.begin(), 0); } char_info font_face_set::character_dimensions(unsigned int c) @@ -312,7 +312,6 @@ char_info font_face_set::character_dimensions(unsigned int c) return itr->second; } - FT_Matrix matrix; FT_Vector pen; FT_Error error; @@ -325,12 +324,7 @@ char_info font_face_set::character_dimensions(unsigned int c) glyph_ptr glyph = get_glyph(c); FT_Face face = glyph->get_face()->get_face(); - matrix.xx = (FT_Fixed)( 1 * 0x10000L ); - matrix.xy = (FT_Fixed)( 0 * 0x10000L ); - matrix.yx = (FT_Fixed)( 0 * 0x10000L ); - matrix.yy = (FT_Fixed)( 1 * 0x10000L ); - - FT_Set_Transform(face, &matrix, &pen); + FT_Set_Transform(face, 0, &pen); error = FT_Load_Glyph (face, glyph->get_index(), FT_LOAD_NO_HINTING); if ( error ) @@ -399,7 +393,7 @@ void font_face_set::get_string_info(string_info & info, mapnik::value_unicode_st void font_face_set::set_pixel_sizes(unsigned size) { - BOOST_FOREACH ( face_ptr const& face, faces_) + for ( face_ptr const& face : faces_) { face->set_pixel_sizes(size); } @@ -407,7 +401,7 @@ void font_face_set::set_pixel_sizes(unsigned size) void font_face_set::set_character_sizes(double size) { - BOOST_FOREACH ( face_ptr const& face, faces_) + for ( face_ptr const& face : faces_) { face->set_character_sizes(size); } diff --git a/src/font_set.cpp b/src/font_set.cpp index 7bc404021..3ae8e1df2 100644 --- a/src/font_set.cpp +++ b/src/font_set.cpp @@ -55,7 +55,7 @@ std::size_t font_set::size() const void font_set::add_face_name(std::string const& face_name) { - face_names_.push_back(face_name); + face_names_.push_back(std::move(face_name)); } void font_set::set_name(std::string const& name) diff --git a/src/formatting/list.cpp b/src/formatting/list.cpp index d9ac17374..777e78b85 100644 --- a/src/formatting/list.cpp +++ b/src/formatting/list.cpp @@ -25,7 +25,7 @@ #include // boost -#include + #include namespace mapnik { @@ -36,7 +36,7 @@ namespace formatting { void list_node::to_xml(boost::property_tree::ptree & xml) const { - BOOST_FOREACH(node_ptr const& node, children_) + for (node_ptr const& node : children_) { node->to_xml(xml); } @@ -44,17 +44,17 @@ void list_node::to_xml(boost::property_tree::ptree & xml) const void list_node::apply(char_properties const& p, feature_impl const& feature, processed_text &output) const -{ - BOOST_FOREACH(node_ptr const& node, children_) +{ + for (node_ptr const& node : children_) { node->apply(p, feature, output); - } + } } void list_node::add_expressions(expression_set &output) const { - BOOST_FOREACH(node_ptr const& node, children_) + for (node_ptr const& node : children_) { node->add_expressions(output); } @@ -81,4 +81,3 @@ std::vector const& list_node::get_children() const } } // ns mapnik } // ns formatting - diff --git a/src/formatting/text.cpp b/src/formatting/text.cpp index 40272f3e5..4c7433c87 100644 --- a/src/formatting/text.cpp +++ b/src/formatting/text.cpp @@ -49,7 +49,7 @@ void text_node::to_xml(ptree &xml) const node_ptr text_node::from_xml(xml_node const& xml) { - return boost::make_shared(xml.get_value()); + return std::make_shared(xml.get_value()); } void text_node::apply(char_properties const& p, feature_impl const& feature, processed_text &output) const diff --git a/src/fs.cpp b/src/fs.cpp index 9eb01214b..bd78663e2 100644 --- a/src/fs.cpp +++ b/src/fs.cpp @@ -33,7 +33,7 @@ #include #if (BOOST_FILESYSTEM_VERSION <= 2) -#include + namespace boost { namespace filesystem { @@ -44,7 +44,7 @@ path read_symlink(const path& p) #ifdef BOOST_POSIX_API for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer is large enough { - boost::scoped_array buf(new char[path_max]); + const std::unique_ptr buf(new char[path_max]); ssize_t result; if ((result=::readlink(p.string().c_str(), buf.get(), path_max))== -1) { diff --git a/src/graphics.cpp b/src/graphics.cpp index cf55b37c3..bafa04ddb 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -33,7 +33,7 @@ #include "agg_color_rgba.h" // boost -#include + // cairo #ifdef HAVE_CAIRO @@ -72,7 +72,7 @@ image_32::image_32(cairo_surface_ptr const& surface) int stride = cairo_image_surface_get_stride(&*surface) / 4; - boost::scoped_array out_row(new unsigned int[width_]); + const std::unique_ptr out_row(new unsigned int[width_]); const unsigned int *in_row = (const unsigned int *)cairo_image_surface_get_data(&*surface); for (unsigned int row = 0; row < height_; row++, in_row += stride) diff --git a/src/grid/grid.cpp b/src/grid/grid.cpp index a85ae3076..087ec7747 100644 --- a/src/grid/grid.cpp +++ b/src/grid/grid.cpp @@ -47,7 +47,7 @@ hit_grid::hit_grid(int width, int height, std::string const& key, unsigned in names_(), f_keys_(), features_(), - ctx_(boost::make_shared()) + ctx_(std::make_shared()) { f_keys_[base_mask] = ""; data_.set(base_mask); @@ -80,7 +80,7 @@ void hit_grid::clear() names_.clear(); f_keys_[base_mask] = ""; data_.set(base_mask); - ctx_ = boost::make_shared(); + ctx_ = std::make_shared(); } template diff --git a/src/grid/grid_renderer.cpp b/src/grid/grid_renderer.cpp index 682934aa5..52a86c7b0 100644 --- a/src/grid/grid_renderer.cpp +++ b/src/grid/grid_renderer.cpp @@ -66,7 +66,7 @@ grid_renderer::grid_renderer(Map const& m, T & pixmap, double scale_factor, u t_(pixmap_.width(),pixmap_.height(),m.get_current_extent(),offset_x,offset_y), font_engine_(), font_manager_(font_engine_), - detector_(boost::make_shared(box2d(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size()))), + detector_(std::make_shared(box2d(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size()))), ras_ptr(new grid_rasterizer) { setup(m); @@ -84,7 +84,7 @@ grid_renderer::grid_renderer(Map const& m, request const& req, T & pixmap, do t_(pixmap_.width(),pixmap_.height(),req.extent(),offset_x,offset_y), font_engine_(), font_manager_(font_engine_), - detector_(boost::make_shared(box2d(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))), + detector_(std::make_shared(box2d(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))), ras_ptr(new grid_rasterizer) { setup(m); diff --git a/src/grid/process_building_symbolizer.cpp b/src/grid/process_building_symbolizer.cpp index 5e089d272..b3c8805c5 100644 --- a/src/grid/process_building_symbolizer.cpp +++ b/src/grid/process_building_symbolizer.cpp @@ -32,7 +32,7 @@ #include // boost -#include + // stl #include @@ -78,8 +78,8 @@ void grid_renderer::process(building_symbolizer const& sym, geometry_type & geom = feature.get_geometry(i); if (geom.size() > 2) { - boost::scoped_ptr frame(new geometry_type(LineString)); - boost::scoped_ptr roof(new geometry_type(Polygon)); + const std::unique_ptr frame(new geometry_type(geometry_type::types::LineString)); + const std::unique_ptr roof(new geometry_type(geometry_type::types::Polygon)); std::deque face_segments; double x0(0); double y0(0); @@ -106,7 +106,7 @@ void grid_renderer::process(building_symbolizer const& sym, std::deque::const_iterator itr=face_segments.begin(); for (;itr!=face_segments.end();++itr) { - boost::scoped_ptr faces(new geometry_type(Polygon)); + const std::unique_ptr faces(new geometry_type(geometry_type::types::Polygon)); faces->move_to(itr->get<0>(),itr->get<1>()); faces->line_to(itr->get<2>(),itr->get<3>()); faces->line_to(itr->get<2>(),itr->get<3>() + height); diff --git a/src/grid/process_line_symbolizer.cpp b/src/grid/process_line_symbolizer.cpp index c188b6473..502a85c24 100644 --- a/src/grid/process_line_symbolizer.cpp +++ b/src/grid/process_line_symbolizer.cpp @@ -38,7 +38,7 @@ #include "agg_conv_dash.h" // boost -#include + // stl #include @@ -96,7 +96,7 @@ void grid_renderer::process(line_symbolizer const& sym, if (stroke_.has_dash()) converter.set(); converter.set(); //always stroke - BOOST_FOREACH( geometry_type & geom, feature.paths()) + for ( geometry_type & geom : feature.paths()) { if (geom.size() > 1) { @@ -119,4 +119,3 @@ template void grid_renderer::process(line_symbolizer const&, proj_transform const&); } - diff --git a/src/grid/process_markers_symbolizer.cpp b/src/grid/process_markers_symbolizer.cpp index 81180f481..1f274f10c 100644 --- a/src/grid/process_markers_symbolizer.cpp +++ b/src/grid/process_markers_symbolizer.cpp @@ -150,8 +150,8 @@ void grid_renderer::process(markers_symbolizer const& sym, converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) { - eGeomType type = feature.paths()[0].type(); - if (type == Polygon) + geometry_type::types type = feature.paths()[0].type(); + if (type == geometry_type::types::Polygon) converter.template set(); // line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426 //else if (type == LineString) @@ -192,8 +192,8 @@ void grid_renderer::process(markers_symbolizer const& sym, converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) { - eGeomType type = feature.paths()[0].type(); - if (type == Polygon) + geometry_type::types type = feature.paths()[0].type(); + if (type == geometry_type::types::Polygon) converter.template set(); // line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426 //else if (type == LineString) @@ -237,8 +237,8 @@ void grid_renderer::process(markers_symbolizer const& sym, converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) { - eGeomType type = feature.paths()[0].type(); - if (type == Polygon) + geometry_type::types type = feature.paths()[0].type(); + if (type == geometry_type::types::Polygon) converter.template set(); // line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426 //else if (type == LineString) diff --git a/src/grid/process_point_symbolizer.cpp b/src/grid/process_point_symbolizer.cpp index 3d0d68f40..8d6e648b4 100644 --- a/src/grid/process_point_symbolizer.cpp +++ b/src/grid/process_point_symbolizer.cpp @@ -60,7 +60,7 @@ void grid_renderer::process(point_symbolizer const& sym, } else { - marker.reset(boost::make_shared()); + marker.reset(std::make_shared()); } if (marker) diff --git a/src/grid/process_polygon_pattern_symbolizer.cpp b/src/grid/process_polygon_pattern_symbolizer.cpp index 38145858f..956458f18 100644 --- a/src/grid/process_polygon_pattern_symbolizer.cpp +++ b/src/grid/process_polygon_pattern_symbolizer.cpp @@ -21,7 +21,7 @@ *****************************************************************************/ // boost -#include + // mapnik #include @@ -64,7 +64,7 @@ void grid_renderer::process(polygon_pattern_symbolizer const& sym, if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH( geometry_type & geom, feature.paths()) + for ( geometry_type & geom : feature.paths()) { if (geom.size() > 2) { @@ -96,4 +96,3 @@ template void grid_renderer::process(polygon_pattern_symbolizer const&, proj_transform const&); } - diff --git a/src/grid/process_polygon_symbolizer.cpp b/src/grid/process_polygon_symbolizer.cpp index 5195760f9..ffa79fc6d 100644 --- a/src/grid/process_polygon_symbolizer.cpp +++ b/src/grid/process_polygon_symbolizer.cpp @@ -21,7 +21,7 @@ *****************************************************************************/ // boost -#include + // mapnik #include @@ -69,7 +69,7 @@ void grid_renderer::process(polygon_symbolizer const& sym, if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH( geometry_type & geom, feature.paths()) + for ( geometry_type & geom : feature.paths()) { if (geom.size() > 2) { @@ -98,4 +98,3 @@ template void grid_renderer::process(polygon_symbolizer const&, proj_transform const&); } - diff --git a/src/image_reader.cpp b/src/image_reader.cpp index 539221040..afa572b5d 100644 --- a/src/image_reader.cpp +++ b/src/image_reader.cpp @@ -28,13 +28,6 @@ namespace mapnik { -typedef factory ImageReaderFactory; - -typedef factory MemImageReaderFactory; - - inline boost::optional type_from_bytes(char const* data, size_t size) { typedef boost::optional result_type; @@ -70,27 +63,18 @@ inline boost::optional type_from_bytes(char const* data, size_t siz return result_type(); } -bool register_image_reader(std::string const& type,image_reader* (* fun)(std::string const&)) -{ - return ImageReaderFactory::instance().register_product(type,fun); -} - -bool register_image_reader(std::string const& type,image_reader* (* fun)(char const*, std::size_t)) -{ - return MemImageReaderFactory::instance().register_product(type,fun); -} - image_reader* get_image_reader(char const* data, size_t size) { boost::optional type = type_from_bytes(data,size); if (type) - return MemImageReaderFactory::instance().create_object(*type, data,size); - return 0; + return factory::instance().create_object(*type, data,size); + else + throw image_reader_exception("image_reader: can't determine type from input data"); } image_reader* get_image_reader(std::string const& filename,std::string const& type) { - return ImageReaderFactory::instance().create_object(type,filename); + return factory::instance().create_object(type,filename); } image_reader* get_image_reader(std::string const& filename) @@ -98,7 +82,7 @@ image_reader* get_image_reader(std::string const& filename) boost::optional type = type_from_filename(filename); if (type) { - return ImageReaderFactory::instance().create_object(*type,filename); + return factory::instance().create_object(*type,filename); } return 0; } diff --git a/src/image_util.cpp b/src/image_util.cpp index 8cee4dd7d..1dd1adc88 100644 --- a/src/image_util.cpp +++ b/src/image_util.cpp @@ -68,7 +68,7 @@ extern "C" #endif // boost -#include + #include // stl @@ -149,7 +149,7 @@ void handle_png_options(std::string const& type, if (type.length() > 6){ boost::char_separator sep(":"); boost::tokenizer< boost::char_separator > tokens(type, sep); - BOOST_FOREACH(std::string t, tokens) + for (std::string const& t : tokens) { if (t == "png" || t == "png24" || t == "png32") { @@ -258,7 +258,7 @@ void handle_webp_options(std::string const& type, if (type.length() > 4){ boost::char_separator sep(":"); boost::tokenizer< boost::char_separator > tokens(type, sep); - BOOST_FOREACH(std::string t, tokens) + for (auto const& t : tokens) { if (boost::algorithm::starts_with(t, "quality=")) { diff --git a/src/jpeg_reader.cpp b/src/jpeg_reader.cpp index 36aa63ac4..254d4601f 100644 --- a/src/jpeg_reader.cpp +++ b/src/jpeg_reader.cpp @@ -31,14 +31,13 @@ extern "C" } // boost -#include -#include #include #include #include // std #include +#include namespace mapnik { @@ -280,7 +279,7 @@ void jpeg_reader::read(unsigned x0, unsigned y0, image_data_32& image) unsigned w = std::min(unsigned(image.width()),width_ - x0); unsigned h = std::min(unsigned(image.height()),height_ - y0); - boost::scoped_array out_row(new unsigned int[w]); + const std::unique_ptr out_row(new unsigned int[w]); unsigned row = 0; while (cinfo.output_scanline < cinfo.output_height) { diff --git a/src/json/geometry_grammar.cpp b/src/json/geometry_grammar.cpp index 797ef79f2..7708ab17c 100644 --- a/src/json/geometry_grammar.cpp +++ b/src/json/geometry_grammar.cpp @@ -105,16 +105,16 @@ geometry_grammar::geometry_grammar() | (eps(_r2 == 6) > multipolygon_coordinates(_r1)) ; - point_coordinates = eps[ _a = new_(Point) ] + point_coordinates = eps[ _a = new_(geometry_type::types::Point) ] > ( point(SEG_MOVETO,_a) [push_back(_r1,_a)] | eps[cleanup_(_a)][_pass = false] ) ; - linestring_coordinates = eps[ _a = new_(LineString)] + linestring_coordinates = eps[ _a = new_(geometry_type::types::LineString)] > -(points(_a) [push_back(_r1,_a)] | eps[cleanup_(_a)][_pass = false]) ; - polygon_coordinates = eps[ _a = new_(Polygon) ] + polygon_coordinates = eps[ _a = new_(geometry_type::types::Polygon) ] > ((lit('[') > -(points(_a)[close_path_(_a)] % lit(',')) > lit(']')) [push_back(_r1,_a)] diff --git a/src/load_map.cpp b/src/load_map.cpp index 36de527d2..1925aa030 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -212,7 +212,7 @@ void map_parser::parse_map(Map & map, xml_node const& pt, std::string const& bas throw config_error("failed to parse background-image-comp-op: '" + *comp_op_name + "'"); } } - + optional opacity = map_node.get_opt_attr("background-image-opacity"); if (opacity) { @@ -730,7 +730,7 @@ void map_parser::parse_layer(Map & map, xml_node const& node) //now we are ready to create datasource try { - boost::shared_ptr ds = + std::shared_ptr ds = datasource_cache::instance().create(params); lyr.set_datasource(ds); } @@ -875,7 +875,7 @@ void map_parser::parse_symbolizer_base(symbolizer_base &sym, xml_node const &pt) optional geometry_transform_wkt = pt.get_opt_attr("geometry-transform"); if (geometry_transform_wkt) { - mapnik::transform_list_ptr tl = boost::make_shared(); + mapnik::transform_list_ptr tl = std::make_shared(); if (!mapnik::parse_transform(*tl, *geometry_transform_wkt, pt.get_tree().transform_expr_grammar)) { std::string ss("Could not parse transform from '"); @@ -958,7 +958,7 @@ void map_parser::parse_point_symbolizer(rule & rule, xml_node const & sym) optional image_transform_wkt = sym.get_opt_attr("transform"); if (image_transform_wkt) { - mapnik::transform_list_ptr tl = boost::make_shared(); + mapnik::transform_list_ptr tl = std::make_shared(); if (!mapnik::parse_transform(*tl, *image_transform_wkt, sym.get_tree().transform_expr_grammar)) { throw mapnik::config_error("Failed to parse transform: '" + *image_transform_wkt + "'"); @@ -1036,7 +1036,7 @@ void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& sym) optional image_transform_wkt = sym.get_opt_attr("transform"); if (image_transform_wkt) { - mapnik::transform_list_ptr tl = boost::make_shared(); + mapnik::transform_list_ptr tl = std::make_shared(); if (!mapnik::parse_transform(*tl, *image_transform_wkt, sym.get_tree().transform_expr_grammar)) { throw mapnik::config_error("Failed to parse transform: '" + *image_transform_wkt + "'"); @@ -1188,7 +1188,7 @@ void map_parser::parse_text_symbolizer(rule & rule, xml_node const& sym) if (placement_type) { placement_finder = placements::registry::instance().from_xml(*placement_type, sym, fontsets_); } else { - placement_finder = boost::make_shared(); + placement_finder = std::make_shared(); placement_finder->defaults.from_xml(sym, fontsets_); } if (strict_ && @@ -1220,7 +1220,7 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& sym) if (placement_type) { placement_finder = placements::registry::instance().from_xml(*placement_type, sym, fontsets_); } else { - placement_finder = boost::make_shared(); + placement_finder = std::make_shared(); } placement_finder->defaults.from_xml(sym, fontsets_); if (strict_ && @@ -1234,7 +1234,7 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& sym) optional image_transform_wkt = sym.get_opt_attr("transform"); if (image_transform_wkt) { - mapnik::transform_list_ptr tl = boost::make_shared(); + mapnik::transform_list_ptr tl = std::make_shared(); if (!mapnik::parse_transform(*tl, *image_transform_wkt, sym.get_tree().transform_expr_grammar)) { throw mapnik::config_error("Failed to parse transform: '" + *image_transform_wkt + "'"); @@ -1544,7 +1544,7 @@ void map_parser::parse_raster_symbolizer(rule & rule, xml_node const & sym) if (cssIter->is("RasterColorizer")) { found_colorizer = true; - raster_colorizer_ptr colorizer = boost::make_shared(); + raster_colorizer_ptr colorizer = std::make_shared(); raster_sym.set_colorizer(colorizer); if (parse_raster_colorizer(colorizer, *cssIter)) raster_sym.set_colorizer(colorizer); @@ -1554,7 +1554,7 @@ void map_parser::parse_raster_symbolizer(rule & rule, xml_node const & sym) // look for properties one level up if (!found_colorizer) { - raster_colorizer_ptr colorizer = boost::make_shared(); + raster_colorizer_ptr colorizer = std::make_shared(); if (parse_raster_colorizer(colorizer, sym)) raster_sym.set_colorizer(colorizer); } diff --git a/src/map.cpp b/src/map.cpp index 3b6b4fcfa..8c248c975 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -611,7 +611,7 @@ featureset_ptr Map::query_point(unsigned index, double x, double y) const MAPNIK_LOG_DEBUG(map) << "map: Query at point tol=" << tol << "(" << x << "," << y << ")"; if (fs) { - return boost::make_shared >(fs, + return std::make_shared >(fs, hit_test_filter(x,y,tol)); } } diff --git a/src/mapped_memory_cache.cpp b/src/mapped_memory_cache.cpp index 84cd66fde..2f2ace95c 100644 --- a/src/mapped_memory_cache.cpp +++ b/src/mapped_memory_cache.cpp @@ -71,7 +71,7 @@ boost::optional mapped_memory_cache::find(std::string const& try { boost::interprocess::file_mapping mapping(uri.c_str(),boost::interprocess::read_only); - mapped_region_ptr region(boost::make_shared(mapping,boost::interprocess::read_only)); + mapped_region_ptr region(std::make_shared(mapping,boost::interprocess::read_only)); result.reset(region); @@ -99,4 +99,4 @@ boost::optional mapped_memory_cache::find(std::string const& } -#endif \ No newline at end of file +#endif diff --git a/src/marker_cache.cpp b/src/marker_cache.cpp index d550457c6..259341866 100644 --- a/src/marker_cache.cpp +++ b/src/marker_cache.cpp @@ -141,7 +141,7 @@ boost::optional marker_cache::find(std::string const& uri, } std::string known_svg_string = mark_itr->second; using namespace mapnik::svg; - svg_path_ptr marker_path(boost::make_shared()); + svg_path_ptr marker_path(std::make_shared()); vertex_stl_adapter stl_storage(marker_path->source()); svg_path_adapter svg_path(stl_storage); svg_converter_type svg(svg_path, marker_path->attributes()); @@ -152,7 +152,7 @@ boost::optional marker_cache::find(std::string const& uri, svg.bounding_rect(&lox, &loy, &hix, &hiy); marker_path->set_bounding_box(lox,loy,hix,hiy); marker_path->set_dimensions(svg.width(),svg.height()); - marker_ptr mark(boost::make_shared(marker_path)); + marker_ptr mark(std::make_shared(marker_path)); result.reset(mark); if (update_cache) { @@ -170,7 +170,7 @@ boost::optional marker_cache::find(std::string const& uri, if (is_svg(uri)) { using namespace mapnik::svg; - svg_path_ptr marker_path(boost::make_shared()); + svg_path_ptr marker_path(std::make_shared()); vertex_stl_adapter stl_storage(marker_path->source()); svg_path_adapter svg_path(stl_storage); svg_converter_type svg(svg_path, marker_path->attributes()); @@ -181,7 +181,7 @@ boost::optional marker_cache::find(std::string const& uri, svg.bounding_rect(&lox, &loy, &hix, &hiy); marker_path->set_bounding_box(lox,loy,hix,hiy); marker_path->set_dimensions(svg.width(),svg.height()); - marker_ptr mark(boost::make_shared(marker_path)); + marker_ptr mark(std::make_shared(marker_path)); result.reset(mark); if (update_cache) { @@ -191,13 +191,13 @@ boost::optional marker_cache::find(std::string const& uri, else { // TODO - support reading images from string - std::auto_ptr reader(mapnik::get_image_reader(uri)); + std::unique_ptr reader(mapnik::get_image_reader(uri)); if (reader.get()) { unsigned width = reader->width(); unsigned height = reader->height(); BOOST_ASSERT(width > 0 && height > 0); - mapnik::image_ptr image(boost::make_shared(width,height)); + mapnik::image_ptr image(std::make_shared(width,height)); reader->read(0,0,*image); if (!reader->premultiplied_alpha()) { @@ -205,7 +205,7 @@ boost::optional marker_cache::find(std::string const& uri, agg::pixfmt_rgba32 pixf(buffer); pixf.premultiply(); } - marker_ptr mark(boost::make_shared(image)); + marker_ptr mark(std::make_shared(image)); result.reset(mark); if (update_cache) { diff --git a/src/memory_datasource.cpp b/src/memory_datasource.cpp index 3ea949545..8ae97efd1 100644 --- a/src/memory_datasource.cpp +++ b/src/memory_datasource.cpp @@ -83,7 +83,7 @@ datasource::datasource_t memory_datasource::type() const featureset_ptr memory_datasource::features(const query& q) const { - return boost::make_shared(q.get_bbox(),*this,bbox_check_); + return std::make_shared(q.get_bbox(),*this,bbox_check_); } @@ -92,7 +92,7 @@ featureset_ptr memory_datasource::features_at_point(coord2d const& pt, double to box2d box = box2d(pt.x, pt.y, pt.x, pt.y); box.pad(tol); MAPNIK_LOG_DEBUG(memory_datasource) << "memory_datasource: Box=" << box << ", Point x=" << pt.x << ",y=" << pt.y; - return boost::make_shared(box,*this); + return std::make_shared(box,*this); } void memory_datasource::set_envelope(box2d const& box) diff --git a/src/parse_path.cpp b/src/parse_path.cpp index 90265b9ab..1359a2d0e 100644 --- a/src/parse_path.cpp +++ b/src/parse_path.cpp @@ -30,7 +30,7 @@ // boost #include -#include + #include // stl @@ -48,14 +48,14 @@ path_expression_ptr parse_path(std::string const& str) path_expression_ptr parse_path(std::string const& str, path_expression_grammar const& g) { - path_expression path; - + path_expression path; + std::string::const_iterator itr = str.begin(); std::string::const_iterator end = str.end(); bool r = qi::phrase_parse(itr, end, g, boost::spirit::standard_wide::space, path); if (r && itr == end) { - return boost::make_shared(path); //path; + return std::make_shared(path); //path; } else { @@ -129,7 +129,7 @@ std::string path_processor::evaluate(path_expression const& path,feature_impl co { std::string out; path_processor_detail::path_visitor_ eval(out,f); - BOOST_FOREACH( mapnik::path_component const& token, path) + for ( mapnik::path_component const& token : path) boost::apply_visitor(eval,token); return out; } @@ -138,7 +138,7 @@ std::string path_processor::to_string(path_expression const& path) { std::string str; path_processor_detail::to_string_ visitor(str); - BOOST_FOREACH( mapnik::path_component const& token, path) + for ( mapnik::path_component const& token : path) boost::apply_visitor(visitor,token); return str; } @@ -146,7 +146,7 @@ std::string path_processor::to_string(path_expression const& path) void path_processor::collect_attributes(path_expression const& path, std::set& names) { path_processor_detail::collect_ visitor(names); - BOOST_FOREACH( mapnik::path_component const& token, path) + for ( mapnik::path_component const& token : path) boost::apply_visitor(visitor,token); } diff --git a/src/parse_transform.cpp b/src/parse_transform.cpp index b837f906e..f4bded667 100644 --- a/src/parse_transform.cpp +++ b/src/parse_transform.cpp @@ -36,7 +36,7 @@ transform_list_ptr parse_transform(std::string const& str) transform_list_ptr parse_transform(std::string const& str, std::string const& encoding) { - transform_list_ptr tl = boost::make_shared(); + transform_list_ptr tl = std::make_shared(); transcoder tc(encoding); expression_grammar ge(tc); transform_expression_grammar_string gte(ge); diff --git a/src/placement_finder.cpp b/src/placement_finder.cpp index 19ee790c2..3a304e716 100644 --- a/src/placement_finder.cpp +++ b/src/placement_finder.cpp @@ -33,9 +33,9 @@ #include "agg_path_length.h" // boost -#include +#include #include -#include + //stl #include @@ -284,7 +284,7 @@ void placement_finder::find_line_breaks() //No linebreaks line_sizes_.push_back(std::make_pair(string_width_, string_height_)); } - line_breaks_.push_back(info_.num_characters()); + line_breaks_.push_back(static_cast(info_.num_characters())); } template @@ -385,7 +385,7 @@ void placement_finder::find_point_placement(double label_x, double sina = std::sin(rad); double x, y; - std::auto_ptr current_placement(new text_path(label_x, label_y)); + std::unique_ptr current_placement(new text_path(label_x, label_y)); adjust_position(current_placement.get()); @@ -499,7 +499,7 @@ void placement_finder::find_point_placement(double label_x, // check the placement of any additional envelopes if (!p.allow_overlap && !additional_boxes_.empty()) { - BOOST_FOREACH(box2d const& box, additional_boxes_) + for (box2d const& box : additional_boxes_) { box2d pt(box.minx() + current_placement->center.x, box.miny() + current_placement->center.y, @@ -638,10 +638,10 @@ void placement_finder::find_line_placements(PathT & shape_path) { //Record details for the start of the string placement int orientation = 0; - std::auto_ptr current_placement = get_placement_offset(path_positions, path_distances, orientation, index, segment_length - (distance - target_distance) + (diff*dir)); + std::unique_ptr current_placement = get_placement_offset(path_positions, path_distances, orientation, index, segment_length - (distance - target_distance) + (diff*dir)); //We were unable to place here - if (current_placement.get() == NULL) + if (current_placement.get() == nullptr) continue; //Apply displacement @@ -708,7 +708,7 @@ void placement_finder::find_line_placements(PathT & shape_path) } template -std::auto_ptr placement_finder::get_placement_offset(std::vector const& path_positions, +std::unique_ptr placement_finder::get_placement_offset(std::vector const& path_positions, std::vector const& path_distances, int & orientation, std::size_t index, @@ -721,7 +721,7 @@ std::auto_ptr placement_finder::get_placement_offset(std:: distance += path_distances[index]; } if (index <= 1 && distance < 0) //We've gone off the start, fail out - return std::auto_ptr(NULL); + return std::unique_ptr(nullptr); //Same thing, checking if we go off the end while (index < path_distances.size() && distance > path_distances[index]) @@ -730,7 +730,7 @@ std::auto_ptr placement_finder::get_placement_offset(std:: index++; } if (index >= path_distances.size()) - return std::auto_ptr(NULL); + return std::unique_ptr(nullptr); //Keep track of the initial index,distance incase we need to re-call get_placement_offset const std::size_t initial_index = index; @@ -748,10 +748,10 @@ std::auto_ptr placement_finder::get_placement_offset(std:: double segment_length = path_distances[index]; if (segment_length == 0) { // Not allowed to place across on 0 length segments or discontinuities - return std::auto_ptr(NULL); + return std::unique_ptr(nullptr); } - std::auto_ptr current_placement( + std::unique_ptr current_placement( new text_path((old_x + dx*distance/segment_length), (old_y + dy*distance/segment_length) ) @@ -776,7 +776,7 @@ std::auto_ptr placement_finder::get_placement_offset(std:: //Coordinates this character will start at if (segment_length == 0) { // Not allowed to place across on 0 length segments or discontinuities - return std::auto_ptr(NULL); + return std::unique_ptr(nullptr); } double start_x = old_x + dx*distance/segment_length; double start_y = old_y + dy*distance/segment_length; @@ -804,7 +804,7 @@ std::auto_ptr placement_finder::get_placement_offset(std:: if (index >= path_positions.size()) //Bail out if we run off the end of the shape { //MAPNIK_LOG_ERROR(placement_finder) << "FAIL: Out of space"; - return std::auto_ptr(NULL); + return std::unique_ptr(nullptr); } new_x = path_positions[index].x; new_y = path_positions[index].y; @@ -841,7 +841,7 @@ std::auto_ptr placement_finder::get_placement_offset(std:: std::fabs(angle_delta) > p.max_char_angle_delta) { //MAPNIK_LOG_ERROR(placement_finder) << "FAIL: Too Bendy!"; - return std::auto_ptr(NULL); + return std::unique_ptr(nullptr); } double render_angle = angle; @@ -895,15 +895,15 @@ std::auto_ptr placement_finder::get_placement_offset(std:: { //Otherwise we have failed to find a placement //MAPNIK_LOG_ERROR(placement_finder) << "FAIL: Double upside-down!"; - return std::auto_ptr(NULL); + return std::unique_ptr(nullptr); } } - return current_placement; + return std::move(current_placement); } template -bool placement_finder::test_placement(std::auto_ptr const& current_placement, +bool placement_finder::test_placement(std::unique_ptr const& current_placement, int orientation) { //Create and test envelopes diff --git a/src/png_reader.cpp b/src/png_reader.cpp index 4a732b109..1762fd524 100644 --- a/src/png_reader.cpp +++ b/src/png_reader.cpp @@ -29,12 +29,14 @@ extern "C" #include } // boost -#include // iostreams #include #include #include +// stl +#include + namespace mapnik { @@ -265,7 +267,7 @@ void png_reader::read(unsigned x0, unsigned y0,image_data_32& image) png_read_update_info(png_ptr, info_ptr); // we can read whole image at once // alloc row pointers - boost::scoped_array rows(new png_bytep[height_]); + const std::unique_ptr rows(new png_bytep[height_]); for (unsigned i=0; i::read(unsigned x0, unsigned y0,image_data_32& image) unsigned w=std::min(unsigned(image.width()),width_ - x0); unsigned h=std::min(unsigned(image.height()),height_ - y0); unsigned rowbytes=png_get_rowbytes(png_ptr, info_ptr); - boost::scoped_array row(new png_byte[rowbytes]); + const std::unique_ptr row(new png_byte[rowbytes]); //START read image rows for (unsigned i = 0;i < height_; ++i) { diff --git a/src/rule.cpp b/src/rule.cpp index 318feb205..1f6640e22 100644 --- a/src/rule.cpp +++ b/src/rule.cpp @@ -41,7 +41,7 @@ #include // boost -#include +#include #include #include @@ -107,7 +107,7 @@ rule::rule() min_scale_(0), max_scale_(std::numeric_limits::infinity()), syms_(), - filter_(boost::make_shared(true)), + filter_(std::make_shared(true)), else_filter_(false), also_filter_(false) {} @@ -118,7 +118,7 @@ rule::rule(std::string const& name, min_scale_(min_scale_denominator), max_scale_(max_scale_denominator), syms_(), - filter_(boost::make_shared(true)), + filter_(std::make_shared(true)), else_filter_(false), also_filter_(false) {} diff --git a/src/shield_symbolizer.cpp b/src/shield_symbolizer.cpp index f7b7d0f53..8ef650fee 100644 --- a/src/shield_symbolizer.cpp +++ b/src/shield_symbolizer.cpp @@ -26,7 +26,7 @@ #include // boost -#include + namespace mapnik { diff --git a/src/svg/output/process_symbolizers.cpp b/src/svg/output/process_symbolizers.cpp index ca38a082f..10de95982 100644 --- a/src/svg/output/process_symbolizers.cpp +++ b/src/svg/output/process_symbolizers.cpp @@ -59,7 +59,7 @@ bool svg_renderer::process(rule::symbolizers const& syms, // process each symbolizer to collect its (path) information. // path information (attributes from line_ and polygon_ symbolizers) // is collected with the path_attributes_ data member. - BOOST_FOREACH(symbolizer const& sym, syms) + for (symbolizer const& sym : syms) { if (is_path_based(sym)) { diff --git a/src/svg/output/svg_renderer.cpp b/src/svg/output/svg_renderer.cpp index 49ce2b4db..b92347c25 100644 --- a/src/svg/output/svg_renderer.cpp +++ b/src/svg/output/svg_renderer.cpp @@ -44,7 +44,7 @@ svg_renderer::svg_renderer(Map const& m, T & output_iterator, double scale_fa t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), font_engine_(), font_manager_(font_engine_), - detector_(boost::make_shared(box2d(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size()))), + detector_(std::make_shared(box2d(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size()))), generator_(output_iterator), query_extent_(), painted_(false) @@ -60,7 +60,7 @@ svg_renderer::svg_renderer(Map const& m, request const& req, T & output_itera t_(req.width(),req.height(),req.extent(),offset_x,offset_y), font_engine_(), font_manager_(font_engine_), - detector_(boost::make_shared(box2d(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))), + detector_(std::make_shared(box2d(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))), generator_(output_iterator), query_extent_(), painted_(false) diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index 0fbf12bf0..0aa5d42b2 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -35,8 +35,6 @@ #include #include #include -#include - #include #include @@ -434,7 +432,7 @@ void parse_attr(svg_parser & parser, xmlTextReaderPtr reader) typedef cont_type::value_type value_type; cont_type vec; parse_style((const char*)value, vec); - BOOST_FOREACH(value_type kv , vec ) + for (value_type kv : vec ) { parse_attr(parser,BAD_CAST kv.first.c_str(),BAD_CAST kv.second.c_str()); } @@ -796,7 +794,7 @@ void parse_gradient_stop(svg_parser & parser, xmlTextReaderPtr reader) cont_type vec; parse_style((const char*)value, vec); - BOOST_FOREACH(value_type kv , vec ) + for (value_type kv : vec ) { if (kv.first == "stop-color") { diff --git a/src/symbolizer_helpers.cpp b/src/symbolizer_helpers.cpp index 67b492acc..ddb6548bb 100644 --- a/src/symbolizer_helpers.cpp +++ b/src/symbolizer_helpers.cpp @@ -62,7 +62,7 @@ text_symbolizer_helper::text_symbolizer_helper(text_sym angle_(0.0), placement_valid_(false), points_on_line_(false), - finder_(0) + finder_() { initialize_geometries(); if (!geometries_to_process_.size()) return; @@ -219,8 +219,8 @@ void text_symbolizer_helper::initialize_geometries() // don't bother with empty geometries if (geom.size() == 0) continue; - eGeomType type = geom.type(); - if (type == Polygon) + geometry_type::types type = geom.type(); + if (type == geometry_type::types::Polygon) { largest_box_only = sym_.largest_bbox_only(); if (sym_.get_minimum_path_length() > 0) @@ -284,7 +284,7 @@ void text_symbolizer_helper::initialize_points() // https://github.com/mapnik/mapnik/issues/1423 bool success = false; // https://github.com/mapnik/mapnik/issues/1350 - if (geom.type() == LineString) + if (geom.type() == geometry_type::types::LineString) { success = label::middle_point(geom, label_x,label_y); } diff --git a/src/text_placements/dummy.cpp b/src/text_placements/dummy.cpp index 989fb542b..02c68318c 100644 --- a/src/text_placements/dummy.cpp +++ b/src/text_placements/dummy.cpp @@ -35,7 +35,7 @@ bool text_placement_info_dummy::next() text_placement_info_ptr text_placements_dummy::get_placement_info( double scale_factor) const { - return boost::make_shared(this, scale_factor); + return std::make_shared(this, scale_factor); } } //ns mapnik diff --git a/src/text_placements/list.cpp b/src/text_placements/list.cpp index bd0dccdc4..d470315d1 100644 --- a/src/text_placements/list.cpp +++ b/src/text_placements/list.cpp @@ -64,7 +64,7 @@ text_symbolizer_properties & text_placements_list::get(unsigned i) text_placement_info_ptr text_placements_list::get_placement_info(double scale_factor) const { - return boost::make_shared(this, scale_factor); + return std::make_shared(this, scale_factor); } text_placements_list::text_placements_list() : text_placements(), list_(0) @@ -109,4 +109,3 @@ text_placements_ptr text_placements_list::from_xml(xml_node const &xml, fontset_ } } //ns mapnik - diff --git a/src/text_placements/simple.cpp b/src/text_placements/simple.cpp index ec5f812d0..5f6c86325 100644 --- a/src/text_placements/simple.cpp +++ b/src/text_placements/simple.cpp @@ -105,7 +105,7 @@ bool text_placement_info_simple::next_position_only() text_placement_info_ptr text_placements_simple::get_placement_info( double scale_factor) const { - return boost::make_shared(this, scale_factor); + return std::make_shared(this, scale_factor); } /** Position string: [POS][SIZE] @@ -173,7 +173,7 @@ std::string text_placements_simple::get_positions() text_placements_ptr text_placements_simple::from_xml(xml_node const &xml, fontset_map const & fontsets) { - text_placements_ptr ptr = boost::make_shared( + text_placements_ptr ptr = std::make_shared( xml.get_attr("placements", "X")); ptr->defaults.from_xml(xml, fontsets); return ptr; diff --git a/src/text_properties.cpp b/src/text_properties.cpp index a695e17d8..836943af7 100644 --- a/src/text_properties.cpp +++ b/src/text_properties.cpp @@ -237,7 +237,7 @@ void text_symbolizer_properties::add_expressions(expression_set &output) const void text_symbolizer_properties::set_old_style_expression(expression_ptr expr) { - tree_ = boost::make_shared(expr); + tree_ = std::make_shared(expr); } char_properties::char_properties() : diff --git a/src/text_symbolizer.cpp b/src/text_symbolizer.cpp index 61ea9f6ac..7b6ce662f 100644 --- a/src/text_symbolizer.cpp +++ b/src/text_symbolizer.cpp @@ -26,11 +26,6 @@ #include #include - -// boost -#include - - namespace mapnik { diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index cc2e32e37..7b3fad6a3 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -25,7 +25,7 @@ #include // boost -#include +#include // iostreams #include @@ -102,7 +102,7 @@ static int tiff_map_proc(thandle_t, tdata_t* , toff_t*) template class tiff_reader : public image_reader { - typedef boost::shared_ptr tiff_ptr; + typedef std::shared_ptr tiff_ptr; typedef T source_type; typedef boost::iostreams::stream input_stream; diff --git a/src/transform_expression.cpp b/src/transform_expression.cpp index 157dee202..0bf3b8ec2 100644 --- a/src/transform_expression.cpp +++ b/src/transform_expression.cpp @@ -25,7 +25,7 @@ #include // boost -#include + // stl #include @@ -132,7 +132,7 @@ std::string to_expression_string(transform_list const& list) std::streamsize first = 1; transform_node_to_expression_string to_string(os); - BOOST_FOREACH (transform_node const& node, list) + for (transform_node const& node : list) { os.write(" ", first ? (first = 0) : 1); boost::apply_visitor(to_string, *node); diff --git a/src/webp_reader.cpp b/src/webp_reader.cpp index 29f87dbd2..3042b82da 100644 --- a/src/webp_reader.cpp +++ b/src/webp_reader.cpp @@ -102,7 +102,8 @@ private: } WebPDecoderConfig & config_; }; - std::auto_ptr buffer_; + + std::unique_ptr buffer_; size_t size_; unsigned width_; unsigned height_; @@ -148,7 +149,7 @@ webp_reader::webp_reader(char const* data, std::size_t size) template webp_reader::webp_reader(std::string const& filename) - : buffer_(), + : buffer_(nullptr), size_(0), width_(0), height_(0) @@ -163,12 +164,15 @@ webp_reader::webp_reader(std::string const& filename) std::streampos end = file.tellg(); std::size_t file_size = end - beg; file.seekg (0, std::ios::beg); - buffer_ = std::auto_ptr(new buffer_policy_type(file_size)); - file.read(reinterpret_cast(buffer_->data()), buffer_->size()); + + std::unique_ptr buffer(new buffer_policy_type(file_size)); + file.read(reinterpret_cast(buffer->data()), buffer->size()); if (!file) { throw image_reader_exception("WEBP: Failed to read:" + filename); } + + buffer_ = std::move(buffer); init(); } diff --git a/src/wkb.cpp b/src/wkb.cpp index 65f6145df..88b791efe 100644 --- a/src/wkb.cpp +++ b/src/wkb.cpp @@ -250,9 +250,9 @@ private: { double x = read_double(); double y = read_double(); - std::auto_ptr pt(new geometry_type(Point)); + std::unique_ptr pt(new geometry_type(geometry_type::types::Point)); pt->move_to(x, y); - paths.push_back(pt); + paths.push_back(pt.release()); } void read_multipoint(boost::ptr_vector & paths) @@ -269,10 +269,10 @@ private: { double x = read_double(); double y = read_double(); - std::auto_ptr pt(new geometry_type(Point)); + std::unique_ptr pt(new geometry_type(geometry_type::types::Point)); pos_ += 8; // double z = read_double(); pt->move_to(x, y); - paths.push_back(pt); + paths.push_back(pt.release()); } void read_multipoint_xyz(boost::ptr_vector & paths) @@ -292,13 +292,13 @@ private: { CoordinateArray ar(num_points); read_coords(ar); - std::auto_ptr line(new geometry_type(LineString)); + std::unique_ptr line(new geometry_type(geometry_type::types::LineString)); line->move_to(ar[0].x, ar[0].y); for (int i = 1; i < num_points; ++i) { line->line_to(ar[i].x, ar[i].y); } - paths.push_back(line); + paths.push_back(line.release()); } } @@ -319,13 +319,13 @@ private: { CoordinateArray ar(num_points); read_coords_xyz(ar); - std::auto_ptr line(new geometry_type(LineString)); + std::unique_ptr line(new geometry_type(geometry_type::types::LineString)); line->move_to(ar[0].x, ar[0].y); for (int i = 1; i < num_points; ++i) { line->line_to(ar[i].x, ar[i].y); } - paths.push_back(line); + paths.push_back(line.release()); } } @@ -345,7 +345,7 @@ private: int num_rings = read_integer(); if (num_rings > 0) { - std::auto_ptr poly(new geometry_type(Polygon)); + std::unique_ptr poly(new geometry_type(geometry_type::types::Polygon)); for (int i = 0; i < num_rings; ++i) { int num_points = read_integer(); @@ -362,7 +362,7 @@ private: } } if (poly->size() > 3) // ignore if polygon has less than (3 + close_path) vertices - paths.push_back(poly); + paths.push_back(poly.release()); } } @@ -381,7 +381,7 @@ private: int num_rings = read_integer(); if (num_rings > 0) { - std::auto_ptr poly(new geometry_type(Polygon)); + std::unique_ptr poly(new geometry_type(geometry_type::types::Polygon)); for (int i = 0; i < num_rings; ++i) { int num_points = read_integer(); @@ -398,7 +398,7 @@ private: } } if (poly->size() > 2) // ignore if polygon has less than 3 vertices - paths.push_back(poly); + paths.push_back(poly.release()); } } diff --git a/src/wkt/wkt_generator.cpp b/src/wkt/wkt_generator.cpp index 16f81bfe5..5b7e57407 100644 --- a/src/wkt/wkt_generator.cpp +++ b/src/wkt/wkt_generator.cpp @@ -72,20 +72,20 @@ wkt_generator::wkt_generator(bool single) wkt = point | linestring | polygon ; - point = &uint_(mapnik::Point)[_1 = _type(_val)] + point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)] << string[ phoenix::if_ (single) [_1 = "Point("] .else_[_1 = "("]] << point_coord [_1 = _first(_val)] << lit(')') ; - linestring = &uint_(mapnik::LineString)[_1 = _type(_val)] + linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)] << string[ phoenix::if_ (single) [_1 = "LineString("] .else_[_1 = "("]] << coords << lit(')') ; - polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)] + polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)] << string[ phoenix::if_ (single) [_1 = "Polygon("] .else_[_1 = "("]] << coords2 @@ -126,9 +126,9 @@ wkt_multi_generator::wkt_multi_generator() using boost::spirit::karma::_a; geometry_types.add - (mapnik::Point,"Point") - (mapnik::LineString,"LineString") - (mapnik::Polygon,"Polygon") + (mapnik::geometry_type::types::Point,"Point") + (mapnik::geometry_type::types::LineString,"LineString") + (mapnik::geometry_type::types::Polygon,"Polygon") ; wkt = eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)] diff --git a/tests/cpp_tests/clipping_test.cpp b/tests/cpp_tests/clipping_test.cpp index 6e6c6ca6e..907d75147 100644 --- a/tests/cpp_tests/clipping_test.cpp +++ b/tests/cpp_tests/clipping_test.cpp @@ -6,7 +6,7 @@ // boost #include #include -#include + // stl #include @@ -54,7 +54,7 @@ void parse_geom(mapnik::geometry_type & geom, std::string const& geom_string) { std::vector vertices; boost::split(vertices, geom_string, boost::is_any_of(",")); - BOOST_FOREACH(std::string const& vert, vertices) + for (std::string const& vert : vertices) { std::vector commands; boost::split(commands, vert, boost::is_any_of(" ")); diff --git a/tests/cpp_tests/fontset_runtime_test.cpp b/tests/cpp_tests/fontset_runtime_test.cpp index 4e287296a..e99e46bc3 100644 --- a/tests/cpp_tests/fontset_runtime_test.cpp +++ b/tests/cpp_tests/fontset_runtime_test.cpp @@ -37,16 +37,16 @@ int main(int argc, char** argv) // create a renderable map with a fontset and a text symbolizer // and do not register any fonts, to ensure the error thrown is reasonable - mapnik::context_ptr ctx = boost::make_shared(); + mapnik::context_ptr ctx = std::make_shared(); ctx->push("name"); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1)); mapnik::transcoder tr("utf-8"); mapnik::value_unicode_string ustr = tr.transcode("hello world!"); feature->put("name",ustr); - 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(128,128); feature->add_geometry(pt); - boost::shared_ptr ds = boost::make_shared(); + std::shared_ptr ds = std::make_shared(); ds->push(feature); mapnik::Map m(256,256); mapnik::font_set fontset("fontset"); diff --git a/tests/cpp_tests/geometry_converters_test.cpp b/tests/cpp_tests/geometry_converters_test.cpp index 2444371cd..26986259b 100644 --- a/tests/cpp_tests/geometry_converters_test.cpp +++ b/tests/cpp_tests/geometry_converters_test.cpp @@ -23,7 +23,7 @@ struct output_geometry_backend { - output_geometry_backend(boost::ptr_vector & paths, mapnik::eGeomType type) + output_geometry_backend(boost::ptr_vector & paths, mapnik::geometry_type::types type) : paths_(paths), type_(type) {} @@ -32,17 +32,17 @@ struct output_geometry_backend { mapnik::vertex2d vtx(mapnik::vertex2d::no_init); path.rewind(0); - std::auto_ptr geom_ptr(new mapnik::geometry_type(type_)); + std::unique_ptr geom_ptr(new mapnik::geometry_type(type_)); while ((vtx.cmd = path.vertex(&vtx.x, &vtx.y)) != mapnik::SEG_END) { //std::cerr << vtx.x << "," << vtx.y << " cmd=" << vtx.cmd << std::endl; geom_ptr->push_vertex(vtx.x, vtx.y, (mapnik::CommandType)vtx.cmd); } - paths_.push_back(geom_ptr); + paths_.push_back(geom_ptr.release()); } boost::ptr_vector & paths_; - mapnik::eGeomType type_; + mapnik::geometry_type::types type_; }; boost::optional linestring_bbox_clipping(mapnik::box2d bbox, @@ -56,7 +56,7 @@ boost::optional linestring_bbox_clipping(mapnik::box2d bbox line_symbolizer sym; CoordTransform t(bbox.width(),bbox.height(), bbox); boost::ptr_vector output_paths; - output_geometry_backend backend(output_paths, mapnik::LineString); + output_geometry_backend backend(output_paths, mapnik::geometry_type::types::LineString); typedef boost::mpl::vector conv_types; vertex_converter, output_geometry_backend, line_symbolizer, @@ -71,7 +71,7 @@ boost::optional linestring_bbox_clipping(mapnik::box2d bbox throw std::runtime_error("Failed to parse WKT"); } - BOOST_FOREACH( geometry_type & geom, p) + for (geometry_type & geom : p) { converter.apply(geom); } @@ -96,7 +96,7 @@ boost::optional polygon_bbox_clipping(mapnik::box2d bbox, polygon_symbolizer sym; CoordTransform t(bbox.width(),bbox.height(), bbox); boost::ptr_vector output_paths; - output_geometry_backend backend(output_paths, mapnik::Polygon); + output_geometry_backend backend(output_paths, mapnik::geometry_type::types::Polygon); typedef boost::mpl::vector conv_types; vertex_converter, output_geometry_backend, polygon_symbolizer, @@ -111,7 +111,7 @@ boost::optional polygon_bbox_clipping(mapnik::box2d bbox, throw std::runtime_error("Failed to parse WKT"); } - BOOST_FOREACH( geometry_type & geom, p) + for (geometry_type & geom : p) { converter.apply(geom); } diff --git a/tests/cpp_tests/image_io_test.cpp b/tests/cpp_tests/image_io_test.cpp index c4b374d72..cc55cb99d 100644 --- a/tests/cpp_tests/image_io_test.cpp +++ b/tests/cpp_tests/image_io_test.cpp @@ -25,7 +25,6 @@ int main(int argc, char** argv) { BOOST_TEST(set_working_dir(args)); - #if defined(HAVE_JPEG) should_throw = "./tests/cpp_tests/data/blank.jpg"; BOOST_TEST( mapnik::util::exists( should_throw ) ); @@ -33,8 +32,8 @@ int main(int argc, char** argv) BOOST_TEST( type ); try { - std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); - if (reader.get()) BOOST_TEST( false ); + std::unique_ptr reader(mapnik::get_image_reader(should_throw,*type)); + BOOST_TEST( false ); } catch (std::exception const&) { @@ -49,21 +48,22 @@ int main(int argc, char** argv) BOOST_TEST( type ); try { - std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); - if (reader.get()) BOOST_TEST( false ); + std::unique_ptr reader(mapnik::get_image_reader(should_throw,*type)); + BOOST_TEST( false ); } catch (std::exception const&) { BOOST_TEST( true ); } + should_throw = "./tests/data/images/xcode-CgBI.png"; BOOST_TEST( mapnik::util::exists( should_throw ) ); type = mapnik::type_from_filename(should_throw); BOOST_TEST( type ); try { - std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); - if (reader.get()) BOOST_TEST( false ); + std::unique_ptr reader(mapnik::get_image_reader(should_throw,*type)); + BOOST_TEST( false ); } catch (std::exception const&) { @@ -78,8 +78,8 @@ int main(int argc, char** argv) BOOST_TEST( type ); try { - std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); - if (reader.get()) BOOST_TEST( false ); + std::unique_ptr reader(mapnik::get_image_reader(should_throw,*type)); + BOOST_TEST( false ); } catch (std::exception const&) { @@ -94,7 +94,7 @@ int main(int argc, char** argv) BOOST_TEST( type ); try { - std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); + std::unique_ptr reader(mapnik::get_image_reader(should_throw,*type)); BOOST_TEST( false ); } catch (std::exception const&) diff --git a/tests/cpp_tests/label_algo_test.cpp b/tests/cpp_tests/label_algo_test.cpp index d997d19b9..268f63595 100644 --- a/tests/cpp_tests/label_algo_test.cpp +++ b/tests/cpp_tests/label_algo_test.cpp @@ -19,7 +19,7 @@ int main(int argc, char** argv) double x,y; // single point - mapnik::geometry_type pt(mapnik::Point); + mapnik::geometry_type pt(mapnik::geometry_type::types::Point); pt.move_to(10,10); BOOST_TEST( mapnik::label::centroid(pt, x, y) ); BOOST_TEST( x == 10 ); @@ -32,7 +32,7 @@ int main(int argc, char** argv) BOOST_TEST_EQ( y, 15 ); // line with two verticies - mapnik::geometry_type line(mapnik::LineString); + mapnik::geometry_type line(mapnik::geometry_type::types::LineString); line.move_to(0,0); line.move_to(50,50); BOOST_TEST( mapnik::label::centroid(line, x, y) ); diff --git a/tests/cpp_tests/map_request_test.cpp b/tests/cpp_tests/map_request_test.cpp index fabfd34ab..d4dc339b5 100644 --- a/tests/cpp_tests/map_request_test.cpp +++ b/tests/cpp_tests/map_request_test.cpp @@ -17,29 +17,29 @@ #include #include #include + #include #include #include - #include "utils.hpp" bool compare_images(std::string const& src_fn,std::string const& dest_fn) { using namespace mapnik; - std::auto_ptr reader1(mapnik::get_image_reader(dest_fn,"png")); + std::unique_ptr 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_ptr1 = boost::make_shared(reader1->width(),reader1->height()); + std::shared_ptr image_ptr1 = std::make_shared(reader1->width(),reader1->height()); reader1->read(0,0,image_ptr1->data()); - std::auto_ptr reader2(mapnik::get_image_reader(src_fn,"png")); + std::unique_ptr 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_ptr2 = boost::make_shared(reader2->width(),reader2->height()); + std::shared_ptr image_ptr2 = std::make_shared(reader2->width(),reader2->height()); reader2->read(0,0,image_ptr2->data()); image_data_32 const& dest = image_ptr1->data(); @@ -116,7 +116,7 @@ int main(int argc, char** argv) mapnik::projection map_proj(m.srs(),true); double scale_denom = mapnik::scale_denominator(req.scale(),map_proj.is_geographic()); scale_denom *= scale_factor; - BOOST_FOREACH ( mapnik::layer const& lyr, m.layers() ) + for (mapnik::layer const& lyr : m.layers() ) { if (lyr.visible(scale_denom)) { diff --git a/tests/visual_tests/styles/geometry-transform-translate.xml b/tests/visual_tests/styles/geometry-transform-translate.xml index ee0344cd8..e61bf5a81 100644 --- a/tests/visual_tests/styles/geometry-transform-translate.xml +++ b/tests/visual_tests/styles/geometry-transform-translate.xml @@ -48,7 +48,7 @@ csv wkt -"POLYGON ((1 1, 4 1, 4 4, 1 4, 1 1), (2 2, 2 3, 3 3, 3 2, 2 2))" +"POLYGON ((1 1, 1 4, 4 4, 4 1, 1 1), (2 2, 3 2, 3 3, 2 3, 2 2))" diff --git a/utils/geometry_to_wkb/main.cpp b/utils/geometry_to_wkb/main.cpp index 5dd23aa32..b8048f283 100644 --- a/utils/geometry_to_wkb/main.cpp +++ b/utils/geometry_to_wkb/main.cpp @@ -29,7 +29,7 @@ #include #include -#include + int main (int argc, char ** argv ) @@ -70,7 +70,7 @@ int main (int argc, char ** argv ) mapnik::query q(ds->envelope()); mapnik::layer_descriptor layer_desc = ds->get_descriptor(); - BOOST_FOREACH ( mapnik::attribute_descriptor const& attr_desc, layer_desc.get_descriptors()) + for (mapnik::attribute_descriptor const& attr_desc : layer_desc.get_descriptors()) { q.add_property_name(attr_desc.get_name()); } @@ -82,7 +82,7 @@ int main (int argc, char ** argv ) { std::cerr << *f << std::endl; boost::ptr_vector & paths = f->paths(); - BOOST_FOREACH ( mapnik::geometry_type const& geom, paths) + for (mapnik::geometry_type const& geom : paths) { // NDR { diff --git a/utils/pgsql2sqlite/main.cpp b/utils/pgsql2sqlite/main.cpp index a5b13f945..632500115 100644 --- a/utils/pgsql2sqlite/main.cpp +++ b/utils/pgsql2sqlite/main.cpp @@ -28,7 +28,7 @@ // boost #include -#include +#include #include //stl @@ -96,7 +96,7 @@ int main ( int argc, char** argv) ConnectionCreator creator(host,port,dbname,user,password,connect_timeout); try { - boost::shared_ptr conn(creator()); + std::shared_ptr conn(creator()); std::string query = vm["query"].as(); std::string output_table_name = vm.count("table") ? vm["table"].as() : mapnik::sql_utils::table_from_sql(query); diff --git a/utils/pgsql2sqlite/pgsql2sqlite.hpp b/utils/pgsql2sqlite/pgsql2sqlite.hpp index 8962d0f9f..a8cd76219 100644 --- a/utils/pgsql2sqlite/pgsql2sqlite.hpp +++ b/utils/pgsql2sqlite/pgsql2sqlite.hpp @@ -35,13 +35,12 @@ // boost #include -#include -#include #include //stl #include #include +#include static std::string numeric2string(const char* buf) { @@ -50,7 +49,7 @@ static std::string numeric2string(const char* buf) boost::int16_t sign = int2net(buf+4); boost::int16_t dscale = int2net(buf+6); - boost::scoped_array digits(new boost::int16_t[ndigits]); + const std::unique_ptr digits(new boost::int16_t[ndigits]); for (int n=0; n < ndigits ;++n) { digits[n] = int2net(buf+8+n*2); @@ -167,7 +166,7 @@ void pgsql2sqlite(Connection conn, namespace sqlite = mapnik::sqlite; sqlite::database db(output_filename); - boost::shared_ptr rs = conn->executeQuery("select * from (" + query + ") as query limit 0;"); + std::shared_ptr rs = conn->executeQuery("select * from (" + query + ") as query limit 0;"); int count = rs->getNumFields(); std::ostringstream select_sql; @@ -234,7 +233,7 @@ void pgsql2sqlite(Connection conn, cursor_sql << "DECLARE " << cursor_name << " BINARY INSENSITIVE NO SCROLL CURSOR WITH HOLD FOR " << select_sql_str << " FOR READ ONLY"; conn->execute(cursor_sql.str()); - boost::shared_ptr cursor(new CursorResultSet(conn,cursor_name,10000)); + std::shared_ptr cursor(new CursorResultSet(conn,cursor_name,10000)); unsigned num_fields = cursor->getNumFields(); @@ -249,7 +248,7 @@ void pgsql2sqlite(Connection conn, std::string output_table_insert_sql = "insert into " + output_table_name + " values (?"; - context_ptr ctx = boost::make_shared(); + context_ptr ctx = std::make_shared(); for ( unsigned pos = 0; pos < num_fields ; ++pos) { diff --git a/utils/pgsql2sqlite/sqlite.hpp b/utils/pgsql2sqlite/sqlite.hpp index 1266a7604..75d711fff 100644 --- a/utils/pgsql2sqlite/sqlite.hpp +++ b/utils/pgsql2sqlite/sqlite.hpp @@ -22,7 +22,7 @@ #include // boost -#include +#include #include //sqlite3 @@ -52,7 +52,7 @@ namespace mapnik { namespace sqlite { } }; - typedef boost::shared_ptr sqlite_db; + typedef std::shared_ptr sqlite_db; sqlite_db db_; public: @@ -186,4 +186,3 @@ namespace mapnik { namespace sqlite { }; } } -