diff --git a/include/mapnik/json/geojson_generator.hpp b/include/mapnik/json/geojson_generator.hpp index 1f9e3e30f..390c50c10 100644 --- a/include/mapnik/json/geojson_generator.hpp +++ b/include/mapnik/json/geojson_generator.hpp @@ -30,10 +30,12 @@ namespace mapnik { namespace json { +#if BOOST_VERSION >= 104700 + template struct feature_generator_grammar; template struct multi_geometry_generator_grammar; -class feature_generator : private boost::noncopyable +class feature_generator : private boost::noncopyable { typedef std::back_insert_iterator sink_type; public: @@ -55,6 +57,26 @@ private: boost::scoped_ptr > grammar_; }; +#else + +class feature_generator : private boost::noncopyable +{ +public: + feature_generator() {} + ~feature_generator() {} + bool generate(std::string & geojson, mapnik::Feature const& f); +}; + +class geometry_generator : private boost::noncopyable +{ +public: + geometry_generator() {} + ~geometry_generator() {} + bool generate(std::string & geojson, mapnik::geometry_container const& g); +}; + +#endif + }} diff --git a/src/json/geojson_generator.cpp b/src/json/geojson_generator.cpp index 461f5b90f..c25440ded 100644 --- a/src/json/geojson_generator.cpp +++ b/src/json/geojson_generator.cpp @@ -22,11 +22,10 @@ // boost #include -#include +#include #if BOOST_VERSION >= 104700 -#include #include #include #include @@ -66,27 +65,21 @@ bool geometry_generator::generate(std::string & geojson, mapnik::geometry_contai namespace mapnik { namespace json { -class feature_generator { - public: - bool generate(std::string & geojson, mapnik::Feature const& f) - { - std::ostringstream s; - s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100; - throw std::runtime_error("feature_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str()); - return false; - } -}; +bool feature_generator::generate(std::string & geojson, mapnik::Feature const& f) +{ + std::ostringstream s; + s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100; + throw std::runtime_error("feature_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str()); + return false; +} -class geometry_generator { - public: - bool generate(std::string & geojson, mapnik::geometry_container const& g) - { - std::ostringstream s; - s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100; - throw std::runtime_error("geometry_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str()); - return false; - } -}; +bool geometry_generator::generate(std::string & geojson, mapnik::geometry_container const& g) +{ + std::ostringstream s; + s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100; + throw std::runtime_error("geometry_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str()); + return false; +} }} diff --git a/src/palette.cpp b/src/palette.cpp index f03ecec2e..29d4120d4 100644 --- a/src/palette.cpp +++ b/src/palette.cpp @@ -35,10 +35,11 @@ bool rgba::mean_sort_cmp::operator() (const rgba& x, const rgba& y) const int t2 = (int)y.a + y.r + y.g + y.b; if (t1 != t2) return t1 < t2; - return (((int)x.a - y.a) >> 24) + - (((int)x.r - y.r) >> 16) + - (((int)x.g - y.g) >> 8) + - (((int)x.b - y.b)); + // https://github.com/mapnik/mapnik/issues/1087 + if (x.a != y.a) return x.a < y.a; + if (x.r != y.r) return x.r < y.r; + if (x.g != y.g) return x.g < y.g; + return x.b < y.b; } std::size_t rgba::hash_func::operator()(rgba const& p) const