Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 533526 | Differences between
and this patch

Collapse All | Expand All

(-)a/include/mapnik/marker.hpp (-3 / +2 lines)
Lines 124-135 class marker: private mapnik::noncopyable Link Here
124
124
125
    inline bool is_bitmap() const
125
    inline bool is_bitmap() const
126
    {
126
    {
127
        return bitmap_data_;
127
        return bitmap_data_ ? true : false;
128
    }
128
    }
129
129
130
    inline bool is_vector() const
130
    inline bool is_vector() const
131
    {
131
    {
132
        return vector_data_;
132
        return vector_data_ ? true : false;
133
    }
133
    }
134
134
135
    boost::optional<mapnik::image_ptr> get_bitmap_data() const
135
    boost::optional<mapnik::image_ptr> get_bitmap_data() const
136
--
137
SConstruct | 9 +++++++++
136
SConstruct | 9 +++++++++
138
1 file changed, 9 insertions(+)
137
1 file changed, 9 insertions(+)
(-)a/SConstruct (-1 / +9 lines)
Lines 1623-1628 if not preconfigured: Link Here
1623
        debug_defines = ['-DDEBUG', '-DMAPNIK_DEBUG']
1623
        debug_defines = ['-DDEBUG', '-DMAPNIK_DEBUG']
1624
        ndebug_defines = ['-DNDEBUG']
1624
        ndebug_defines = ['-DNDEBUG']
1625
1625
1626
        boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1])
1627
        if boost_version_from_header > 53 or 'c++11' in env['CUSTOM_CXXFLAGS']:
1628
            env.Append(CPPDEFINES = '-DBOOST_SPIRIT_USE_PHOENIX_V3=1')
1629
            #  - workaround boost gil channel_algorithm.hpp narrowing error
1630
            # TODO - remove when building against >= 1.55
1631
            # https://github.com/mapnik/mapnik/issues/1970
1632
            if 'clang++' in env['CXX']:
1633
                env.Append(CXXFLAGS = '-Wno-c++11-narrowing')
1634
1626
        # Enable logging in debug mode (always) and release mode (when specified)
1635
        # Enable logging in debug mode (always) and release mode (when specified)
1627
        if env['DEFAULT_LOG_SEVERITY']:
1636
        if env['DEFAULT_LOG_SEVERITY']:
1628
            if env['DEFAULT_LOG_SEVERITY'] not in severities:
1637
            if env['DEFAULT_LOG_SEVERITY'] not in severities:
1629
--
1630
src/save_map.cpp | 9 +++++++++
1638
src/save_map.cpp | 9 +++++++++
1631
1 file changed, 9 insertions(+)
1639
1 file changed, 9 insertions(+)
(-)a/src/save_map.cpp (-1 / +9 lines)
Lines 42-47 Link Here
42
// boost
42
// boost
43
#include <boost/algorithm/string.hpp>
43
#include <boost/algorithm/string.hpp>
44
#include <boost/optional.hpp>
44
#include <boost/optional.hpp>
45
#include <boost/version.hpp>
45
#include <boost/property_tree/ptree.hpp>
46
#include <boost/property_tree/ptree.hpp>
46
#include <boost/property_tree/xml_parser.hpp>
47
#include <boost/property_tree/xml_parser.hpp>
47
48
Lines 869-875 void save_map(Map const & map, std::string const& filename, bool explicit_defaul Link Here
869
{
870
{
870
    ptree pt;
871
    ptree pt;
871
    serialize_map(pt,map,explicit_defaults);
872
    serialize_map(pt,map,explicit_defaults);
873
#if BOOST_VERSION >= 105600
874
    write_xml(filename,pt,std::locale(),boost::property_tree::xml_writer_make_settings<ptree::key_type>(' ',4));
875
#else
872
    write_xml(filename,pt,std::locale(),boost::property_tree::xml_writer_make_settings(' ',4));
876
    write_xml(filename,pt,std::locale(),boost::property_tree::xml_writer_make_settings(' ',4));
877
#endif
873
}
878
}
874
879
875
std::string save_map_to_string(Map const & map, bool explicit_defaults)
880
std::string save_map_to_string(Map const & map, bool explicit_defaults)
Lines 877-883 std::string save_map_to_string(Map const & map, bool explicit_defaults) Link Here
877
    ptree pt;
882
    ptree pt;
878
    serialize_map(pt,map,explicit_defaults);
883
    serialize_map(pt,map,explicit_defaults);
879
    std::ostringstream ss;
884
    std::ostringstream ss;
885
#if BOOST_VERSION >= 105600
886
    write_xml(ss,pt,boost::property_tree::xml_writer_make_settings<ptree::key_type>(' ',4));
887
#else
880
    write_xml(ss,pt,boost::property_tree::xml_writer_make_settings(' ',4));
888
    write_xml(ss,pt,boost::property_tree::xml_writer_make_settings(' ',4));
889
#endif
881
    return ss.str();
890
    return ss.str();
882
}
891
}
883
892
884
--
885
SConstruct                                         |   2 +-
893
SConstruct                                         |   2 +-
886
include/mapnik/css_color_grammar.hpp               |   8 ++
894
include/mapnik/css_color_grammar.hpp               |   8 ++
887
include/mapnik/expression_grammar.hpp              |  10 +-
895
include/mapnik/expression_grammar.hpp              |  10 +-
888
include/mapnik/expression_grammar_impl.hpp         |   2 +-
896
include/mapnik/expression_grammar_impl.hpp         |   2 +-
889
include/mapnik/json/feature_grammar.hpp            |  25 ++++
897
include/mapnik/json/feature_grammar.hpp            |  25 ++++
890
include/mapnik/json/geometry_generator_grammar.hpp | 131 +++++++++++++++++----
898
include/mapnik/json/geometry_generator_grammar.hpp | 131 +++++++++++++++++----
891
include/mapnik/json/geometry_grammar.hpp           |  62 +++++++++-
899
include/mapnik/json/geometry_grammar.hpp           |  62 +++++++++-
892
include/mapnik/svg/svg_path_commands.hpp           |  37 ++++++
900
include/mapnik/svg/svg_path_commands.hpp           |  37 ++++++
893
include/mapnik/svg/svg_transform_grammar.hpp       |  20 ++++
901
include/mapnik/svg/svg_transform_grammar.hpp       |  20 ++++
894
include/mapnik/util/geometry_svg_generator.hpp     |  51 ++++++--
902
include/mapnik/util/geometry_svg_generator.hpp     |  51 ++++++--
895
include/mapnik/util/geometry_wkt_generator.hpp     |   4 +-
903
include/mapnik/util/geometry_wkt_generator.hpp     |   4 +-
896
include/mapnik/wkt/wkt_grammar.hpp                 |   5 +-
904
include/mapnik/wkt/wkt_grammar.hpp                 |   5 +-
897
src/json/feature_collection_parser.cpp             |   2 +
905
src/json/feature_collection_parser.cpp             |   2 +
898
13 files changed, 312 insertions(+), 47 deletions(-)
906
13 files changed, 312 insertions(+), 47 deletions(-)
(-)a/SConstruct (-1 / +1 lines)
Lines 1431-1437 if not preconfigured: Link Here
1431
                env["CAIRO_ALL_LIBS"] = ['cairo']
