diff --git a/.travis.yml b/.travis.yml index 967786acd..5de9299f0 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 diff --git a/deps/mapbox/variant b/deps/mapbox/variant index b5728ad76..388376ac9 160000 --- a/deps/mapbox/variant +++ b/deps/mapbox/variant @@ -1 +1 @@ -Subproject commit b5728ad76e1402c130a9330aa44b6f4b655b13b4 +Subproject commit 388376ac9f0102feba2d2122873b08e15a66a879 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 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 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 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 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] 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/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/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/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/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)); } 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/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..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_; @@ -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/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()); 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 <> 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/map.cpp b/src/map.cpp index 9feb21688..e943ceeef 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 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; 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 4e3f1d10d..db37f7e26 100644 --- a/src/text/text_properties.cpp +++ b/src/text/text_properties.cpp @@ -105,9 +105,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); } @@ -217,9 +217,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/value.cpp b/src/value.cpp index a3c8770cc..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(); + return std::string(""); } }; @@ -708,7 +708,7 @@ struct to_unicode_impl value_unicode_string operator()(value_null const&) const { - return value_unicode_string(); + return value_unicode_string(""); } }; diff --git a/src/xml_tree.cpp b/src/xml_tree.cpp index 2cc2c6adc..cd6cdaca3 100644 --- a/src/xml_tree.cpp +++ b/src/xml_tree.cpp @@ -70,6 +70,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" ) @@ -412,6 +413,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; }