From 45c5a3768fc834513a1a2b955ee7330e004168b0 Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 12 Jul 2016 17:42:53 +0100 Subject: [PATCH 01/21] extract_bounding_box_grammar - make features optional / ref #3463 --- include/mapnik/json/extract_bounding_box_grammar_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mapnik/json/extract_bounding_box_grammar_impl.hpp b/include/mapnik/json/extract_bounding_box_grammar_impl.hpp index 9e21baa08..25ddbcd92 100644 --- a/include/mapnik/json/extract_bounding_box_grammar_impl.hpp +++ b/include/mapnik/json/extract_bounding_box_grammar_impl.hpp @@ -110,7 +110,7 @@ extract_bounding_box_grammar::extract_bounding_bo >> *((json.key_value - lit("\"features\"")) >> lit(',')) >> lit("\"features\"") >> lit(':')) - >> lit('[') >> (feature(_r1,_a) % lit(',')) >> lit(']') + >> lit('[') >> -(feature(_r1,_a) % lit(',')) >> lit(']') ; feature = raw[lit('{')[_a = 1] From 75781a999c33afb0d54041a1208d3cc475dec8e4 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 13 Jul 2016 15:07:08 +0100 Subject: [PATCH 02/21] add empty_featureset (returning feature_ptr()) implementation --- include/mapnik/featureset.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/mapnik/featureset.hpp b/include/mapnik/featureset.hpp index c6829d1eb..6886d8755 100644 --- a/include/mapnik/featureset.hpp +++ b/include/mapnik/featureset.hpp @@ -41,8 +41,23 @@ struct MAPNIK_DECL Featureset : private util::noncopyable virtual ~Featureset() {} }; + +struct MAPNIK_DECL empty_featureset final : Featureset +{ + feature_ptr next() + { + return feature_ptr(); + } + ~empty_featureset() {} +}; + using featureset_ptr = std::shared_ptr; +inline featureset_ptr make_empty_featureset() +{ + return std::make_shared(); +} + } #endif // MAPNIK_FEATURESET_HPP From bab985dd0426f9527571ff5bd3629168b4c5ef95 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 13 Jul 2016 15:16:33 +0100 Subject: [PATCH 03/21] always return am empty featureset instead of featureset_ptr() --- plugins/input/csv/csv_datasource.cpp | 2 +- plugins/input/geojson/geojson_datasource.cpp | 4 ++-- plugins/input/ogr/ogr_datasource.cpp | 4 ++-- plugins/input/pgraster/pgraster_datasource.cpp | 6 +++--- plugins/input/postgis/postgis_datasource.cpp | 6 +++--- plugins/input/raster/raster_datasource.cpp | 2 +- plugins/input/sqlite/sqlite_datasource.cpp | 4 ++-- plugins/input/topojson/topojson_datasource.cpp | 2 +- src/map.cpp | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index 6c1ff1014..4a246b404 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -431,7 +431,7 @@ mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const return std::make_shared(filename_, filter, locator_, separator_, quote_, headers_, ctx_); } } - return mapnik::featureset_ptr(); + return mapnik::make_empty_featureset(); } mapnik::featureset_ptr csv_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index e9456f8e1..d2ebc2d54 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -587,8 +587,8 @@ mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) cons } } - // otherwise return an empty featureset pointer - return mapnik::featureset_ptr(); + // otherwise return an empty featureset + return mapnik::make_empty_featureset(); } mapnik::featureset_ptr geojson_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index dc0fc9bec..2943962fc 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -560,7 +560,7 @@ featureset_ptr ogr_datasource::features(query const& q) const } } - return featureset_ptr(); + return mapnik::make_empty_featureset(); } featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol) const @@ -603,5 +603,5 @@ featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol) } } - return featureset_ptr(); + return mapnik::make_empty_featureset(); } diff --git a/plugins/input/pgraster/pgraster_datasource.cpp b/plugins/input/pgraster/pgraster_datasource.cpp index 9390f3ace..ced1810b5 100644 --- a/plugins/input/pgraster/pgraster_datasource.cpp +++ b/plugins/input/pgraster/pgraster_datasource.cpp @@ -998,7 +998,7 @@ featureset_ptr pgraster_datasource::features_with_context(query const& q,process } - return featureset_ptr(); + return mapnik::make_empty_featureset(); } @@ -1011,7 +1011,7 @@ featureset_ptr pgraster_datasource::features_at_point(coord2d const& pt, double if (pool) { shared_ptr conn = pool->borrowObject(); - if (!conn) return featureset_ptr(); + if (!conn) return mapnik::make_empty_featureset(); if (conn->isOK()) { @@ -1082,7 +1082,7 @@ featureset_ptr pgraster_datasource::features_at_point(coord2d const& pt, double } } - return featureset_ptr(); + return mapnik::make_empty_featureset(); } box2d pgraster_datasource::envelope() const diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index 909cd58ba..8aef44414 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -942,7 +942,7 @@ featureset_ptr postgis_datasource::features_with_context(query const& q,processo } - return featureset_ptr(); + return mapnik::make_empty_featureset(); } @@ -955,7 +955,7 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double t if (pool) { shared_ptr conn = pool->borrowObject(); - if (!conn) return featureset_ptr(); + if (!conn) return mapnik::make_empty_featureset(); if (conn->isOK()) { @@ -1030,7 +1030,7 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double t } } - return featureset_ptr(); + return mapnik::make_empty_featureset(); } box2d postgis_datasource::envelope() const diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 4d8b5f99a..38a6aa94c 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -224,5 +224,5 @@ featureset_ptr raster_datasource::features_at_point(coord2d const&, double tol) { MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported"; - return featureset_ptr(); + return mapnik::make_empty_featureset(); } diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index 939d9d319..37e44117b 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -551,7 +551,7 @@ featureset_ptr sqlite_datasource::features(query const& q) const using_subquery_); } - return featureset_ptr(); + return mapnik::make_empty_featureset(); } featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double tol) const @@ -631,5 +631,5 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double to using_subquery_); } - return featureset_ptr(); + return mapnik::make_empty_featureset(); } diff --git a/plugins/input/topojson/topojson_datasource.cpp b/plugins/input/topojson/topojson_datasource.cpp index 502868562..e6cab26d8 100644 --- a/plugins/input/topojson/topojson_datasource.cpp +++ b/plugins/input/topojson/topojson_datasource.cpp @@ -284,7 +284,7 @@ mapnik::featureset_ptr topojson_datasource::features(mapnik::query const& q) con } } // otherwise return an empty featureset pointer - return mapnik::featureset_ptr(); + return mapnik::make_empty_featureset(); } mapnik::featureset_ptr topojson_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const diff --git a/src/map.cpp b/src/map.cpp index 3aff557c4..ca813e273 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -746,7 +746,7 @@ featureset_ptr Map::query_point(unsigned index, double x, double y) const else s << " (map has no layers)"; throw std::out_of_range(s.str()); } - return featureset_ptr(); + return mapnik::make_empty_featureset(); } featureset_ptr Map::query_map_point(unsigned index, double x, double y) const From c457d93804929d5559a58f1c7a1f15702e6544a4 Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 14 Jul 2016 09:45:55 +0100 Subject: [PATCH 04/21] use `count(key)` --- include/mapnik/feature.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mapnik/feature.hpp b/include/mapnik/feature.hpp index f340c83d6..1300d3220 100644 --- a/include/mapnik/feature.hpp +++ b/include/mapnik/feature.hpp @@ -154,7 +154,7 @@ public: inline bool has_key(context_type::key_type const& key) const { - return (ctx_->mapping_.find(key) != ctx_->mapping_.end()); + return (ctx_->mapping_.count(key) == 1); } inline value_type const& get(context_type::key_type const& key) const From 3397b8f14fa649f8907bd7b2974f1b5792cf99ef Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 14 Jul 2016 09:46:37 +0100 Subject: [PATCH 05/21] feature_kv_iterator - change logic in 'increment' to skip key/value's when value doesn't exist --- include/mapnik/feature_kv_iterator.hpp | 2 +- src/feature_kv_iterator.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/mapnik/feature_kv_iterator.hpp b/include/mapnik/feature_kv_iterator.hpp index 77b292fd5..3abe37131 100644 --- a/include/mapnik/feature_kv_iterator.hpp +++ b/include/mapnik/feature_kv_iterator.hpp @@ -46,7 +46,7 @@ class feature_impl; class MAPNIK_DECL feature_kv_iterator : public boost::iterator_facade const, + std::tuple const, boost::forward_traversal_tag> { public: diff --git a/src/feature_kv_iterator.cpp b/src/feature_kv_iterator.cpp index 4ae384254..241908ab6 100644 --- a/src/feature_kv_iterator.cpp +++ b/src/feature_kv_iterator.cpp @@ -39,16 +39,20 @@ feature_kv_iterator::feature_kv_iterator (feature_impl const& f, bool begin) void feature_kv_iterator::increment() { ++itr_; + for ( ;itr_ != f_.ctx_->end(); ++itr_) + { + if (f_.has_key(itr_->first)) break; + } } void feature_kv_iterator::decrement() { - // dummy //--itr_; + // no-op //--itr_; } void feature_kv_iterator::advance(boost::iterator_difference::type ) { - // dummy + // no-op } bool feature_kv_iterator::equal( feature_kv_iterator const& other) const From 8ce58ea29c61cb9cc75eb660b26f969a39097854 Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 14 Jul 2016 10:09:34 +0100 Subject: [PATCH 06/21] allow "null" values when genrating Feature GeoJSON --- include/mapnik/json/feature_generator_grammar.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/mapnik/json/feature_generator_grammar.hpp b/include/mapnik/json/feature_generator_grammar.hpp index 9eaa3bb99..d2a5c8e52 100644 --- a/include/mapnik/json/feature_generator_grammar.hpp +++ b/include/mapnik/json/feature_generator_grammar.hpp @@ -40,26 +40,26 @@ struct is_container : mpl::false_ {} ; template <> struct container_iterator { - using type = mapnik::feature_kv_iterator2; + using type = mapnik::feature_kv_iterator; }; template <> struct begin_container { - static mapnik::feature_kv_iterator2 + static mapnik::feature_kv_iterator call (mapnik::feature_impl const& f) { - return mapnik::feature_kv_iterator2(mapnik::value_not_null(),f.begin(),f.end()); + return f.begin(); } }; template <> struct end_container { - static mapnik::feature_kv_iterator2 + static mapnik::feature_kv_iterator call (mapnik::feature_impl const& f) { - return mapnik::feature_kv_iterator2(mapnik::value_not_null(),f.end(),f.end()); + return f.end(); } }; From 54d51e2728f777c2b8787f95b54a56ca3a93adf2 Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 15 Jul 2016 12:21:41 +0100 Subject: [PATCH 07/21] Revert "feature_kv_iterator - change logic in 'increment' to skip key/value's when value doesn't exist" This reverts commit 3397b8f14fa649f8907bd7b2974f1b5792cf99ef. --- include/mapnik/feature_kv_iterator.hpp | 2 +- src/feature_kv_iterator.cpp | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/mapnik/feature_kv_iterator.hpp b/include/mapnik/feature_kv_iterator.hpp index 3abe37131..77b292fd5 100644 --- a/include/mapnik/feature_kv_iterator.hpp +++ b/include/mapnik/feature_kv_iterator.hpp @@ -46,7 +46,7 @@ class feature_impl; class MAPNIK_DECL feature_kv_iterator : public boost::iterator_facade const, + std::tuple const, boost::forward_traversal_tag> { public: diff --git a/src/feature_kv_iterator.cpp b/src/feature_kv_iterator.cpp index 241908ab6..4ae384254 100644 --- a/src/feature_kv_iterator.cpp +++ b/src/feature_kv_iterator.cpp @@ -39,20 +39,16 @@ feature_kv_iterator::feature_kv_iterator (feature_impl const& f, bool begin) void feature_kv_iterator::increment() { ++itr_; - for ( ;itr_ != f_.ctx_->end(); ++itr_) - { - if (f_.has_key(itr_->first)) break; - } } void feature_kv_iterator::decrement() { - // no-op //--itr_; + // dummy //--itr_; } void feature_kv_iterator::advance(boost::iterator_difference::type ) { - // no-op + // dummy } bool feature_kv_iterator::equal( feature_kv_iterator const& other) const From 6f8f286b8db62f4ce1a9fbcc0bda5e638d43478a Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 15 Jul 2016 12:22:03 +0100 Subject: [PATCH 08/21] Revert "allow "null" values when genrating Feature GeoJSON" This reverts commit 8ce58ea29c61cb9cc75eb660b26f969a39097854. --- include/mapnik/json/feature_generator_grammar.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/mapnik/json/feature_generator_grammar.hpp b/include/mapnik/json/feature_generator_grammar.hpp index d2a5c8e52..9eaa3bb99 100644 --- a/include/mapnik/json/feature_generator_grammar.hpp +++ b/include/mapnik/json/feature_generator_grammar.hpp @@ -40,26 +40,26 @@ struct is_container : mpl::false_ {} ; template <> struct container_iterator { - using type = mapnik::feature_kv_iterator; + using type = mapnik::feature_kv_iterator2; }; template <> struct begin_container { - static mapnik::feature_kv_iterator + static mapnik::feature_kv_iterator2 call (mapnik::feature_impl const& f) { - return f.begin(); + return mapnik::feature_kv_iterator2(mapnik::value_not_null(),f.begin(),f.end()); } }; template <> struct end_container { - static mapnik::feature_kv_iterator + static mapnik::feature_kv_iterator2 call (mapnik::feature_impl const& f) { - return f.end(); + return mapnik::feature_kv_iterator2(mapnik::value_not_null(),f.end(),f.end()); } }; From 3d0b10973911fb19049a8dd6f906092ee25098dd Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 15 Jul 2016 12:22:53 +0100 Subject: [PATCH 09/21] value_null - always represent as "null" --- src/value.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/value.cpp b/src/value.cpp index a3c8770cc..7c6aca2be 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -673,7 +673,7 @@ struct convert std::string operator()(value_null const&) const { - return std::string(); + return std::string("null"); } }; @@ -708,7 +708,7 @@ struct to_unicode_impl value_unicode_string operator()(value_null const&) const { - return value_unicode_string(); + return value_unicode_string("null"); } }; From 85a6ef9a154ce3176f4c68306e5586ead288a61d Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 19 Jul 2016 10:24:31 +0100 Subject: [PATCH 10/21] update variant deps --- deps/mapbox/variant | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/mapbox/variant b/deps/mapbox/variant index b5728ad76..c511b2f34 160000 --- a/deps/mapbox/variant +++ b/deps/mapbox/variant @@ -1 +1 @@ -Subproject commit b5728ad76e1402c130a9330aa44b6f4b655b13b4 +Subproject commit c511b2f34d966c09e02a1b833db33a9a1f9b2196 From 7712f253c956c8cedd5ac400d257b342f934dfe2 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 20 Jul 2016 12:39:55 +0200 Subject: [PATCH 11/21] represent value_null as an empty string e.g "" (text rendering logic) --- src/value.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/value.cpp b/src/value.cpp index 7c6aca2be..b5ad606c7 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -673,7 +673,7 @@ struct convert std::string operator()(value_null const&) const { - return std::string("null"); + return std::string(""); } }; @@ -708,7 +708,7 @@ struct to_unicode_impl value_unicode_string operator()(value_null const&) const { - return value_unicode_string("null"); + return value_unicode_string(""); } }; From d17f1f076d32e1a7374eca020868b658b805f886 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 20 Jul 2016 13:19:08 +0200 Subject: [PATCH 12/21] workaround travis bug: 'shell_session_update: command not found' --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 967786acd..7235c9b92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,12 @@ matrix: env: JOBS=4 MASON_PUBLISH=true _CXX="ccache clang++ -Qunused-arguments" before_install: +# workaround travis rvm bug +# http://superuser.com/questions/1044130/why-am-i-having-how-can-i-fix-this-error-shell-session-update-command-not-f +- | + if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then + rvm get head || true + fi - if [[ ${_CXX:-false} != false ]]; then export CXX=${_CXX}; fi - if [[ ${_CC:-false} != false ]]; then export CC=${_CC}; fi - source scripts/travis-common.sh From 7fa35f481e260c99d0638514dcc18ee7635b51b5 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 20 Jul 2016 13:59:11 +0200 Subject: [PATCH 13/21] Support creating paletted images for any number of pixels e.g < 3 (ref #3466) --- include/mapnik/palette.hpp | 21 ++++++++--- include/mapnik/png_io.hpp | 75 +++++++++++++++++++++++++------------- src/palette.cpp | 10 ----- 3 files changed, 66 insertions(+), 40 deletions(-) diff --git a/include/mapnik/palette.hpp b/include/mapnik/palette.hpp index 5f9627239..1276d1302 100644 --- a/include/mapnik/palette.hpp +++ b/include/mapnik/palette.hpp @@ -43,6 +43,7 @@ using rgba_hash_table = std::unordered_map; // stl #include +#include #define U2RED(x) ((x)&0xff) #define U2GREEN(x) (((x)>>8)&0xff) @@ -53,7 +54,8 @@ namespace mapnik { struct rgba; -struct MAPNIK_DECL rgb { +struct MAPNIK_DECL rgb +{ std::uint8_t r; std::uint8_t g; std::uint8_t b; @@ -92,7 +94,7 @@ struct MAPNIK_DECL rgba b(U2BLUE(c)), a(U2ALPHA(c)) {} - inline bool operator==(const rgba& y) const + inline bool operator==(rgba const& y) const { return r == y.r && g == y.g && b == y.b && a == y.a; } @@ -103,18 +105,27 @@ struct MAPNIK_DECL rgba bool operator() (const rgba& x, const rgba& y) const; }; + inline bool operator<(rgba const& y) const + { + return std::tie(r, g, b, a) < std::tie(y.r, y.g, y.b, y.a); + } + }; -class MAPNIK_DECL rgba_palette : private util::noncopyable { +class MAPNIK_DECL rgba_palette : private util::noncopyable +{ public: enum palette_type { PALETTE_RGBA = 0, PALETTE_RGB = 1, PALETTE_ACT = 2 }; explicit rgba_palette(std::string const& pal, palette_type type = PALETTE_RGBA); rgba_palette(); - const std::vector& palette() const; - const std::vector& alphaTable() const; + inline std::vector const& palette() const { return rgb_pal_;} + inline std::vector const& alpha_table() const { return alpha_pal_;} + + inline std::vector& palette() { return rgb_pal_;} + inline std::vector& alpha_table() { return alpha_pal_;} unsigned char quantize(unsigned c) const; diff --git a/include/mapnik/png_io.hpp b/include/mapnik/png_io.hpp index 051ea6b4e..9f8b38d8f 100644 --- a/include/mapnik/png_io.hpp +++ b/include/mapnik/png_io.hpp @@ -39,7 +39,7 @@ extern "C" { #include } - +#include #pragma GCC diagnostic pop #define MAX_OCTREE_LEVELS 4 @@ -515,19 +515,19 @@ void save_as_png8_oct(T1 & file, } //transparency values per palette index - std::vector alphaTable; - //alphaTable.resize(palette.size());//allow semitransparency also in almost opaque range + std::vector alpha_table; + //alpha_table.resize(palette.size());//allow semitransparency also in almost opaque range if (opts.trans_mode != 0) { - alphaTable.resize(palette.size() - cols[TRANSPARENCY_LEVELS-1]); + alpha_table.resize(palette.size() - cols[TRANSPARENCY_LEVELS-1]); } if (palette.size() > 16 ) { // >16 && <=256 colors -> write 8-bit color depth image_gray8 reduced_image(width,height); - reduce_8(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alphaTable); - save_as_png(file,palette,reduced_image,width,height,8,alphaTable,opts); + reduce_8(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alpha_table); + save_as_png(file,palette,reduced_image,width,height,8,alpha_table,opts); } else if (palette.size() == 1) { @@ -535,13 +535,13 @@ void save_as_png8_oct(T1 & file, unsigned image_width = ((width + 15) >> 3) & ~1U; // 1-bit image, round up to 16-bit boundary unsigned image_height = height; image_gray8 reduced_image(image_width,image_height); - reduce_1(image,reduced_image,trees, limits, alphaTable); + reduce_1(image,reduced_image,trees, limits, alpha_table); if (meanAlpha<255 && cols[0]==0) { - alphaTable.resize(1); - alphaTable[0] = meanAlpha; + alpha_table.resize(1); + alpha_table[0] = meanAlpha; } - save_as_png(file,palette,reduced_image,width,height,1,alphaTable,opts); + save_as_png(file,palette,reduced_image,width,height,1,alpha_table,opts); } else { @@ -549,8 +549,8 @@ void save_as_png8_oct(T1 & file, unsigned image_width = ((width + 7) >> 1) & ~3U; // 4-bit image, round up to 32-bit boundary unsigned image_height = height; image_gray8 reduced_image(image_width,image_height); - reduce_4(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alphaTable); - save_as_png(file,palette,reduced_image,width,height,4,alphaTable,opts); + reduce_4(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alpha_table); + save_as_png(file,palette,reduced_image,width,height,4,alpha_table,opts); } } @@ -560,7 +560,7 @@ void save_as_png8(T1 & file, T2 const& image, T3 const & tree, std::vector const& palette, - std::vector const& alphaTable, + std::vector const& alpha_table, png_options const& opts) { unsigned width = image.width(); @@ -579,7 +579,7 @@ void save_as_png8(T1 & file, row_out[x] = tree.quantize(row[x]); } } - save_as_png(file, palette, reduced_image, width, height, 8, alphaTable, opts); + save_as_png(file, palette, reduced_image, width, height, 8, alpha_table, opts); } else if (palette.size() == 1) { @@ -588,7 +588,7 @@ void save_as_png8(T1 & file, unsigned image_height = height; image_gray8 reduced_image(image_width, image_height); reduced_image.set(0); - save_as_png(file, palette, reduced_image, width, height, 1, alphaTable, opts); + save_as_png(file, palette, reduced_image, width, height, 1, alpha_table, opts); } else { @@ -612,7 +612,7 @@ void save_as_png8(T1 & file, row_out[x>>1] |= index; } } - save_as_png(file, palette, reduced_image, width, height, 4, alphaTable, opts); + save_as_png(file, palette, reduced_image, width, height, 4, alpha_table, opts); } } @@ -623,6 +623,7 @@ void save_as_png8_hex(T1 & file, { unsigned width = image.width(); unsigned height = image.height(); + if (width + height > 3) // at least 3 pixels (hextree implementation requirement) { // structure for color quantization @@ -647,20 +648,44 @@ void save_as_png8_hex(T1 & file, } //transparency values per palette index - std::vector pal; - tree.create_palette(pal); + std::vector rgba_palette; + tree.create_palette(rgba_palette); + auto size = rgba_palette.size(); std::vector palette; - std::vector alphaTable; - for (unsigned i=0; i alpha_table; + palette.reserve(size); + alpha_table.reserve(size); + for (auto const& c : rgba_palette) { - palette.push_back(rgb(pal[i].r, pal[i].g, pal[i].b)); - alphaTable.push_back(pal[i].a); + palette.emplace_back(c.r, c.g, c.b); + alpha_table.push_back(c.a); } - save_as_png8 >(file, image, tree, palette, alphaTable, opts); + save_as_png8 >(file, image, tree, palette, alpha_table, opts); } else { - throw std::runtime_error("Can't quantize images with less than 3 pixels"); + + std::set colors; + for (unsigned y = 0; y < height; ++y) + { + typename T2::pixel_type const * row = image.get_row(y); + + for (unsigned x = 0; x < width; ++x) + { + unsigned val = row[x]; + colors.emplace(U2RED(val), U2GREEN(val), U2BLUE(val), U2ALPHA(val)); + } + } + std::string str; + for (auto c : colors) + { + str.push_back(c.r); + str.push_back(c.g); + str.push_back(c.b); + str.push_back(c.a); + } + rgba_palette pal(str, rgba_palette::PALETTE_RGBA); + save_as_png8(file, image, pal, pal.palette(), pal.alpha_table(), opts); } } @@ -670,7 +695,7 @@ void save_as_png8_pal(T1 & file, rgba_palette const& pal, png_options const& opts) { - save_as_png8(file, image, pal, pal.palette(), pal.alphaTable(), opts); + save_as_png8(file, image, pal, pal.palette(), pal.alpha_table(), opts); } } diff --git a/src/palette.cpp b/src/palette.cpp index 4c3807d1c..1fc5b8b21 100644 --- a/src/palette.cpp +++ b/src/palette.cpp @@ -65,16 +65,6 @@ rgba_palette::rgba_palette() #endif } -const std::vector& rgba_palette::palette() const -{ - return rgb_pal_; -} - -const std::vector& rgba_palette::alphaTable() const -{ - return alpha_pal_; -} - bool rgba_palette::valid() const { return colors_ > 0; From 3c86ab77c49371fd0fae74c377d5de294ed22d48 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 20 Jul 2016 14:09:54 +0200 Subject: [PATCH 14/21] [travis] fix indentation --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7235c9b92..5de9299f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,12 +45,12 @@ matrix: env: JOBS=4 MASON_PUBLISH=true _CXX="ccache clang++ -Qunused-arguments" before_install: -# workaround travis rvm bug -# http://superuser.com/questions/1044130/why-am-i-having-how-can-i-fix-this-error-shell-session-update-command-not-f -- | - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - rvm get head || true - fi + # workaround travis rvm bug + # http://superuser.com/questions/1044130/why-am-i-having-how-can-i-fix-this-error-shell-session-update-command-not-f + - | + if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then + rvm get head || true + fi - if [[ ${_CXX:-false} != false ]]; then export CXX=${_CXX}; fi - if [[ ${_CC:-false} != false ]]; then export CC=${_CC}; fi - source scripts/travis-common.sh From 2864d9046059831a182c432465a9c04c924b25da Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 25 Jul 2016 13:45:35 +0200 Subject: [PATCH 15/21] more explicit conversions to the target variant type --- include/mapnik/params.hpp | 4 ++++ include/mapnik/symbolizer_base.hpp | 2 +- include/mapnik/xml_attribute_cast.hpp | 15 ++++++++++++++- plugins/input/postgis/postgis_datasource.cpp | 2 +- src/load_map.cpp | 18 +++++++++--------- src/text/formatting/layout.cpp | 6 +++--- src/text/text_properties.cpp | 12 ++++++------ src/xml_tree.cpp | 2 ++ utils/pgsql2sqlite/pgsql2sqlite.hpp | 10 +++++----- 9 files changed, 45 insertions(+), 26 deletions(-) diff --git a/include/mapnik/params.hpp b/include/mapnik/params.hpp index a38fa54e7..535cacb38 100644 --- a/include/mapnik/params.hpp +++ b/include/mapnik/params.hpp @@ -51,6 +51,10 @@ struct value_holder : value_holder_base value_holder() : value_holder_base() {} + // C-string -> std::string + value_holder(char const* str) + : value_holder(std::string(str)) {} + // perfect forwarding template value_holder(T && obj) diff --git a/include/mapnik/symbolizer_base.hpp b/include/mapnik/symbolizer_base.hpp index fc88c579c..f07cf3d2a 100644 --- a/include/mapnik/symbolizer_base.hpp +++ b/include/mapnik/symbolizer_base.hpp @@ -101,7 +101,7 @@ struct strict_value : value_base_type strict_value() = default; strict_value(const char* val) - : value_base_type(val) {} + : value_base_type(std::string(val)) {} template strict_value(T const& obj) diff --git a/include/mapnik/xml_attribute_cast.hpp b/include/mapnik/xml_attribute_cast.hpp index fb3b7ebdc..cafa7e79a 100644 --- a/include/mapnik/xml_attribute_cast.hpp +++ b/include/mapnik/xml_attribute_cast.hpp @@ -55,7 +55,7 @@ struct do_xml_attribute_cast { static inline boost::optional xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& /*source*/) { - std::string err_msg("No conversion from std::string to"); + std::string err_msg("No conversion from std::string to "); err_msg += std::string(typeid(T).name()); throw std::runtime_error(err_msg); } @@ -74,6 +74,19 @@ struct do_xml_attribute_cast } }; +// specialization for mapnik::value_bool +template <> +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source) + { + bool result; + if (mapnik::util::string2bool(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + // specialization for int template <> struct do_xml_attribute_cast diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index 8aef44414..2653e5757 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -479,7 +479,7 @@ postgis_datasource::postgis_datasource(parameters const& params) // Finally, add unique metadata to layer descriptor mapnik::parameters & extra_params = desc_.get_extra_parameters(); // explicitly make copies of values due to https://github.com/mapnik/mapnik/issues/2651 - extra_params["srid"] = srid_; + extra_params["srid"] = mapnik::value_integer(srid_); if (!key_field_.empty()) { extra_params["key_field"] = key_field_; diff --git a/src/load_map.cpp b/src/load_map.cpp index f21708274..fcb04c003 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -200,7 +200,7 @@ void map_parser::parse_map(Map & map, xml_node const& node, std::string const& b { map.set_background(*bgcolor); } - + optional image_filename = map_node.get_opt_attr("background-image"); if (image_filename) { @@ -891,7 +891,7 @@ void map_parser::parse_symbolizer_base(symbolizer_base &sym, xml_node const& nod { set_symbolizer_property(sym, keys::simplify_tolerance, node); set_symbolizer_property(sym, keys::smooth, node); - set_symbolizer_property(sym, keys::clip, node); + set_symbolizer_property(sym, keys::clip, node); set_symbolizer_property(sym, keys::comp_op, node); set_symbolizer_property(sym, keys::geometry_transform, node); set_symbolizer_property(sym, keys::simplify_algorithm, node); @@ -907,8 +907,8 @@ void map_parser::parse_point_symbolizer(rule & rule, xml_node const & node) point_symbolizer sym; parse_symbolizer_base(sym, node); set_symbolizer_property(sym, keys::opacity, node); - set_symbolizer_property(sym, keys::allow_overlap, node); - set_symbolizer_property(sym, keys::ignore_placement, node); + set_symbolizer_property(sym, keys::allow_overlap, node); + set_symbolizer_property(sym, keys::ignore_placement, node); set_symbolizer_property(sym, keys::point_placement_type, node); set_symbolizer_property(sym, keys::image_transform, node); if (file && !file->empty()) @@ -1011,9 +1011,9 @@ void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& node) set_symbolizer_property(sym, keys::offset, node); set_symbolizer_property(sym, keys::width, node); set_symbolizer_property(sym, keys::height, node); - set_symbolizer_property(sym, keys::allow_overlap, node); - set_symbolizer_property(sym, keys::avoid_edges, node); - set_symbolizer_property(sym, keys::ignore_placement, node); + set_symbolizer_property(sym, keys::allow_overlap, node); + set_symbolizer_property(sym, keys::avoid_edges, node); + set_symbolizer_property(sym, keys::ignore_placement, node); set_symbolizer_property(sym, keys::fill, node); set_symbolizer_property(sym, keys::image_transform, node); set_symbolizer_property(sym, keys::markers_placement_type, node); @@ -1172,7 +1172,7 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& node) set_symbolizer_property(sym, keys::shield_dx, node); set_symbolizer_property(sym, keys::shield_dy, node); set_symbolizer_property(sym, keys::opacity, node); - set_symbolizer_property(sym, keys::unlock_image, node); + set_symbolizer_property(sym, keys::unlock_image, node); std::string file = node.get_attr("file"); if (file.empty()) @@ -1343,7 +1343,7 @@ void map_parser::parse_raster_symbolizer(rule & rule, xml_node const & node) // premultiplied status of image optional premultiplied = node.get_opt_attr("premultiplied"); - if (premultiplied) put(raster_sym, keys::premultiplied, *premultiplied); + if (premultiplied) put(raster_sym, keys::premultiplied, bool(*premultiplied)); bool found_colorizer = false; for ( auto const& css : node) diff --git a/src/text/formatting/layout.cpp b/src/text/formatting/layout.cpp index ef908c569..9a5ca10aa 100644 --- a/src/text/formatting/layout.cpp +++ b/src/text/formatting/layout.cpp @@ -75,9 +75,9 @@ node_ptr layout_node::from_xml(xml_node const& xml, fontset_map const& fontsets) if (xml.has_attribute("text-ratio")) set_property_from_xml(n->text_ratio, "text-ratio", xml); if (xml.has_attribute("wrap-width")) set_property_from_xml(n->wrap_width, "wrap-width", xml); if (xml.has_attribute("wrap-character")) set_property_from_xml(n->wrap_char, "wrap-character", xml); - if (xml.has_attribute("wrap-before")) set_property_from_xml(n->wrap_before, "wrap-before", xml); - if (xml.has_attribute("repeat-wrap-character")) set_property_from_xml(n->repeat_wrap_char, "repeat-wrap-character", xml); - if (xml.has_attribute("rotate-displacement")) set_property_from_xml(n->rotate_displacement, "rotate-displacement", xml); + if (xml.has_attribute("wrap-before")) set_property_from_xml(n->wrap_before, "wrap-before", xml); + if (xml.has_attribute("repeat-wrap-character")) set_property_from_xml(n->repeat_wrap_char, "repeat-wrap-character", xml); + if (xml.has_attribute("rotate-displacement")) set_property_from_xml(n->rotate_displacement, "rotate-displacement", xml); if (xml.has_attribute("orientation")) set_property_from_xml(n->orientation, "orientation", xml); if (xml.has_attribute("horizontal-alignment")) set_property_from_xml(n->halign, "horizontal-alignment", xml); if (xml.has_attribute("vertical-alignment")) set_property_from_xml(n->valign, "vertical-alignment", xml); diff --git a/src/text/text_properties.cpp b/src/text/text_properties.cpp index ef5b9af10..73210d109 100644 --- a/src/text/text_properties.cpp +++ b/src/text/text_properties.cpp @@ -103,9 +103,9 @@ void text_symbolizer_properties::text_properties_from_xml(xml_node const& node) set_property_from_xml(expressions.label_position_tolerance, "label-position-tolerance", node); set_property_from_xml(expressions.minimum_padding, "minimum-padding", node); set_property_from_xml(expressions.minimum_path_length, "minimum-path-length", node); - set_property_from_xml(expressions.avoid_edges, "avoid-edges", node); - set_property_from_xml(expressions.allow_overlap, "allow-overlap", node); - set_property_from_xml(expressions.largest_bbox_only, "largest-bbox-only", node); + set_property_from_xml(expressions.avoid_edges, "avoid-edges", node); + set_property_from_xml(expressions.allow_overlap, "allow-overlap", node); + set_property_from_xml(expressions.largest_bbox_only, "largest-bbox-only", node); set_property_from_xml(expressions.max_char_angle_delta, "max-char-angle-delta", node); set_property_from_xml(expressions.upright, "upright", node); } @@ -215,9 +215,9 @@ void text_layout_properties::from_xml(xml_node const &node, fontset_map const& f set_property_from_xml(text_ratio, "text-ratio", node); set_property_from_xml(wrap_width, "wrap-width", node); set_property_from_xml(wrap_char, "wrap-character", node); - set_property_from_xml(wrap_before, "wrap-before", node); - set_property_from_xml(repeat_wrap_char, "repeat-wrap-character", node); - set_property_from_xml(rotate_displacement, "rotate-displacement", node); + set_property_from_xml(wrap_before, "wrap-before", node); + set_property_from_xml(repeat_wrap_char, "repeat-wrap-character", node); + set_property_from_xml(rotate_displacement, "rotate-displacement", node); set_property_from_xml(orientation, "orientation", node); set_property_from_xml(valign, "vertical-alignment", node); set_property_from_xml(halign, "horizontal-alignment", node); diff --git a/src/xml_tree.cpp b/src/xml_tree.cpp index b14b8e4e0..2e2a7df8e 100644 --- a/src/xml_tree.cpp +++ b/src/xml_tree.cpp @@ -69,6 +69,7 @@ DEFINE_NAME_TRAIT( double, "double") DEFINE_NAME_TRAIT( float, "float") DEFINE_NAME_TRAIT( unsigned, "unsigned") DEFINE_NAME_TRAIT( int, "int") +DEFINE_NAME_TRAIT( bool, "bool") DEFINE_NAME_TRAIT( boolean_type, "boolean_type") #ifdef BIGINT DEFINE_NAME_TRAIT( mapnik::value_integer, "long long" ) @@ -411,6 +412,7 @@ std::string xml_node::line_to_string() const #define compile_get_value(T) template T xml_node::get_value() const compile_get_opt_attr(boolean_type); +compile_get_opt_attr(mapnik::value_bool); compile_get_opt_attr(std::string); compile_get_opt_attr(int); compile_get_opt_attr(unsigned); diff --git a/utils/pgsql2sqlite/pgsql2sqlite.hpp b/utils/pgsql2sqlite/pgsql2sqlite.hpp index e339a8f58..9de886732 100644 --- a/utils/pgsql2sqlite/pgsql2sqlite.hpp +++ b/utils/pgsql2sqlite/pgsql2sqlite.hpp @@ -352,23 +352,23 @@ void pgsql2sqlite(Connection conn, break; } case 23: - output_rec.push_back(sqlite::value_type(int4net(buf))); + output_rec.emplace_back(int4net(buf)); break; case 21: - output_rec.push_back(sqlite::value_type(int2net(buf))); + output_rec.emplace_back(int(int2net(buf))); break; case 700: { float val; float4net(val,buf); - output_rec.push_back(sqlite::value_type(val)); + output_rec.emplace_back(double(val)); break; } case 701: { double val; float8net(val,buf); - output_rec.push_back(sqlite::value_type(val)); + output_rec.emplace_back(val); break; } case 1700: @@ -377,7 +377,7 @@ void pgsql2sqlite(Connection conn, double val; if (mapnik::util::string2double(str,val)) { - output_rec.push_back(sqlite::value_type(val)); + output_rec.emplace_back(val); } break; } From f734368a737d900884ef065124db12567ad150d1 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 25 Jul 2016 14:47:25 +0200 Subject: [PATCH 16/21] limit mpl list size as well as vector size --- include/mapnik/config.hpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/include/mapnik/config.hpp b/include/mapnik/config.hpp index 5b4c82be1..a05caf9d4 100644 --- a/include/mapnik/config.hpp +++ b/include/mapnik/config.hpp @@ -52,10 +52,18 @@ #define PROJ_ENVELOPE_POINTS 20 -#ifndef BOOST_MPL_LIMIT_VECTOR_SIZE #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS -#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 + +#ifndef BOOST_MPL_LIMIT_VECTOR_SIZE + #define BOOST_MPL_LIMIT_VECTOR_SIZE 30 #else -#warning "WARNING: BOOST_MPL_LIMIT_VECTOR_SIZE is already defined. Ensure config.hpp is included before any Boost headers" + #warning "WARNING: BOOST_MPL_LIMIT_VECTOR_SIZE is already defined. Ensure config.hpp is included before any Boost headers" #endif + +#ifndef BOOST_MPL_LIMIT_LIST_SIZE + #define BOOST_MPL_LIMIT_LIST_SIZE 30 +#else + #warning "WARNING: BOOST_MPL_LIMIT_LIST_SIZE is already defined. Ensure config.hpp is included before any Boost headers" +#endif + #endif // MAPNIK_CONFIG_HPP From 7fc9dfe06b7edb4813c679b3e696f721bcf8367e Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 25 Jul 2016 14:49:52 +0200 Subject: [PATCH 17/21] simplify visitor code in image_compositing --- src/image_compositing.cpp | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/image_compositing.cpp b/src/image_compositing.cpp index a8f9bba3c..d6c8a3333 100644 --- a/src/image_compositing.cpp +++ b/src/image_compositing.cpp @@ -191,7 +191,20 @@ struct composite_visitor dy_(dy) {} template - void operator() (T & dst) const; + void operator() (T & dst) const + { + throw std::runtime_error("Error: Composite with " + std::string(typeid(dst).name()) + " is not supported"); + } + + void operator()(image_rgba8 & dst) const + { + composite(dst, util::get(src_), mode_, opacity_, dx_, dy_); + } + + void operator() (image_gray32f & dst) const + { + composite(dst, util::get(src_), mode_, opacity_, dx_, dy_); + } private: image_any const& src_; @@ -199,26 +212,9 @@ struct composite_visitor float opacity_; int dx_; int dy_; + }; -template -void composite_visitor::operator() (T & dst) const -{ - throw std::runtime_error("Error: Composite with " + std::string(typeid(dst).name()) + " is not supported"); -} - -template <> -void composite_visitor::operator() (image_rgba8 & dst) const -{ - composite(dst, util::get(src_), mode_, opacity_, dx_, dy_); -} - -template <> -void composite_visitor::operator() (image_gray32f & dst) const -{ - composite(dst, util::get(src_), mode_, opacity_, dx_, dy_); -} - } // end ns template <> From bd920daa168890cde4d981544c799d7a9d5b584a Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 25 Jul 2016 14:51:06 +0200 Subject: [PATCH 18/21] fix decltype forwarding --- include/mapnik/util/variant.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/mapnik/util/variant.hpp b/include/mapnik/util/variant.hpp index 3fb00b388..87cfb70ff 100644 --- a/include/mapnik/util/variant.hpp +++ b/include/mapnik/util/variant.hpp @@ -51,13 +51,13 @@ public: // unary visitor interface // const template -auto VARIANT_INLINE static apply_visitor(F && f, V const& v) -> decltype(V::visit(v, f)) +auto VARIANT_INLINE static apply_visitor(F && f, V const& v) -> decltype(V::visit(v, std::forward(f))) { return V::visit(v, std::forward(f)); } // non-const template -auto VARIANT_INLINE static apply_visitor(F && f, V & v) -> decltype(V::visit(v, f)) +auto VARIANT_INLINE static apply_visitor(F && f, V & v) -> decltype(V::visit(v, std::forward(f))) { return V::visit(v, std::forward(f)); } @@ -65,14 +65,14 @@ auto VARIANT_INLINE static apply_visitor(F && f, V & v) -> decltype(V::visit(v, // binary visitor interface // const template -auto VARIANT_INLINE static apply_visitor(F && f, V const& v0, V const& v1) -> decltype(V::binary_visit(v0, v1, f)) +auto VARIANT_INLINE static apply_visitor(F && f, V const& v0, V const& v1) -> decltype(V::binary_visit(v0, v1, std::forward(f))) { return V::binary_visit(v0, v1, std::forward(f)); } // non-const template -auto VARIANT_INLINE static apply_visitor(F && f, V & v0, V & v1) -> decltype(V::binary_visit(v0, v1, f)) +auto VARIANT_INLINE static apply_visitor(F && f, V & v0, V & v1) -> decltype(V::binary_visit(v0, v1, std::forward(f))) { return V::binary_visit(v0, v1, std::forward(f)); } From bf99177da78a45cae2370ad7ec6cd8e58b379b99 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 25 Jul 2016 15:55:20 +0200 Subject: [PATCH 19/21] inherit ctor's from geometry_base --- include/mapnik/geometry.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/mapnik/geometry.hpp b/include/mapnik/geometry.hpp index f97e9e6c6..c298fa61d 100644 --- a/include/mapnik/geometry.hpp +++ b/include/mapnik/geometry.hpp @@ -148,11 +148,7 @@ struct geometry : geometry_base geometry() : geometry_base() {} // empty - - template - geometry(G && geom) - : geometry_base(std::forward(geom)) {} - + using geometry_base::geometry_base; }; template From d3293f73e1c919f66da8ebb98835b120166ce4e6 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 25 Jul 2016 15:55:50 +0200 Subject: [PATCH 20/21] c++ format --- src/datasource_cache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 043b01093..3759a6ceb 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -117,7 +117,7 @@ datasource_ptr datasource_cache::create(parameters const& params) #endif create_ds create_datasource = reinterpret_cast(itr->second->get_symbol("create")); - if (! create_datasource) + if (!create_datasource) { throw std::runtime_error(std::string("Cannot load symbols: ") + itr->second->get_error()); From 9a0d7b0d6844f037dd4a0ad3d10587c60d72110e Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 26 Jul 2016 10:38:28 +0200 Subject: [PATCH 21/21] update variant --- deps/mapbox/variant | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/mapbox/variant b/deps/mapbox/variant index c511b2f34..388376ac9 160000 --- a/deps/mapbox/variant +++ b/deps/mapbox/variant @@ -1 +1 @@ -Subproject commit c511b2f34d966c09e02a1b833db33a9a1f9b2196 +Subproject commit 388376ac9f0102feba2d2122873b08e15a66a879