1431
                env["CAIRO_ALL_LIBS"] = ['cairo']
1432
                if env['RUNTIME_LINK'] == 'static':
1432
                if env['RUNTIME_LINK'] == 'static':
1433
                    env["CAIRO_ALL_LIBS"].extend(
1433
                    env["CAIRO_ALL_LIBS"].extend(
1434
                        ['pixman-1','expat','fontconfig','iconv']
1434
                        ['pixman-1','expat','iconv']
1435
                    )
1435
                    )
1436
                # todo - run actual checkLib?
1436
                # todo - run actual checkLib?
1437
                env['HAS_CAIRO'] = True
1437
                env['HAS_CAIRO'] = True
(-)a/include/mapnik/css_color_grammar.hpp (+8 lines)
Lines 125-131 struct alpha_conv_impl Link Here
125
125
126
struct hsl_conv_impl
126
struct hsl_conv_impl
127
{
127
{
128
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
129
    template<typename T>
130
#else
128
    template<typename T0,typename T1, typename T2, typename T3>
131
    template<typename T0,typename T1, typename T2, typename T3>
132
#endif
129
    struct result
133
    struct result
130
    {
134
    {
131
        typedef void type;
135
        typedef void type;
Lines 413-419 struct alpha_conv_impl Link Here
413
417
414
struct hsl_conv_impl
418
struct hsl_conv_impl
415
{
419
{
420
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
421
    template<typename T>
422
#else
416
    template<typename T0,typename T1, typename T2, typename T3>
423
    template<typename T0,typename T1, typename T2, typename T3>
424
#endif
417
    struct result
425
    struct result
418
    {
426
    {
419
        typedef void type;
427
        typedef void type;
(-)a/include/mapnik/expression_grammar.hpp (-1 / +9 lines)
Lines 65-71 struct unicode_impl Link Here
65
65
66
struct regex_match_impl
66
struct regex_match_impl
67
{
67
{
68
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
69
    template <typename T>
70
#else
68
    template <typename T0, typename T1>
71
    template <typename T0, typename T1>
72
#endif
69
    struct result
73
    struct result
70
    {
74
    {
71
        typedef expr_node type;
75
        typedef expr_node type;
Lines 82-88 struct regex_match_impl Link Here
82
86
83
struct regex_replace_impl
87
struct regex_replace_impl
84
{
88
{
85
    template <typename T0, typename T1, typename T2>
89
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
90
    template <typename T>
91
#else
92
    template <typename T0, typename T1>
93
#endif
86
    struct result
94
    struct result
87
    {
95
    {
88
        typedef expr_node type;
96
        typedef expr_node type;
(-)a/include/mapnik/expression_grammar_impl.hpp (-1 / +1 lines)
Lines 145-151 expression_grammar<Iterator>::expression_grammar(mapnik::transcoder const& tr) Link Here
145
    multiplicative_expr = unary_expr [_val = _1]
145
    multiplicative_expr = unary_expr [_val = _1]
146
        >> *(     '*' >> unary_expr [_val *= _1]
146
        >> *(     '*' >> unary_expr [_val *= _1]
147
                  | '/' >> unary_expr [_val /= _1]
147
                  | '/' >> unary_expr [_val /= _1]
148
                  | '%' >> unary_expr [_val %= _1]
148
                  | '%' >> unary_expr [_val %= construct<mapnik::expr_node>(_1)] //needed by clang++ with -std=c++11
149
                  |  regex_match_expr[_val = regex_match_(_val, _1)]
149
                  |  regex_match_expr[_val = regex_match_(_val, _1)]
150
                  |  regex_replace_expr(_val) [_val = _1]
150
                  |  regex_replace_expr(_val) [_val = _1]
151
            )
151
            )
(-)a/include/mapnik/json/feature_grammar.hpp (+25 lines)
Lines 66-71 class attribute_value_visitor Link Here
66
    mapnik::transcoder const& tr_;
66
    mapnik::transcoder const& tr_;
67
};
67
};
68
68
69
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
70
struct put_property
71
{
72
    typedef void result_type;
73
    explicit put_property(mapnik::transcoder const& tr)
74
        : tr_(tr) {}
75
    template <typename T0,typename T1, typename T2>
76
    result_type operator() (T0 & feature, T1 const& key, T2 const& val) const
77
    {
78
        feature.put_new(key, boost::apply_visitor(attribute_value_visitor(tr_),val));
79
    }
80
    mapnik::transcoder const& tr_;
81
};
82
83
struct extract_geometry
84
{
85
    typedef  boost::ptr_vector<mapnik::geometry_type>& result_type;
86
    template <typename T>
87
    result_type operator() (T & feature) const
88
    {
89
        return feature.paths();
90
    }
91
};
92
#else
69
struct put_property
93
struct put_property
70
{
94
{
71
    template <typename T0,typename T1, typename T2>
95
    template <typename T0,typename T1, typename T2>
Lines 100-105 struct extract_geometry Link Here
100
        return feature.paths();
124
        return feature.paths();
101
    }
125
    }
102
};
126
};
127
#endif
103
128
104
template <typename Iterator, typename FeatureType>
129
template <typename Iterator, typename FeatureType>
105
struct feature_grammar :
130
struct feature_grammar :
(-)a/include/mapnik/json/geometry_generator_grammar.hpp (-24 / +107 lines)
Lines 38-48 Link Here
38
#include <boost/spirit/include/phoenix_fusion.hpp>
38
#include <boost/spirit/include/phoenix_fusion.hpp>
39
#include <boost/spirit/include/phoenix_function.hpp>
39
#include <boost/spirit/include/phoenix_function.hpp>
40
#include <boost/spirit/include/phoenix_statement.hpp>
40
#include <boost/spirit/include/phoenix_statement.hpp>
41
#include <boost/fusion/include/boost_tuple.hpp>
41
#include <boost/fusion/adapted/boost_tuple.hpp>
42
#include <boost/math/special_functions/trunc.hpp> // trunc to avoid needing C++11
42
#include <boost/math/special_functions/trunc.hpp> // for vc++ and android whose c++11 libs lack std::trunct
43
44
45
//#define BOOST_SPIRIT_USE_PHOENIX_V3 1
46
43
47
namespace boost { namespace spirit { namespace traits {
44
namespace boost { namespace spirit { namespace traits {
48
45
Lines 61-66 namespace phoenix = boost::phoenix; Link Here
61
58
62
namespace {
59
namespace {
63
60
61
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
62
struct get_type
63
{
64
    typedef int result_type;
65
    result_type operator() (geometry_type const& geom) const
66
    {
67
        return static_cast<int>(geom.type());
68
    }
69
};
70
71
struct get_first
72
{
73
    typedef geometry_type::value_type const result_type;
74
    result_type operator() (geometry_type const& geom) const
75
    {
76
        geometry_type::value_type coord;
77
        boost::get<0>(coord) = geom.vertex(0,&boost::get<1>(coord),&boost::get<2>(coord));
78
        return coord;
79
    }
80
};
81
82
struct multi_geometry_type
83
{
84
    typedef boost::tuple<unsigned,bool>  result_type;
85
    result_type operator() (geometry_container const& geom) const
86
    {
87
        unsigned type = 0u;
88
        bool collection = false;
89
90
        geometry_container::const_iterator itr = geom.begin();
91
        geometry_container::const_iterator end = geom.end();
92
93
        for ( ; itr != end; ++itr)
94
        {
95
            if (type != 0u && itr->type() != type)
96
            {
97
                collection = true;
98
                break;
99
            }
100
            type = itr->type();
101
        }
102
        if (geom.size() > 1) type +=3;
103
        return boost::tuple<unsigned,bool>(type, collection);
104
    }
105
};
106
107
struct not_empty
108
{
109
    typedef bool result_type;
110
    result_type operator() (geometry_container const& cont) const
111
    {
112
        geometry_container::const_iterator itr = cont.begin();
113
        geometry_container::const_iterator end = cont.end();
114
        for ( ; itr != end; ++itr)
115
        {
116
            if (itr->size() > 0) return true;
117
        }
118
        return false;
119
    }
120
};
121
122
#else
64
struct get_type
123
struct get_type
65
{
124
{
66
    template <typename T>
125
    template <typename T>
Lines 100-106 struct multi_geometry_type Link Here
100
159
101
        for ( ; itr != end; ++itr)
160
        for ( ; itr != end; ++itr)
102
        {
161
        {
103
            if (type != 0u && itr->type() != type)
162
            if (type != 0u && static_cast<unsigned>(itr->type()) != type)
104
            {
163
            {
105
                collection = true;
164
                collection = true;
106
                break;
165
                break;
Lines 113-118 struct multi_geometry_type Link Here
113
};
172
};
114
173
115
174
175
struct not_empty
176
{
177
    template <typename T>
178
    struct result { typedef bool type; };
179
180
    bool operator() (geometry_container const& cont) const
181
    {
182
        geometry_container::const_iterator itr = cont.begin();
183
        geometry_container::const_iterator end = cont.end();
184
185
        for (; itr!=end; ++itr)
186
        {
187
            if (itr->size() > 0) return true;
188
        }
189
        return false;
190
    }
191
};
192
193
194
#endif
195
196
116
template <typename T>
197
template <typename T>
117
struct json_coordinate_policy : karma::real_policies<T>
198
struct json_coordinate_policy : karma::real_policies<T>
118
{
199
{
Lines 123-129 struct json_coordinate_policy : karma::real_policies<T> Link Here
123
    {
204
    {
124
        if (n == 0.0) return 0;
205
        if (n == 0.0) return 0;
125
        using namespace boost::spirit;
206
        using namespace boost::spirit;
126
        return static_cast<unsigned>(15 - boost::math::trunc(log10(traits::get_absolute_value(n))));
207
        return static_cast<unsigned>(14 - boost::math::trunc(log10(traits::get_absolute_value(n))));
127
    }
208
    }
128
209
129
    template <typename OutputIterator>
210
    template <typename OutputIterator>
Lines 135-141 struct json_coordinate_policy : karma::real_policies<T> Link Here
135
216
136
    template <typename OutputIterator>
217
    template <typename OutputIterator>
137
    static bool fraction_part(OutputIterator& sink, T n
218
    static bool fraction_part(OutputIterator& sink, T n
138
                       , unsigned adjprec, unsigned precision)
219
                              , unsigned adjprec, unsigned precision)
139
    {
220
    {
140
        if (n == 0) return true;
221
        if (n == 0) return true;
141
        return base_type::fraction_part(sink, n, adjprec, precision);
222
        return base_type::fraction_part(sink, n, adjprec, precision);
Lines 153-158 struct geometry_generator_grammar : Link Here
153
        : geometry_generator_grammar::base_type(coordinates)
234
        : geometry_generator_grammar::base_type(coordinates)
154
    {
235
    {
155
        using boost::spirit::karma::uint_;
236
        using boost::spirit::karma::uint_;
237
        using boost::spirit::bool_;
156
        using boost::spirit::karma::_val;
238
        using boost::spirit::karma::_val;
157
        using boost::spirit::karma::_1;
239
        using boost::spirit::karma::_1;
158
        using boost::spirit::karma::lit;
240
        using boost::spirit::karma::lit;
Lines 182-196 struct geometry_generator_grammar : Link Here
182
        point_coord = &uint_
264
        point_coord = &uint_
183
            << lit('[')
265
            << lit('[')
184
            << coord_type << lit(',') << coord_type
266
            << coord_type << lit(',') << coord_type
185
            << lit("]")
267
            << lit(']')
186
            ;
268
            ;
187
269
188
        polygon_coord %= ( &uint_(mapnik::SEG_MOVETO) << eps[_r1 += 1]
270
        polygon_coord %= ( &uint_(mapnik::SEG_MOVETO) << eps[_r1 += 1]
189
                           << karma::string[ if_ (_r1 > 1) [_1 = "],["]
271
                           << karma::string[ if_ (_r1 > 1u) [_1 = "],["]
190
                                      .else_[_1 = '[' ]] | &uint_ << lit(','))
272
                                             .else_[_1 = '[' ]]
191
            << lit('[') << coord_type
273
                           |
192
            << lit(',')
274
                           &uint_(mapnik::SEG_LINETO)
193
            << coord_type << lit(']')
275
                           << lit(',')) << lit('[') << coord_type << lit(',') << coord_type << lit(']')
194
            ;
276
            ;
195
277
196
        coords2 %= *polygon_coord(_a)
278
        coords2 %= *polygon_coord(_a)
Lines 205-211 struct geometry_generator_grammar : Link Here
205
    karma::rule<OutputIterator, geometry_type const& ()> point;
287
    karma::rule<OutputIterator, geometry_type const& ()> point;
206
    karma::rule<OutputIterator, geometry_type const& ()> linestring;
288
    karma::rule<OutputIterator, geometry_type const& ()> linestring;
207
    karma::rule<OutputIterator, geometry_type const& ()> polygon;
289
    karma::rule<OutputIterator, geometry_type const& ()> polygon;
208
209
    karma::rule<OutputIterator, geometry_type const& ()> coords;
290
    karma::rule<OutputIterator, geometry_type const& ()> coords;
210
    karma::rule<OutputIterator, karma::locals<unsigned>, geometry_type const& ()> coords2;
291
    karma::rule<OutputIterator, karma::locals<unsigned>, geometry_type const& ()> coords2;
211
    karma::rule<OutputIterator, geometry_type::value_type ()> point_coord;
292
    karma::rule<OutputIterator, geometry_type::value_type ()> point_coord;
Lines 235-240 struct multi_geometry_generator_grammar : Link Here
235
        using boost::spirit::karma::_1;
316
        using boost::spirit::karma::_1;
236
        using boost::spirit::karma::_a;
317
        using boost::spirit::karma::_a;
237
        using boost::spirit::karma::_r1;
318
        using boost::spirit::karma::_r1;
319
        using boost::spirit::bool_;
238
320
239
        geometry_types.add
321
        geometry_types.add
240
            (mapnik::Point,"\"Point\"")
322
            (mapnik::Point,"\"Point\"")
Lines 245-251 struct multi_geometry_generator_grammar : Link Here
245
            (mapnik::Polygon + 3,"\"MultiPolygon\"")
327
            (mapnik::Polygon + 3,"\"MultiPolygon\"")
246
            ;
328
            ;
247
329
248
        start %= ( eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)]
330
        start %= ( eps(phoenix::at_c<1>(_a))[_a = multi_type_(_val)]
249
                   << lit("{\"type\":\"GeometryCollection\",\"geometries\":[")
331
                   << lit("{\"type\":\"GeometryCollection\",\"geometries\":[")
250
                   << geometry_collection << lit("]}")
332
                   << geometry_collection << lit("]}")
251
                   |
333
                   |
Lines 255-267 struct multi_geometry_generator_grammar : Link Here
255
        geometry_collection = -(geometry2 % lit(','))
337
        geometry_collection = -(geometry2 % lit(','))
256
            ;
338
            ;
257
339
258
        geometry = (lit("{\"type\":")
340
        geometry = ( &bool_(true)[_1 = not_empty_(_val)] << lit("{\"type\":")
259
                    << geometry_types[_1 = phoenix::at_c<0>(_a)][_a = _multi_type(_val)]
341
                     << geometry_types[_1 = phoenix::at_c<0>(_a)][_a = multi_type_(_val)]
260
                    << lit(",\"coordinates\":")
342
                     << lit(",\"coordinates\":")
261
                    << karma::string[ if_ (phoenix::at_c<0>(_a) > 3) [_1 = '[']]
343
                     << karma::string[ phoenix::if_ (phoenix::at_c<0>(_a) > 3u) [_1 = '['].else_[_1 = ""]]
262
                    << coordinates
344
                     << coordinates
263
                    << karma::string[ if_ (phoenix::at_c<0>(_a) > 3) [_1 = ']']]
345
                     << karma::string[ phoenix::if_ (phoenix::at_c<0>(_a) > 3u) [_1 = ']'].else_[_1 = ""]]
264
                    << lit('}')) | lit("null")
346
                     << lit('}')) | lit("null")
265
            ;
347
            ;
266
348
267
        geometry2 = lit("{\"type\":")
349
        geometry2 = lit("{\"type\":")
Lines 287-294 struct multi_geometry_generator_grammar : Link Here
287
    karma::rule<OutputIterator, geometry_container const&()> coordinates;
369
    karma::rule<OutputIterator, geometry_container const&()> coordinates;
288
    geometry_generator_grammar<OutputIterator>  path;
370
    geometry_generator_grammar<OutputIterator>  path;
289
    // phoenix
371
    // phoenix
290
    phoenix::function<multi_geometry_type> _multi_type;
372
    phoenix::function<multi_geometry_type> multi_type_;
291
    phoenix::function<get_type > type_;
373
    phoenix::function<get_type > type_;
374
    phoenix::function<not_empty> not_empty_;
292
    // symbols table
375
    // symbols table
293
    karma::symbols<unsigned, char const*> geometry_types;
376
    karma::symbols<unsigned, char const*> geometry_types;
294
};
377
};
(-)a/include/mapnik/json/geometry_grammar.hpp (-3 / +59 lines)
Lines 37-42 namespace qi = boost::spirit::qi; Link Here
37
namespace standard_wide =  boost::spirit::standard_wide;
37
namespace standard_wide =  boost::spirit::standard_wide;
38
using standard_wide::space_type;
38
using standard_wide::space_type;
39
39
40
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
41
struct push_vertex
42
{
43
    typedef void result_type;
44
45
    template <typename T0,typename T1, typename T2, typename T3>
46
    result_type operator() (T0 c, T1 path, T2 x, T3 y) const
47
    {
48
        BOOST_ASSERT( path!=0 );
49
        path->push_vertex(x,y,c);
50
    }
51
};
52
53
struct close_path
54
{
55
    typedef void result_type;
56
57
    template <typename T>
58
    result_type operator() (T path) const
59
    {
60
        BOOST_ASSERT( path!=0 );
61
        if (path->size() > 2u) // to form a polygon ring we need at least 3 vertices
62
        {
63
            path->close_path();
64
        }
65
    }
66
};
67
68
struct cleanup
69
{
70
    typedef void result_type;
71
    template <typename T0>
72
    void operator() (T0 & path) const
73
    {
74
        if (path) delete path, path=0;
75
    }
76
};
77
78
struct where_message
79
{
80
    typedef std::string result_type;
81
82
    template <typename Iterator>
83
    std::string operator() (Iterator first, Iterator last, std::size_t size) const
84
    {
85
        std::string str(first, last);
86
        if (str.length() > size)
87
            return str.substr(0, size) + "..." ;
88
        return str;
89
    }
90
};
91
#else
40
struct push_vertex
92
struct push_vertex
41
{
93
{
42
    template <typename T0,typename T1, typename T2, typename T3>
94
    template <typename T0,typename T1, typename T2, typename T3>
Lines 65-72 struct close_path Link Here
65
    void operator() (T path) const
117
    void operator() (T path) const
66
    {
118
    {
67
        BOOST_ASSERT( path!=0 );
119
        BOOST_ASSERT( path!=0 );
68
        path->close_path();
120
        if (path->size() > 2u) // to form a polygon ring we need at least 3 vertices
69
    }
121
        {
122
            path->close_path();
123
        }
124
   }
70
};
125
};
71
126
72
struct cleanup
127
struct cleanup
Lines 101-112 struct where_message Link Here
101
        return str;
156
        return str;
102
    }
157
    }
103
};
158
};
159
#endif
104
160
105
161
106
template <typename Iterator>
162
template <typename Iterator>
107
struct geometry_grammar :
163
struct geometry_grammar :
108
        qi::grammar<Iterator,qi::locals<int>, void(boost::ptr_vector<mapnik::geometry_type>& )
164
        qi::grammar<Iterator,qi::locals<int>, void(boost::ptr_vector<mapnik::geometry_type>& )
109
                   , space_type>
165
        , space_type>
110
{
166
{
111
    geometry_grammar();
167
    geometry_grammar();
112
    qi::rule<Iterator, qi::locals<int>, void(boost::ptr_vector<mapnik::geometry_type>& ),space_type> geometry;
168
    qi::rule<Iterator, qi::locals<int>, void(boost::ptr_vector<mapnik::geometry_type>& ),space_type> geometry;
(-)a/include/mapnik/svg/svg_path_commands.hpp (+37 lines)
Lines 45-51 inline double deg2rad(double deg) Link Here
45
template <typename PathType>
45
template <typename PathType>
46
struct move_to
46
struct move_to
47
{
47
{
48
49
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
50
    template <typename T0>
51
#else
48
    template <typename T0, typename T1>
52
    template <typename T0, typename T1>
53
#endif
49
    struct result
54
    struct result
50
    {
55
    {
51
        typedef void type;
56
        typedef void type;
Lines 66-72 struct move_to Link Here
66
template <typename PathType>
71
template <typename PathType>
67
struct hline_to
72
struct hline_to
68
{
73
{
74
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
75
    template <typename T0>
76
#else
69
    template <typename T0, typename T1>
77
    template <typename T0, typename T1>
78
#endif
70
    struct result
79
    struct result
71
    {
80
    {
72
        typedef void type;
81
        typedef void type;
Lines 88-94 struct hline_to Link Here
88
template <typename PathType>
97
template <typename PathType>
89
struct vline_to
98
struct vline_to
90
{
99
{
100
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
101
    template <typename T0>
102
#else
91
    template <typename T0, typename T1>
103
    template <typename T0, typename T1>
104
#endif
92
    struct result
105
    struct result
93
    {
106
    {
94
        typedef void type;
107
        typedef void type;
Lines 109-115 struct vline_to Link Here
109
template <typename PathType>
122
template <typename PathType>
110
struct line_to
123
struct line_to
111
{
124
{
125
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
126
    template <typename T0>
127
#else
112
    template <typename T0, typename T1>
128
    template <typename T0, typename T1>
129
#endif
113
    struct result
130
    struct result
114
    {
131
    {
115
        typedef void type;
132
        typedef void type;
Lines 131-137 struct line_to Link Here
131
template <typename PathType>
148
template <typename PathType>
132
struct curve4
149
struct curve4
133
{
150
{
151
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
152
    template <typename T0>
153
#else
134
    template <typename T0, typename T1, typename T2, typename T3>
154
    template <typename T0, typename T1, typename T2, typename T3>
155
#endif
135
    struct result
156
    struct result
136
    {
157
    {
137
        typedef void type;
158
        typedef void type;
Lines 156-162 struct curve4 Link Here
156
template <typename PathType>
177
template <typename PathType>
157
struct curve4_smooth
178
struct curve4_smooth
158
{
179
{
180
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
181
    template <typename T0>
182
#else
159
    template <typename T0, typename T1, typename T2>
183
    template <typename T0, typename T1, typename T2>
184
#endif
160
    struct result
185
    struct result
161
    {
186
    {
162
        typedef void type;
187
        typedef void type;
Lines 178-184 struct curve4_smooth Link Here
178
template <typename PathType>
203
template <typename PathType>
179
struct curve3
204
struct curve3
180
{
205
{
206
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
207
    template <typename T0>
208
#else
181
    template <typename T0, typename T1, typename T2>
209
    template <typename T0, typename T1, typename T2>
210
#endif
182
    struct result
211
    struct result
183
    {
212
    {
184
        typedef void type;
213
        typedef void type;
Lines 201-207 struct curve3 Link Here
201
template <typename PathType>
230
template <typename PathType>
202
struct curve3_smooth
231
struct curve3_smooth
203
{
232
{
233
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
234
    template <typename T0>
235
#else
204
    template <typename T0, typename T1>
236
    template <typename T0, typename T1>
237
#endif
205
    struct result
238
    struct result
206
    {
239
    {
207
        typedef void type;
240
        typedef void type;
Lines 223-229 struct curve3_smooth Link Here
223
template <typename PathType>
256
template <typename PathType>
224
struct arc_to
257
struct arc_to
225
{
258
{
259
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
260
    template <typename T0>
261
#else
226
    template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
262
    template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
263
#endif
227
    struct result
264
    struct result
228
    {
265
    {
229
        typedef void type;
266
        typedef void type;
(-)a/include/mapnik/svg/svg_transform_grammar.hpp (+20 lines)
Lines 50-56 namespace mapnik { namespace svg { Link Here
50
    template <typename TransformType>
50
    template <typename TransformType>
51
    struct process_matrix
51
    struct process_matrix
52
    {
52
    {
53
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
54
        template <typename T0>
55
#else
53
        template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
56
        template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
57
#endif
54
        struct result
58
        struct result
55
        {
59
        {
56
            typedef void type;
60
            typedef void type;
Lines 70-76 namespace mapnik { namespace svg { Link Here
70
    template <typename TransformType>
74
    template <typename TransformType>
71
    struct process_rotate
75
    struct process_rotate
72
    {
76
    {
77
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
78
        template <typename T0>
79
#else
73
        template <typename T0, typename T1, typename T2>
80
        template <typename T0, typename T1, typename T2>
81
#endif
74
        struct result
82
        struct result
75
        {
83
        {
76
            typedef void type;
84
            typedef void type;
Lines 101-107 namespace mapnik { namespace svg { Link Here
101
    template <typename TransformType>
109
    template <typename TransformType>
102
    struct process_translate
110
    struct process_translate
103
    {
111
    {
112
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
113
        template <typename T0>
114
#else
104
        template <typename T0, typename T1>
115
        template <typename T0, typename T1>
116
#endif
105
        struct result
117
        struct result
106
        {
118
        {
107
            typedef void type;
119
            typedef void type;
Lines 123-129 namespace mapnik { namespace svg { Link Here
123
    template <typename TransformType>
135
    template <typename TransformType>
124
    struct process_scale
136
    struct process_scale
125
    {
137
    {
138
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
139
        template <typename T0>
140
#else
126
        template <typename T0, typename T1>
141
        template <typename T0, typename T1>
142
#endif
127
        struct result
143
        struct result
128
        {
144
        {
129
            typedef void type;
145
            typedef void type;
Lines 146-152 namespace mapnik { namespace svg { Link Here
146
    template <typename TransformType>
162
    template <typename TransformType>
147
    struct process_skew
163
    struct process_skew
148
    {
164
    {
165
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
166
        template <typename T0>
167
#else
149
        template <typename T0, typename T1>
168
        template <typename T0, typename T1>
169
#endif
150
        struct result
170
        struct result
151
        {
171
        {
152
            typedef void type;
172
            typedef void type;
(-)a/include/mapnik/util/geometry_svg_generator.hpp (-13 / +38 lines)
Lines 23-28 Link Here
23
#ifndef MAPNIK_GEOMETRY_SVG_GENERATOR_HPP
23
#ifndef MAPNIK_GEOMETRY_SVG_GENERATOR_HPP
24
#define MAPNIK_GEOMETRY_SVG_GENERATOR_HPP
24
#define MAPNIK_GEOMETRY_SVG_GENERATOR_HPP
25
25
26
26
// mapnik
27
// mapnik
27
#include <mapnik/global.hpp>
28
#include <mapnik/global.hpp>
28
#include <mapnik/geometry.hpp> // for container stuff
29
#include <mapnik/geometry.hpp> // for container stuff
Lines 41-53 Link Here
41
#include <boost/fusion/include/boost_tuple.hpp>
42
#include <boost/fusion/include/boost_tuple.hpp>
42
#include <boost/type_traits/remove_pointer.hpp>
43
#include <boost/type_traits/remove_pointer.hpp>
43
44
44
//#define BOOST_SPIRIT_USE_PHOENIX_V3 1
45
45
46
/*!
46
// adapted to conform to the concepts
47
 * adapted to conform to the concepts
47
// required by Karma to be recognized as a container of
48
 * required by Karma to be recognized as a container of
48
// attributes for output generation.
49
 * attributes for output generation.
49
50
 */
51
namespace boost { namespace spirit { namespace traits {
50
namespace boost { namespace spirit { namespace traits {
52
51
53
// TODO - this needs to be made generic to any path type
52
// TODO - this needs to be made generic to any path type
Lines 76-82 template <> Link Here
76
struct end_container<path_type const>
75
struct end_container<path_type const>
77
{
76
{
78
    static mapnik::util::path_iterator<path_type>
77
    static mapnik::util::path_iterator<path_type>
79
    call (path_type const& g)
78
    call (path_type const& /*g*/)
80
    {
79
    {
81
        return mapnik::util::path_iterator<path_type>();
80
        return mapnik::util::path_iterator<path_type>();
82
    }
81
    }
Lines 92-97 namespace mapnik { namespace util { Link Here
92
91
93
    namespace svg_detail {
92
    namespace svg_detail {
94
93
94
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
95
    template <typename Geometry>
96
    struct get_type
97
    {
98
        typedef int result_type;
99
        result_type operator() (Geometry const& geom) const
100
        {
101
            return static_cast<int>(geom.type());
102
        }
103
    };
104
105
    template <typename T>
106
    struct get_first
107
    {
108
        typedef T geometry_type;
109
        typedef typename geometry_type::value_type const result_type;
110
        result_type operator() (geometry_type const& geom) const
111
        {
112
            typename geometry_type::value_type coord;
113
            geom.rewind(0);
114
            boost::get<0>(coord) = geom.vertex(&boost::get<1>(coord),&boost::get<2>(coord));
115
            return coord;
116
        }
117
    };
118
#else
95
    template <typename Geometry>
119
    template <typename Geometry>
96
    struct get_type
120
    struct get_type
97
    {
121
    {
Lines 112-118 namespace mapnik { namespace util { Link Here
112
        template <typename U>
136
        template <typename U>
113
        struct result { typedef typename geometry_type::value_type const type; };
137
        struct result { typedef typename geometry_type::value_type const type; };
114
138
115
        typename geometry_type::value_type const operator() (geometry_type const& geom) const
139
        typename geometry_type::value_type operator() (geometry_type const& geom) const
116
        {
140
        {
117
            typename geometry_type::value_type coord;
141
            typename geometry_type::value_type coord;
118
            geom.rewind(0);
142
            geom.rewind(0);
Lines 121-132 namespace mapnik { namespace util { Link Here
121
        }
145
        }
122
    };
146
    };
123
147
148
#endif
124
    template <typename T>
149
    template <typename T>
125
    struct coordinate_policy : karma::real_policies<T>
150
    struct coordinate_policy : karma::real_policies<T>
126
    {
151
    {
127
        typedef boost::spirit::karma::real_policies<T> base_type;
152
        typedef boost::spirit::karma::real_policies<T> base_type;
128
        static int floatfield(T n) { return base_type::fmtflags::fixed; }
153
        static int floatfield(T n) { return base_type::fmtflags::fixed; }
129
        static unsigned precision(T n) { return 6u ;}
154
        static unsigned precision(T n) { return 4u ;}
130
    };
155
    };
131
    }
156
    }
132
157
Lines 161-175 namespace mapnik { namespace util { Link Here
161
                ;
186
                ;
162
187
163
            linestring = &uint_(mapnik::LineString)[_1 = _type(_val)]
188
            linestring = &uint_(mapnik::LineString)[_1 = _type(_val)]
164
                << svg_path << lit('\"')
189
                << lit("d=\"") << svg_path << lit("\"")
165
                ;
190
                ;
166
191
167
            polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)]
192
            polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)]
168
                << svg_path << lit('\"')
193
                << lit("d=\"") << svg_path << lit("\"")
169
                ;
194
                ;
170
195
171
            svg_path %= ((&uint_(mapnik::SEG_MOVETO) << lit("d=\"") << lit('M')
196
            svg_path %= ((&uint_(mapnik::SEG_MOVETO) << lit('M')
172
                          | &uint_(mapnik::SEG_LINETO) [_a +=1] << karma::string [if_(_a == 1) [_1 = "L" ] ])
197
                          | &uint_(mapnik::SEG_LINETO) [_a +=1] << karma::string [if_(_a == 1u) [_1 = "L" ].else_[_1 =""]])
173
                         << lit(' ') << coordinate << lit(' ') << coordinate) % lit(' ')
198
                         << lit(' ') << coordinate << lit(' ') << coordinate) % lit(' ')
174
                ;
199
                ;
175
200
(-)a/include/mapnik/util/geometry_wkt_generator.hpp (-3 / +1 lines)
Lines 40-46 Link Here
40
#include <boost/type_traits/remove_pointer.hpp>
40
#include <boost/type_traits/remove_pointer.hpp>
41
41
42
#include <boost/math/special_functions/trunc.hpp> // trunc to avoid needing C++11
42
#include <boost/math/special_functions/trunc.hpp> // trunc to avoid needing C++11
43
//#define BOOST_SPIRIT_USE_PHOENIX_V3 1
44
43
45
namespace boost { namespace spirit { namespace traits {
44
namespace boost { namespace spirit { namespace traits {
46
45
Lines 205-212 template <typename OutputIterator, typename GeometryContainer> Link Here
205
struct wkt_multi_generator :
204
struct wkt_multi_generator :
206
        karma::grammar<OutputIterator, karma::locals< boost::tuple<unsigned,bool> >, GeometryContainer const& ()>
205
        karma::grammar<OutputIterator, karma::locals< boost::tuple<unsigned,bool> >, GeometryContainer const& ()>
207
{
206
{
208
    typedef GeometryContainer geometry_contaner;
207
    typedef typename boost::remove_pointer<typename GeometryContainer::value_type>::type geometry_type;
209
    typedef boost::remove_pointer<typename geometry_container::value_type>::type geometry_type;
210
208
211
    wkt_multi_generator();
209
    wkt_multi_generator();
212
    // rules
210
    // rules
(-)a/include/mapnik/wkt/wkt_grammar.hpp (-1 / +4 lines)
Lines 40-51 Link Here
40
namespace mapnik { namespace wkt {
40
namespace mapnik { namespace wkt {
41
41
42
    using namespace boost::spirit;
42
    using namespace boost::spirit;
43
    using namespace boost::fusion;
44
    using namespace boost::phoenix;
43
    using namespace boost::phoenix;
45
44
46
    struct push_vertex
45
    struct push_vertex
47
    {
46
    {
47
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
48
        template <typename T>
49
#else
48
        template <typename T0,typename T1, typename T2, typename T3>
50
        template <typename T0,typename T1, typename T2, typename T3>
51
#endif
49
        struct result
52
        struct result
50
        {
53
        {
51
            typedef void type;
54
            typedef void type;
(-)a/src/json/feature_collection_parser.cpp (-1 / +2 lines)
Lines 23-30 Link Here
23
// TODO https://github.com/mapnik/mapnik/issues/1658
23
// TODO https://github.com/mapnik/mapnik/issues/1658
24
#include <boost/version.hpp>
24
#include <boost/version.hpp>
25
#if BOOST_VERSION >= 105200
25
#if BOOST_VERSION >= 105200
26
#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
26
#define BOOST_SPIRIT_USE_PHOENIX_V3
27
#define BOOST_SPIRIT_USE_PHOENIX_V3
27
#endif
28
#endif
29
#endif
28
30
29
// mapnik
31
// mapnik
30
#include <mapnik/json/feature_collection_parser.hpp>
32
#include <mapnik/json/feature_collection_parser.hpp>
31
#2367
33
#2367
32
--
33
plugins/input/geojson/geojson_datasource.cpp | 22 +++++++++++++++-------
34
plugins/input/geojson/geojson_datasource.cpp | 22 +++++++++++++++-------
34
plugins/input/geojson/geojson_datasource.hpp | 18 +++++++++++++++---
35
plugins/input/geojson/geojson_datasource.hpp | 18 +++++++++++++++---
35
plugins/input/geojson/geojson_featureset.cpp | 11 ++++++++---
36
plugins/input/geojson/geojson_featureset.cpp | 11 ++++++++---
36
plugins/input/geojson/geojson_featureset.hpp |  9 +++++----
37
plugins/input/geojson/geojson_featureset.hpp |  9 +++++----
37
4 files changed, 43 insertions(+), 17 deletions(-)
38
4 files changed, 43 insertions(+), 17 deletions(-)
(-)a/plugins/input/geojson/geojson_datasource.cpp (-7 / +15 lines)
Lines 32-41 Link Here
32
#include <boost/algorithm/string.hpp>
32
#include <boost/algorithm/string.hpp>
33
#include <boost/spirit/include/support_multi_pass.hpp>
33
#include <boost/spirit/include/support_multi_pass.hpp>
34
#include <boost/foreach.hpp>
34
#include <boost/foreach.hpp>
35
#include <boost/geometry/geometries/box.hpp>
36
#include <boost/geometry/geometries/geometries.hpp>
37
#include <boost/geometry.hpp>
38
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
39
35
40
// mapnik
36
// mapnik
41
#include <mapnik/unicode.hpp>
37
#include <mapnik/unicode.hpp>
Lines 101-107 geojson_datasource::geojson_datasource(parameters const& params) Link Here
101
    extent_(),
97
    extent_(),
102
    tr_(new mapnik::transcoder(*params.get<std::string>("encoding","utf-8"))),
98
    tr_(new mapnik::transcoder(*params.get<std::string>("encoding","utf-8"))),
103
    features_(),
99
    features_(),
100
#if BOOST_VERSION >= 105600
101
    tree_()
102
#else
104
    tree_(16,1)
103
    tree_(16,1)
104
#endif
105
{
105
{
106
    if (file_.empty()) throw mapnik::datasource_exception("GeoJSON Plugin: missing <file> parameter");
106
    if (file_.empty()) throw mapnik::datasource_exception("GeoJSON Plugin: missing <file> parameter");
107
107
Lines 139-147 geojson_datasource::geojson_datasource(parameters const& params) Link Here
139
139
140
    bool first = true;
140
    bool first = true;
141
    std::size_t count=0;
141
    std::size_t count=0;
142
    BOOST_FOREACH (mapnik::feature_ptr f, features_)
142
    BOOST_FOREACH (mapnik::feature_ptr const& f, features_)
143
    {
143
    {
144
        mapnik::box2d<double> const& box = f->envelope();
144
        mapnik::box2d<double> box = f->envelope();
145
        if (first)
145
        if (first)
146
        {
146
        {
147
            extent_ = box;
147
            extent_ = box;
Lines 158-164 geojson_datasource::geojson_datasource(parameters const& params) Link Here
158
        {
158
        {
159
            extent_.expand_to_include(box);
159
            extent_.expand_to_include(box);
160
        }
160
        }
161
        tree_.insert(box_type(point_type(box.minx(),box.miny()),point_type(box.maxx(),box.maxy())), count++);
161
#if BOOST_VERSION >= 105600
162
        tree_.insert(std::make_pair(box_type(point_type(box.minx(),box.miny()),point_type(box.maxx(),box.maxy())),count++));
163
#else
164
        tree_.insert(box_type(point_type(box.minx(),box.miny()),point_type(box.maxx(),box.maxy())),count++);
165
#endif
162
    }
166
    }
163
}
167
}
164
168
Lines 213-219 mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) cons Link Here
213
    if (extent_.intersects(b))
217
    if (extent_.intersects(b))
214
    {
218
    {
215
        box_type box(point_type(b.minx(),b.miny()),point_type(b.maxx(),b.maxy()));
219
        box_type box(point_type(b.minx(),b.miny()),point_type(b.maxx(),b.maxy()));
220
#if BOOST_VERSION >= 105600
221
        tree_.query(boost::geometry::index::intersects(box),std::back_inserter(index_array_));
222
#else
216
        index_array_ = tree_.find(box);
223
        index_array_ = tree_.find(box);
224
#endif
217
        return boost::make_shared<geojson_featureset>(features_, index_array_.begin(), index_array_.end());
225
        return boost::make_shared<geojson_featureset>(features_, index_array_.begin(), index_array_.end());
218
    }
226
    }
219
    // otherwise return an empty featureset pointer
227
    // otherwise return an empty featureset pointer
(-)a/plugins/input/geojson/geojson_datasource.hpp (-3 / +15 lines)
Lines 36-46 Link Here
36
// boost
36
// boost
37
#include <boost/optional.hpp>
37
#include <boost/optional.hpp>
38
#include <boost/shared_ptr.hpp>
38
#include <boost/shared_ptr.hpp>
39
#include <boost/geometry/geometries/box.hpp>
40
#include <boost/geometry/geometries/point_xy.hpp>
39
#include <boost/geometry/geometries/point_xy.hpp>
41
#include <boost/geometry/algorithms/area.hpp>
40
#include <boost/geometry/geometries/box.hpp>
42
#include <boost/geometry/geometries/geometries.hpp>
41
#include <boost/geometry/geometries/geometries.hpp>
42
#include <boost/geometry.hpp>
43
#include <boost/version.hpp>
44
#if BOOST_VERSION >= 105600
45
#include <boost/geometry/index/rtree.hpp>
46
#else
43
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
47
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
48
#endif
44
49
45
// stl
50
// stl
46
#include <vector>
51
#include <vector>
Lines 53-59 class geojson_datasource : public mapnik::datasource Link Here
53
public:
58
public:
54
    typedef boost::geometry::model::d2::point_xy<double> point_type;
59
    typedef boost::geometry::model::d2::point_xy<double> point_type;
55
    typedef boost::geometry::model::box<point_type> box_type;
60
    typedef boost::geometry::model::box<point_type> box_type;
61
#if BOOST_VERSION >= 105600
62
    typedef std::pair<box_type,std::size_t> item_type;
63
    typedef boost::geometry::index::linear<16,1> linear_type;
64
    typedef boost::geometry::index::rtree<item_type,linear_type> spatial_index_type;
65
#else
66
    typedef std::size_t item_type;
56
    typedef boost::geometry::index::rtree<box_type,std::size_t> spatial_index_type;
67
    typedef boost::geometry::index::rtree<box_type,std::size_t> spatial_index_type;
68
#endif
57
    
69
    
58
    // constructor
70
    // constructor
59
    geojson_datasource(mapnik::parameters const& params);
71
    geojson_datasource(mapnik::parameters const& params);
Lines 74-80 class geojson_datasource : public mapnik::datasource Link Here
74
    boost::shared_ptr<mapnik::transcoder> tr_;
86
    boost::shared_ptr<mapnik::transcoder> tr_;
75
    std::vector<mapnik::feature_ptr> features_;
87
    std::vector<mapnik::feature_ptr> features_;
76
    spatial_index_type tree_;
88
    spatial_index_type tree_;
77
    mutable std::deque<std::size_t> index_array_;
89
    mutable std::deque<item_type> index_array_;
78
};
90
};
79
91
80
92
(-)a/plugins/input/geojson/geojson_featureset.cpp (-3 / +8 lines)
Lines 30-37 Link Here
30
#include "geojson_featureset.hpp"
30
#include "geojson_featureset.hpp"
31
31
32
geojson_featureset::geojson_featureset(std::vector<mapnik::feature_ptr> const& features, 
32
geojson_featureset::geojson_featureset(std::vector<mapnik::feature_ptr> const& features, 
33
                                       std::deque<std::size_t>::const_iterator index_itr,
33
                                       array_type::const_iterator index_itr,
34
                                       std::deque<std::size_t>::const_iterator index_end)
34
                                       array_type::const_iterator index_end)
35
    : features_(features),
35
    : features_(features),
36
      index_itr_(index_itr),
36
      index_itr_(index_itr),
37
      index_end_(index_end) {}
37
      index_end_(index_end) {}
Lines 42-48 mapnik::feature_ptr geojson_featureset::next() Link Here
42
{
42
{
43
    if (index_itr_ != index_end_)
43
    if (index_itr_ != index_end_)
44
    {
44
    {
45
        std::size_t index = *index_itr_++;        
45
#if BOOST_VERSION >= 105600
46
        geojson_datasource::item_type const& item = *index_itr_++;
47
        std::size_t index = item.second;
48
#else
49
        std::size_t const& index = *index_itr_++;
50
#endif
46
        if ( index < features_.size())
51
        if ( index < features_.size())
47
        {
52
        {
48
            return features_.at(index);
53
            return features_.at(index);
(-)a/plugins/input/geojson/geojson_featureset.hpp (-4 / +5 lines)
Lines 11-27 Link Here
11
class geojson_featureset : public mapnik::Featureset
11
class geojson_featureset : public mapnik::Featureset
12
{
12
{
13
public:
13
public:
14
    typedef std::deque<geojson_datasource::item_type> array_type;
14
    geojson_featureset(std::vector<mapnik::feature_ptr> const& features,
15
    geojson_featureset(std::vector<mapnik::feature_ptr> const& features,
15
                       std::deque<std::size_t>::const_iterator index_itr,
16
                       array_type::const_iterator index_itr,
16
                       std::deque<std::size_t>::const_iterator index_end);
17
                       array_type::const_iterator index_end);
17
    virtual ~geojson_featureset();
18
    virtual ~geojson_featureset();
18
    mapnik::feature_ptr next();
19
    mapnik::feature_ptr next();
19
20
20
private:
21
private:
21
    mapnik::box2d<double> box_;
22
    mapnik::box2d<double> box_;
22
    std::vector<mapnik::feature_ptr> const& features_;
23
    std::vector<mapnik::feature_ptr> const& features_;
23
    std::deque<std::size_t>::const_iterator index_itr_;
24
    array_type::const_iterator index_itr_;
24
    std::deque<std::size_t>::const_iterator index_end_;
25
    array_type::const_iterator index_end_;
25
};
26
};
26
27
27
#endif // GEOJSON_FEATURESET_HPP
28
#endif // GEOJSON_FEATURESET_HPP

Return to bug 533526