Merge remote-tracking branch 'origin/master'

This commit is contained in:
Artem Pavlenko 2012-02-23 10:23:31 +00:00
commit 9db9e7d161
3 changed files with 43 additions and 27 deletions

View file

@ -30,6 +30,8 @@
namespace mapnik { namespace json {
#if BOOST_VERSION >= 104700
template <typename OutputIterator> struct feature_generator_grammar;
template <typename OutputIterator> struct multi_geometry_generator_grammar;
@ -55,6 +57,26 @@ private:
boost::scoped_ptr<multi_geometry_generator_grammar<sink_type> > 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
}}

View file

@ -22,11 +22,10 @@
// boost
#include <boost/version.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/json/geojson_generator.hpp>
#if BOOST_VERSION >= 104700
#include <mapnik/json/geojson_generator.hpp>
#include <mapnik/json/feature_generator_grammar.hpp>
#include <mapnik/json/geometry_generator_grammar.hpp>
#include <boost/spirit/include/karma.hpp>
@ -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)
{
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)
{
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;
}
};
}
}}

View file

@ -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