Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9db9e7d161
3 changed files with 43 additions and 27 deletions
|
@ -30,10 +30,12 @@
|
||||||
|
|
||||||
namespace mapnik { namespace json {
|
namespace mapnik { namespace json {
|
||||||
|
|
||||||
|
#if BOOST_VERSION >= 104700
|
||||||
|
|
||||||
template <typename OutputIterator> struct feature_generator_grammar;
|
template <typename OutputIterator> struct feature_generator_grammar;
|
||||||
template <typename OutputIterator> struct multi_geometry_generator_grammar;
|
template <typename OutputIterator> struct multi_geometry_generator_grammar;
|
||||||
|
|
||||||
class feature_generator : private boost::noncopyable
|
class feature_generator : private boost::noncopyable
|
||||||
{
|
{
|
||||||
typedef std::back_insert_iterator<std::string> sink_type;
|
typedef std::back_insert_iterator<std::string> sink_type;
|
||||||
public:
|
public:
|
||||||
|
@ -55,6 +57,26 @@ private:
|
||||||
boost::scoped_ptr<multi_geometry_generator_grammar<sink_type> > grammar_;
|
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
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,10 @@
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/json/geojson_generator.hpp>
|
||||||
|
|
||||||
#if BOOST_VERSION >= 104700
|
#if BOOST_VERSION >= 104700
|
||||||
|
|
||||||
#include <mapnik/json/geojson_generator.hpp>
|
|
||||||
#include <mapnik/json/feature_generator_grammar.hpp>
|
#include <mapnik/json/feature_generator_grammar.hpp>
|
||||||
#include <mapnik/json/geometry_generator_grammar.hpp>
|
#include <mapnik/json/geometry_generator_grammar.hpp>
|
||||||
#include <boost/spirit/include/karma.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 {
|
namespace mapnik { namespace json {
|
||||||
|
|
||||||
class feature_generator {
|
bool feature_generator::generate(std::string & geojson, mapnik::Feature const& f)
|
||||||
public:
|
{
|
||||||
bool generate(std::string & geojson, mapnik::Feature const& f)
|
std::ostringstream s;
|
||||||
{
|
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||||
std::ostringstream s;
|
throw std::runtime_error("feature_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str());
|
||||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
return false;
|
||||||
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 {
|
bool geometry_generator::generate(std::string & geojson, mapnik::geometry_container const& g)
|
||||||
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;
|
||||||
std::ostringstream s;
|
throw std::runtime_error("geometry_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str());
|
||||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
return false;
|
||||||
throw std::runtime_error("geometry_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str());
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
int t2 = (int)y.a + y.r + y.g + y.b;
|
||||||
if (t1 != t2) return t1 < t2;
|
if (t1 != t2) return t1 < t2;
|
||||||
|
|
||||||
return (((int)x.a - y.a) >> 24) +
|
// https://github.com/mapnik/mapnik/issues/1087
|
||||||
(((int)x.r - y.r) >> 16) +
|
if (x.a != y.a) return x.a < y.a;
|
||||||
(((int)x.g - y.g) >> 8) +
|
if (x.r != y.r) return x.r < y.r;
|
||||||
(((int)x.b - y.b));
|
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
|
std::size_t rgba::hash_func::operator()(rgba const& p) const
|
||||||
|
|
Loading…
Add table
Reference in a new issue