]> git.pld-linux.org Git - packages/mapnik.git/blame - mapnik-boost-megadiff.diff
- release 5 (by relup.sh)
[packages/mapnik.git] / mapnik-boost-megadiff.diff
CommitLineData
eaba878b
AM
1diff --git a/SConstruct b/SConstruct
2index 4bd700e..6aefc58 100644
3--- a/SConstruct
4+++ b/SConstruct
5@@ -1431,7 +1431,7 @@ if not preconfigured:
6 env["CAIRO_ALL_LIBS"] = ['cairo']
7 if env['RUNTIME_LINK'] == 'static':
8 env["CAIRO_ALL_LIBS"].extend(
9- ['pixman-1','expat','fontconfig','iconv']
10+ ['pixman-1','expat','iconv']
11 )
12 # todo - run actual checkLib?
13 env['HAS_CAIRO'] = True
14diff --git a/include/mapnik/css_color_grammar.hpp b/include/mapnik/css_color_grammar.hpp
15index a15f0fa..e20bdb2 100644
16--- a/include/mapnik/css_color_grammar.hpp
17+++ b/include/mapnik/css_color_grammar.hpp
18@@ -125,7 +125,11 @@ struct alpha_conv_impl
19
20 struct hsl_conv_impl
21 {
22+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
23+ template<typename T>
24+#else
25 template<typename T0,typename T1, typename T2, typename T3>
26+#endif
27 struct result
28 {
29 typedef void type;
30@@ -413,7 +417,11 @@ struct alpha_conv_impl
31
32 struct hsl_conv_impl
33 {
34+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
35+ template<typename T>
36+#else
37 template<typename T0,typename T1, typename T2, typename T3>
38+#endif
39 struct result
40 {
41 typedef void type;
42diff --git a/include/mapnik/expression_grammar.hpp b/include/mapnik/expression_grammar.hpp
43index ed4a430..0b48924 100644
44--- a/include/mapnik/expression_grammar.hpp
45+++ b/include/mapnik/expression_grammar.hpp
46@@ -65,7 +65,11 @@ struct unicode_impl
47
48 struct regex_match_impl
49 {
50+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
51+ template <typename T>
52+#else
53 template <typename T0, typename T1>
54+#endif
55 struct result
56 {
57 typedef expr_node type;
58@@ -82,7 +86,11 @@ struct regex_match_impl
59
60 struct regex_replace_impl
61 {
62- template <typename T0, typename T1, typename T2>
63+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
64+ template <typename T>
65+#else
66+ template <typename T0, typename T1>
67+#endif
68 struct result
69 {
70 typedef expr_node type;
71diff --git a/include/mapnik/expression_grammar_impl.hpp b/include/mapnik/expression_grammar_impl.hpp
72index 5ca2c5e..2255d48 100644
73--- a/include/mapnik/expression_grammar_impl.hpp
74+++ b/include/mapnik/expression_grammar_impl.hpp
75@@ -145,7 +145,7 @@ expression_grammar<Iterator>::expression_grammar(mapnik::transcoder const& tr)
76 multiplicative_expr = unary_expr [_val = _1]
77 >> *( '*' >> unary_expr [_val *= _1]
78 | '/' >> unary_expr [_val /= _1]
79- | '%' >> unary_expr [_val %= _1]
80+ | '%' >> unary_expr [_val %= construct<mapnik::expr_node>(_1)] //needed by clang++ with -std=c++11
81 | regex_match_expr[_val = regex_match_(_val, _1)]
82 | regex_replace_expr(_val) [_val = _1]
83 )
84diff --git a/include/mapnik/json/feature_grammar.hpp b/include/mapnik/json/feature_grammar.hpp
85index a117b53..6a4a087 100644
86--- a/include/mapnik/json/feature_grammar.hpp
87+++ b/include/mapnik/json/feature_grammar.hpp
88@@ -66,6 +66,30 @@ class attribute_value_visitor
89 mapnik::transcoder const& tr_;
90 };
91
92+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
93+struct put_property
94+{
95+ typedef void result_type;
96+ explicit put_property(mapnik::transcoder const& tr)
97+ : tr_(tr) {}
98+ template <typename T0,typename T1, typename T2>
99+ result_type operator() (T0 & feature, T1 const& key, T2 const& val) const
100+ {
101+ feature.put_new(key, boost::apply_visitor(attribute_value_visitor(tr_),val));
102+ }
103+ mapnik::transcoder const& tr_;
104+};
105+
106+struct extract_geometry
107+{
108+ typedef boost::ptr_vector<mapnik::geometry_type>& result_type;
109+ template <typename T>
110+ result_type operator() (T & feature) const
111+ {
112+ return feature.paths();
113+ }
114+};
115+#else
116 struct put_property
117 {
118 template <typename T0,typename T1, typename T2>
119@@ -100,6 +124,7 @@ struct extract_geometry
120 return feature.paths();
121 }
122 };
123+#endif
124
125 template <typename Iterator, typename FeatureType>
126 struct feature_grammar :
127diff --git a/include/mapnik/json/geometry_generator_grammar.hpp b/include/mapnik/json/geometry_generator_grammar.hpp
128index 47974c2..2c21bab 100644
129--- a/include/mapnik/json/geometry_generator_grammar.hpp
130+++ b/include/mapnik/json/geometry_generator_grammar.hpp
131@@ -38,11 +38,8 @@
132 #include <boost/spirit/include/phoenix_fusion.hpp>
133 #include <boost/spirit/include/phoenix_function.hpp>
134 #include <boost/spirit/include/phoenix_statement.hpp>
135-#include <boost/fusion/include/boost_tuple.hpp>
136-#include <boost/math/special_functions/trunc.hpp> // trunc to avoid needing C++11
137-
138-
139-//#define BOOST_SPIRIT_USE_PHOENIX_V3 1
140+#include <boost/fusion/adapted/boost_tuple.hpp>
141+#include <boost/math/special_functions/trunc.hpp> // for vc++ and android whose c++11 libs lack std::trunct
142
143 namespace boost { namespace spirit { namespace traits {
144
145@@ -61,6 +58,68 @@ namespace phoenix = boost::phoenix;
146
147 namespace {
148
149+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
150+struct get_type
151+{
152+ typedef int result_type;
153+ result_type operator() (geometry_type const& geom) const
154+ {
155+ return static_cast<int>(geom.type());
156+ }
157+};
158+
159+struct get_first
160+{
161+ typedef geometry_type::value_type const result_type;
162+ result_type operator() (geometry_type const& geom) const
163+ {
164+ geometry_type::value_type coord;
165+ boost::get<0>(coord) = geom.vertex(0,&boost::get<1>(coord),&boost::get<2>(coord));
166+ return coord;
167+ }
168+};
169+
170+struct multi_geometry_type
171+{
172+ typedef boost::tuple<unsigned,bool> result_type;
173+ result_type operator() (geometry_container const& geom) const
174+ {
175+ unsigned type = 0u;
176+ bool collection = false;
177+
178+ geometry_container::const_iterator itr = geom.begin();
179+ geometry_container::const_iterator end = geom.end();
180+
181+ for ( ; itr != end; ++itr)
182+ {
183+ if (type != 0u && itr->type() != type)
184+ {
185+ collection = true;
186+ break;
187+ }
188+ type = itr->type();
189+ }
190+ if (geom.size() > 1) type +=3;
191+ return boost::tuple<unsigned,bool>(type, collection);
192+ }
193+};
194+
195+struct not_empty
196+{
197+ typedef bool result_type;
198+ result_type operator() (geometry_container const& cont) const
199+ {
200+ geometry_container::const_iterator itr = cont.begin();
201+ geometry_container::const_iterator end = cont.end();
202+ for ( ; itr != end; ++itr)
203+ {
204+ if (itr->size() > 0) return true;
205+ }
206+ return false;
207+ }
208+};
209+
210+#else
211 struct get_type
212 {
213 template <typename T>
214@@ -100,7 +159,7 @@ struct multi_geometry_type
215
216 for ( ; itr != end; ++itr)
217 {
218- if (type != 0u && itr->type() != type)
219+ if (type != 0u && static_cast<unsigned>(itr->type()) != type)
220 {
221 collection = true;
222 break;
223@@ -113,6 +172,28 @@ struct multi_geometry_type
224 };
225
226
227+struct not_empty
228+{
229+ template <typename T>
230+ struct result { typedef bool type; };
231+
232+ bool operator() (geometry_container const& cont) const
233+ {
234+ geometry_container::const_iterator itr = cont.begin();
235+ geometry_container::const_iterator end = cont.end();
236+
237+ for (; itr!=end; ++itr)
238+ {
239+ if (itr->size() > 0) return true;
240+ }
241+ return false;
242+ }
243+};
244+
245+
246+#endif
247+
248+
249 template <typename T>
250 struct json_coordinate_policy : karma::real_policies<T>
251 {
252@@ -123,7 +204,7 @@ struct json_coordinate_policy : karma::real_policies<T>
253 {
254 if (n == 0.0) return 0;
255 using namespace boost::spirit;
256- return static_cast<unsigned>(15 - boost::math::trunc(log10(traits::get_absolute_value(n))));
257+ return static_cast<unsigned>(14 - boost::math::trunc(log10(traits::get_absolute_value(n))));
258 }
259
260 template <typename OutputIterator>
261@@ -135,7 +216,7 @@ struct json_coordinate_policy : karma::real_policies<T>
262
263 template <typename OutputIterator>
264 static bool fraction_part(OutputIterator& sink, T n
265- , unsigned adjprec, unsigned precision)
266+ , unsigned adjprec, unsigned precision)
267 {
268 if (n == 0) return true;
269 return base_type::fraction_part(sink, n, adjprec, precision);
270@@ -153,6 +234,7 @@ struct geometry_generator_grammar :
271 : geometry_generator_grammar::base_type(coordinates)
272 {
273 using boost::spirit::karma::uint_;
274+ using boost::spirit::bool_;
275 using boost::spirit::karma::_val;
276 using boost::spirit::karma::_1;
277 using boost::spirit::karma::lit;
278@@ -182,15 +264,15 @@ struct geometry_generator_grammar :
279 point_coord = &uint_
280 << lit('[')
281 << coord_type << lit(',') << coord_type
282- << lit("]")
283+ << lit(']')
284 ;
285
286 polygon_coord %= ( &uint_(mapnik::SEG_MOVETO) << eps[_r1 += 1]
287- << karma::string[ if_ (_r1 > 1) [_1 = "],["]
288- .else_[_1 = '[' ]] | &uint_ << lit(','))
289- << lit('[') << coord_type
290- << lit(',')
291- << coord_type << lit(']')
292+ << karma::string[ if_ (_r1 > 1u) [_1 = "],["]
293+ .else_[_1 = '[' ]]
294+ |
295+ &uint_(mapnik::SEG_LINETO)
296+ << lit(',')) << lit('[') << coord_type << lit(',') << coord_type << lit(']')
297 ;
298
299 coords2 %= *polygon_coord(_a)
300@@ -205,7 +287,6 @@ struct geometry_generator_grammar :
301 karma::rule<OutputIterator, geometry_type const& ()> point;
302 karma::rule<OutputIterator, geometry_type const& ()> linestring;
303 karma::rule<OutputIterator, geometry_type const& ()> polygon;
304-
305 karma::rule<OutputIterator, geometry_type const& ()> coords;
306 karma::rule<OutputIterator, karma::locals<unsigned>, geometry_type const& ()> coords2;
307 karma::rule<OutputIterator, geometry_type::value_type ()> point_coord;
308@@ -235,6 +316,7 @@ struct multi_geometry_generator_grammar :
309 using boost::spirit::karma::_1;
310 using boost::spirit::karma::_a;
311 using boost::spirit::karma::_r1;
312+ using boost::spirit::bool_;
313
314 geometry_types.add
315 (mapnik::Point,"\"Point\"")
316@@ -245,7 +327,7 @@ struct multi_geometry_generator_grammar :
317 (mapnik::Polygon + 3,"\"MultiPolygon\"")
318 ;
319
320- start %= ( eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)]
321+ start %= ( eps(phoenix::at_c<1>(_a))[_a = multi_type_(_val)]
322 << lit("{\"type\":\"GeometryCollection\",\"geometries\":[")
323 << geometry_collection << lit("]}")
324 |
325@@ -255,13 +337,13 @@ struct multi_geometry_generator_grammar :
326 geometry_collection = -(geometry2 % lit(','))
327 ;
328
329- geometry = (lit("{\"type\":")
330- << geometry_types[_1 = phoenix::at_c<0>(_a)][_a = _multi_type(_val)]
331- << lit(",\"coordinates\":")
332- << karma::string[ if_ (phoenix::at_c<0>(_a) > 3) [_1 = '[']]
333- << coordinates
334- << karma::string[ if_ (phoenix::at_c<0>(_a) > 3) [_1 = ']']]
335- << lit('}')) | lit("null")
336+ geometry = ( &bool_(true)[_1 = not_empty_(_val)] << lit("{\"type\":")
337+ << geometry_types[_1 = phoenix::at_c<0>(_a)][_a = multi_type_(_val)]
338+ << lit(",\"coordinates\":")
339+ << karma::string[ phoenix::if_ (phoenix::at_c<0>(_a) > 3u) [_1 = '['].else_[_1 = ""]]
340+ << coordinates
341+ << karma::string[ phoenix::if_ (phoenix::at_c<0>(_a) > 3u) [_1 = ']'].else_[_1 = ""]]
342+ << lit('}')) | lit("null")
343 ;
344
345 geometry2 = lit("{\"type\":")
346@@ -287,8 +369,9 @@ struct multi_geometry_generator_grammar :
347 karma::rule<OutputIterator, geometry_container const&()> coordinates;
348 geometry_generator_grammar<OutputIterator> path;
349 // phoenix
350- phoenix::function<multi_geometry_type> _multi_type;
351+ phoenix::function<multi_geometry_type> multi_type_;
352 phoenix::function<get_type > type_;
353+ phoenix::function<not_empty> not_empty_;
354 // symbols table
355 karma::symbols<unsigned, char const*> geometry_types;
356 };
357diff --git a/include/mapnik/json/geometry_grammar.hpp b/include/mapnik/json/geometry_grammar.hpp
358index 9600b41..157d0e6 100644
359--- a/include/mapnik/json/geometry_grammar.hpp
360+++ b/include/mapnik/json/geometry_grammar.hpp
361@@ -37,6 +37,58 @@ namespace qi = boost::spirit::qi;
362 namespace standard_wide = boost::spirit::standard_wide;
363 using standard_wide::space_type;
364
365+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
366+struct push_vertex
367+{
368+ typedef void result_type;
369+
370+ template <typename T0,typename T1, typename T2, typename T3>
371+ result_type operator() (T0 c, T1 path, T2 x, T3 y) const
372+ {
373+ BOOST_ASSERT( path!=0 );
374+ path->push_vertex(x,y,c);
375+ }
376+};
377+
378+struct close_path
379+{
380+ typedef void result_type;
381+
382+ template <typename T>
383+ result_type operator() (T path) const
384+ {
385+ BOOST_ASSERT( path!=0 );
386+ if (path->size() > 2u) // to form a polygon ring we need at least 3 vertices
387+ {
388+ path->close_path();
389+ }
390+ }
391+};
392+
393+struct cleanup
394+{
395+ typedef void result_type;
396+ template <typename T0>
397+ void operator() (T0 & path) const
398+ {
399+ if (path) delete path, path=0;
400+ }
401+};
402+
403+struct where_message
404+{
405+ typedef std::string result_type;
406+
407+ template <typename Iterator>
408+ std::string operator() (Iterator first, Iterator last, std::size_t size) const
409+ {
410+ std::string str(first, last);
411+ if (str.length() > size)
412+ return str.substr(0, size) + "..." ;
413+ return str;
414+ }
415+};
416+#else
417 struct push_vertex
418 {
419 template <typename T0,typename T1, typename T2, typename T3>
420@@ -65,8 +117,11 @@ struct close_path
421 void operator() (T path) const
422 {
423 BOOST_ASSERT( path!=0 );
424- path->close_path();
425- }
426+ if (path->size() > 2u) // to form a polygon ring we need at least 3 vertices
427+ {
428+ path->close_path();
429+ }
430+ }
431 };
432
433 struct cleanup
434@@ -101,12 +156,13 @@ struct where_message
435 return str;
436 }
437 };
438+#endif
439
440
441 template <typename Iterator>
442 struct geometry_grammar :
443 qi::grammar<Iterator,qi::locals<int>, void(boost::ptr_vector<mapnik::geometry_type>& )
444- , space_type>
445+ , space_type>
446 {
447 geometry_grammar();
448 qi::rule<Iterator, qi::locals<int>, void(boost::ptr_vector<mapnik::geometry_type>& ),space_type> geometry;
449diff --git a/include/mapnik/svg/svg_path_commands.hpp b/include/mapnik/svg/svg_path_commands.hpp
450index e45b5b1..ba631ed 100644
451--- a/include/mapnik/svg/svg_path_commands.hpp
452+++ b/include/mapnik/svg/svg_path_commands.hpp
453@@ -45,7 +45,12 @@ inline double deg2rad(double deg)
454 template <typename PathType>
455 struct move_to
456 {
457+
458+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
459+ template <typename T0>
460+#else
461 template <typename T0, typename T1>
462+#endif
463 struct result
464 {
465 typedef void type;
466@@ -66,7 +71,11 @@ struct move_to
467 template <typename PathType>
468 struct hline_to
469 {
470+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
471+ template <typename T0>
472+#else
473 template <typename T0, typename T1>
474+#endif
475 struct result
476 {
477 typedef void type;
478@@ -88,7 +97,11 @@ struct hline_to
479 template <typename PathType>
480 struct vline_to
481 {
482+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
483+ template <typename T0>
484+#else
485 template <typename T0, typename T1>
486+#endif
487 struct result
488 {
489 typedef void type;
490@@ -109,7 +122,11 @@ struct vline_to
491 template <typename PathType>
492 struct line_to
493 {
494+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
495+ template <typename T0>
496+#else
497 template <typename T0, typename T1>
498+#endif
499 struct result
500 {
501 typedef void type;
502@@ -131,7 +148,11 @@ struct line_to
503 template <typename PathType>
504 struct curve4
505 {
506+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
507+ template <typename T0>
508+#else
509 template <typename T0, typename T1, typename T2, typename T3>
510+#endif
511 struct result
512 {
513 typedef void type;
514@@ -156,7 +177,11 @@ struct curve4
515 template <typename PathType>
516 struct curve4_smooth
517 {
518+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
519+ template <typename T0>
520+#else
521 template <typename T0, typename T1, typename T2>
522+#endif
523 struct result
524 {
525 typedef void type;
526@@ -178,7 +203,11 @@ struct curve4_smooth
527 template <typename PathType>
528 struct curve3
529 {
530+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
531+ template <typename T0>
532+#else
533 template <typename T0, typename T1, typename T2>
534+#endif
535 struct result
536 {
537 typedef void type;
538@@ -201,7 +230,11 @@ struct curve3
539 template <typename PathType>
540 struct curve3_smooth
541 {
542+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
543+ template <typename T0>
544+#else
545 template <typename T0, typename T1>
546+#endif
547 struct result
548 {
549 typedef void type;
550@@ -223,7 +256,11 @@ struct curve3_smooth
551 template <typename PathType>
552 struct arc_to
553 {
554+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
555+ template <typename T0>
556+#else
557 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
558+#endif
559 struct result
560 {
561 typedef void type;
562diff --git a/include/mapnik/svg/svg_transform_grammar.hpp b/include/mapnik/svg/svg_transform_grammar.hpp
563index 087bab3..a63884b 100644
564--- a/include/mapnik/svg/svg_transform_grammar.hpp
565+++ b/include/mapnik/svg/svg_transform_grammar.hpp
566@@ -50,7 +50,11 @@ namespace mapnik { namespace svg {
567 template <typename TransformType>
568 struct process_matrix
569 {
570+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
571+ template <typename T0>
572+#else
573 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
574+#endif
575 struct result
576 {
577 typedef void type;
578@@ -70,7 +74,11 @@ namespace mapnik { namespace svg {
579 template <typename TransformType>
580 struct process_rotate
581 {
582+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
583+ template <typename T0>
584+#else
585 template <typename T0, typename T1, typename T2>
586+#endif
587 struct result
588 {
589 typedef void type;
590@@ -101,7 +109,11 @@ namespace mapnik { namespace svg {
591 template <typename TransformType>
592 struct process_translate
593 {
594+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
595+ template <typename T0>
596+#else
597 template <typename T0, typename T1>
598+#endif
599 struct result
600 {
601 typedef void type;
602@@ -123,7 +135,11 @@ namespace mapnik { namespace svg {
603 template <typename TransformType>
604 struct process_scale
605 {
606+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
607+ template <typename T0>
608+#else
609 template <typename T0, typename T1>
610+#endif
611 struct result
612 {
613 typedef void type;
614@@ -146,7 +162,11 @@ namespace mapnik { namespace svg {
615 template <typename TransformType>
616 struct process_skew
617 {
618+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
619+ template <typename T0>
620+#else
621 template <typename T0, typename T1>
622+#endif
623 struct result
624 {
625 typedef void type;
626diff --git a/include/mapnik/util/geometry_svg_generator.hpp b/include/mapnik/util/geometry_svg_generator.hpp
627index 0705210..210a376 100644
628--- a/include/mapnik/util/geometry_svg_generator.hpp
629+++ b/include/mapnik/util/geometry_svg_generator.hpp
630@@ -23,6 +23,7 @@
631 #ifndef MAPNIK_GEOMETRY_SVG_GENERATOR_HPP
632 #define MAPNIK_GEOMETRY_SVG_GENERATOR_HPP
633
634+
635 // mapnik
636 #include <mapnik/global.hpp>
637 #include <mapnik/geometry.hpp> // for container stuff
638@@ -41,13 +42,11 @@
639 #include <boost/fusion/include/boost_tuple.hpp>
640 #include <boost/type_traits/remove_pointer.hpp>
641
642-//#define BOOST_SPIRIT_USE_PHOENIX_V3 1
643
644-/*!
645- * adapted to conform to the concepts
646- * required by Karma to be recognized as a container of
647- * attributes for output generation.
648- */
649+// adapted to conform to the concepts
650+// required by Karma to be recognized as a container of
651+// attributes for output generation.
652+
653 namespace boost { namespace spirit { namespace traits {
654
655 // TODO - this needs to be made generic to any path type
656@@ -76,7 +75,7 @@ template <>
657 struct end_container<path_type const>
658 {
659 static mapnik::util::path_iterator<path_type>
660- call (path_type const& g)
661+ call (path_type const& /*g*/)
662 {
663 return mapnik::util::path_iterator<path_type>();
664 }
665@@ -92,6 +91,31 @@ namespace mapnik { namespace util {
666
667 namespace svg_detail {
668
669+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
670+ template <typename Geometry>
671+ struct get_type
672+ {
673+ typedef int result_type;
674+ result_type operator() (Geometry const& geom) const
675+ {
676+ return static_cast<int>(geom.type());
677+ }
678+ };
679+
680+ template <typename T>
681+ struct get_first
682+ {
683+ typedef T geometry_type;
684+ typedef typename geometry_type::value_type const result_type;
685+ result_type operator() (geometry_type const& geom) const
686+ {
687+ typename geometry_type::value_type coord;
688+ geom.rewind(0);
689+ boost::get<0>(coord) = geom.vertex(&boost::get<1>(coord),&boost::get<2>(coord));
690+ return coord;
691+ }
692+ };
693+#else
694 template <typename Geometry>
695 struct get_type
696 {
697@@ -112,7 +136,7 @@ namespace mapnik { namespace util {
698 template <typename U>
699 struct result { typedef typename geometry_type::value_type const type; };
700
701- typename geometry_type::value_type const operator() (geometry_type const& geom) const
702+ typename geometry_type::value_type operator() (geometry_type const& geom) const
703 {
704 typename geometry_type::value_type coord;
705 geom.rewind(0);
706@@ -121,12 +145,13 @@ namespace mapnik { namespace util {
707 }
708 };
709
710+#endif
711 template <typename T>
712 struct coordinate_policy : karma::real_policies<T>
713 {
714 typedef boost::spirit::karma::real_policies<T> base_type;
715 static int floatfield(T n) { return base_type::fmtflags::fixed; }
716- static unsigned precision(T n) { return 6u ;}
717+ static unsigned precision(T n) { return 4u ;}
718 };
719 }
720
721@@ -161,15 +186,15 @@ namespace mapnik { namespace util {
722 ;
723
724 linestring = &uint_(mapnik::LineString)[_1 = _type(_val)]
725- << svg_path << lit('\"')
726+ << lit("d=\"") << svg_path << lit("\"")
727 ;
728
729 polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)]
730- << svg_path << lit('\"')
731+ << lit("d=\"") << svg_path << lit("\"")
732 ;
733
734- svg_path %= ((&uint_(mapnik::SEG_MOVETO) << lit("d=\"") << lit('M')
735- | &uint_(mapnik::SEG_LINETO) [_a +=1] << karma::string [if_(_a == 1) [_1 = "L" ] ])
736+ svg_path %= ((&uint_(mapnik::SEG_MOVETO) << lit('M')
737+ | &uint_(mapnik::SEG_LINETO) [_a +=1] << karma::string [if_(_a == 1u) [_1 = "L" ].else_[_1 =""]])
738 << lit(' ') << coordinate << lit(' ') << coordinate) % lit(' ')
739 ;
740
741diff --git a/include/mapnik/util/geometry_wkt_generator.hpp b/include/mapnik/util/geometry_wkt_generator.hpp
742index 79f9fe1..ee6e2d1 100644
743--- a/include/mapnik/util/geometry_wkt_generator.hpp
744+++ b/include/mapnik/util/geometry_wkt_generator.hpp
745@@ -40,7 +40,6 @@
746 #include <boost/type_traits/remove_pointer.hpp>
747
748 #include <boost/math/special_functions/trunc.hpp> // trunc to avoid needing C++11
749-//#define BOOST_SPIRIT_USE_PHOENIX_V3 1
750
751 namespace boost { namespace spirit { namespace traits {
752
753@@ -205,8 +204,7 @@ template <typename OutputIterator, typename GeometryContainer>
754 struct wkt_multi_generator :
755 karma::grammar<OutputIterator, karma::locals< boost::tuple<unsigned,bool> >, GeometryContainer const& ()>
756 {
757- typedef GeometryContainer geometry_contaner;
758- typedef boost::remove_pointer<typename geometry_container::value_type>::type geometry_type;
759+ typedef typename boost::remove_pointer<typename GeometryContainer::value_type>::type geometry_type;
760
761 wkt_multi_generator();
762 // rules
763diff --git a/include/mapnik/wkt/wkt_grammar.hpp b/include/mapnik/wkt/wkt_grammar.hpp
764index e7e986f..ff233d6 100644
765--- a/include/mapnik/wkt/wkt_grammar.hpp
766+++ b/include/mapnik/wkt/wkt_grammar.hpp
767@@ -40,12 +40,15 @@
768 namespace mapnik { namespace wkt {
769
770 using namespace boost::spirit;
771- using namespace boost::fusion;
772 using namespace boost::phoenix;
773
774 struct push_vertex
775 {
776+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
777+ template <typename T>
778+#else
779 template <typename T0,typename T1, typename T2, typename T3>
780+#endif
781 struct result
782 {
783 typedef void type;
784diff --git a/src/json/feature_collection_parser.cpp b/src/json/feature_collection_parser.cpp
785index 0e1ce12..e4f65d8 100644
786--- a/src/json/feature_collection_parser.cpp
787+++ b/src/json/feature_collection_parser.cpp
788@@ -23,8 +23,10 @@
789 // TODO https://github.com/mapnik/mapnik/issues/1658
790 #include <boost/version.hpp>
791 #if BOOST_VERSION >= 105200
792+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
793 #define BOOST_SPIRIT_USE_PHOENIX_V3
794 #endif
795+#endif
796
797 // mapnik
798 #include <mapnik/json/feature_collection_parser.hpp>
799diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp
800index dd5e167..7072a27 100644
801--- a/plugins/input/geojson/geojson_datasource.cpp
802+++ b/plugins/input/geojson/geojson_datasource.cpp
803@@ -32,10 +32,6 @@
804 #include <boost/algorithm/string.hpp>
805 #include <boost/spirit/include/support_multi_pass.hpp>
806 #include <boost/foreach.hpp>
807-#include <boost/geometry/geometries/box.hpp>
808-#include <boost/geometry/geometries/geometries.hpp>
809-#include <boost/geometry.hpp>
810-#include <boost/geometry/extensions/index/rtree/rtree.hpp>
811
812 // mapnik
813 #include <mapnik/unicode.hpp>
814@@ -101,7 +97,11 @@ geojson_datasource::geojson_datasource(parameters const& params)
815 extent_(),
816 tr_(new mapnik::transcoder(*params.get<std::string>("encoding","utf-8"))),
817 features_(),
818+#if BOOST_VERSION >= 105600
819+ tree_()
820+#else
821 tree_(16,1)
822+#endif
823 {
824 if (file_.empty()) throw mapnik::datasource_exception("GeoJSON Plugin: missing <file> parameter");
825
826@@ -139,9 +139,9 @@ geojson_datasource::geojson_datasource(parameters const& params)
827
828 bool first = true;
829 std::size_t count=0;
830- BOOST_FOREACH (mapnik::feature_ptr f, features_)
831+ BOOST_FOREACH (mapnik::feature_ptr const& f, features_)
832 {
833- mapnik::box2d<double> const& box = f->envelope();
834+ mapnik::box2d<double> box = f->envelope();
835 if (first)
836 {
837 extent_ = box;
838@@ -158,7 +158,11 @@ geojson_datasource::geojson_datasource(parameters const& params)
839 {
840 extent_.expand_to_include(box);
841 }
842- tree_.insert(box_type(point_type(box.minx(),box.miny()),point_type(box.maxx(),box.maxy())), count++);
843+#if BOOST_VERSION >= 105600
844+ tree_.insert(std::make_pair(box_type(point_type(box.minx(),box.miny()),point_type(box.maxx(),box.maxy())),count++));
845+#else
846+ tree_.insert(box_type(point_type(box.minx(),box.miny()),point_type(box.maxx(),box.maxy())),count++);
847+#endif
848 }
849 }
850
851@@ -213,7 +217,11 @@ mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) cons
852 if (extent_.intersects(b))
853 {
854 box_type box(point_type(b.minx(),b.miny()),point_type(b.maxx(),b.maxy()));
855+#if BOOST_VERSION >= 105600
856+ tree_.query(boost::geometry::index::intersects(box),std::back_inserter(index_array_));
857+#else
858 index_array_ = tree_.find(box);
859+#endif
860 return boost::make_shared<geojson_featureset>(features_, index_array_.begin(), index_array_.end());
861 }
862 // otherwise return an empty featureset pointer
863diff --git a/plugins/input/geojson/geojson_datasource.hpp b/plugins/input/geojson/geojson_datasource.hpp
864index 7cad44b..c02827b 100644
865--- a/plugins/input/geojson/geojson_datasource.hpp
866+++ b/plugins/input/geojson/geojson_datasource.hpp
867@@ -36,11 +36,16 @@
868 // boost
869 #include <boost/optional.hpp>
870 #include <boost/shared_ptr.hpp>
871-#include <boost/geometry/geometries/box.hpp>
872 #include <boost/geometry/geometries/point_xy.hpp>
873-#include <boost/geometry/algorithms/area.hpp>
874+#include <boost/geometry/geometries/box.hpp>
875 #include <boost/geometry/geometries/geometries.hpp>
876+#include <boost/geometry.hpp>
877+#include <boost/version.hpp>
878+#if BOOST_VERSION >= 105600
879+#include <boost/geometry/index/rtree.hpp>
880+#else
881 #include <boost/geometry/extensions/index/rtree/rtree.hpp>
882+#endif
883
884 // stl
885 #include <vector>
886@@ -53,7 +58,14 @@ class geojson_datasource : public mapnik::datasource
887 public:
888 typedef boost::geometry::model::d2::point_xy<double> point_type;
889 typedef boost::geometry::model::box<point_type> box_type;
890+#if BOOST_VERSION >= 105600
891+ typedef std::pair<box_type,std::size_t> item_type;
892+ typedef boost::geometry::index::linear<16,1> linear_type;
893+ typedef boost::geometry::index::rtree<item_type,linear_type> spatial_index_type;
894+#else
895+ typedef std::size_t item_type;
896 typedef boost::geometry::index::rtree<box_type,std::size_t> spatial_index_type;
897+#endif
898
899 // constructor
900 geojson_datasource(mapnik::parameters const& params);
901@@ -74,7 +86,7 @@ class geojson_datasource : public mapnik::datasource
902 boost::shared_ptr<mapnik::transcoder> tr_;
903 std::vector<mapnik::feature_ptr> features_;
904 spatial_index_type tree_;
905- mutable std::deque<std::size_t> index_array_;
906+ mutable std::deque<item_type> index_array_;
907 };
908
909
910diff --git a/plugins/input/geojson/geojson_featureset.cpp b/plugins/input/geojson/geojson_featureset.cpp
911index f6d45a9..93233ec 100644
912--- a/plugins/input/geojson/geojson_featureset.cpp
913+++ b/plugins/input/geojson/geojson_featureset.cpp
914@@ -30,8 +30,8 @@
915 #include "geojson_featureset.hpp"
916
917 geojson_featureset::geojson_featureset(std::vector<mapnik::feature_ptr> const& features,
918- std::deque<std::size_t>::const_iterator index_itr,
919- std::deque<std::size_t>::const_iterator index_end)
920+ array_type::const_iterator index_itr,
921+ array_type::const_iterator index_end)
922 : features_(features),
923 index_itr_(index_itr),
924 index_end_(index_end) {}
925@@ -42,7 +42,12 @@ mapnik::feature_ptr geojson_featureset::next()
926 {
927 if (index_itr_ != index_end_)
928 {
929- std::size_t index = *index_itr_++;
930+#if BOOST_VERSION >= 105600
931+ geojson_datasource::item_type const& item = *index_itr_++;
932+ std::size_t index = item.second;
933+#else
934+ std::size_t const& index = *index_itr_++;
935+#endif
936 if ( index < features_.size())
937 {
938 return features_.at(index);
939diff --git a/plugins/input/geojson/geojson_featureset.hpp b/plugins/input/geojson/geojson_featureset.hpp
940index f8b37d6..fd68e7d 100644
941--- a/plugins/input/geojson/geojson_featureset.hpp
942+++ b/plugins/input/geojson/geojson_featureset.hpp
943@@ -11,17 +11,18 @@
944 class geojson_featureset : public mapnik::Featureset
945 {
946 public:
947+ typedef std::deque<geojson_datasource::item_type> array_type;
948 geojson_featureset(std::vector<mapnik::feature_ptr> const& features,
949- std::deque<std::size_t>::const_iterator index_itr,
950- std::deque<std::size_t>::const_iterator index_end);
951+ array_type::const_iterator index_itr,
952+ array_type::const_iterator index_end);
953 virtual ~geojson_featureset();
954 mapnik::feature_ptr next();
955
956 private:
957 mapnik::box2d<double> box_;
958 std::vector<mapnik::feature_ptr> const& features_;
959- std::deque<std::size_t>::const_iterator index_itr_;
960- std::deque<std::size_t>::const_iterator index_end_;
961+ array_type::const_iterator index_itr_;
962+ array_type::const_iterator index_end_;
963 };
964
965 #endif // GEOJSON_FEATURESET_HPP
966diff --git a/src/save_map.cpp b/src/save_map.cpp
967index edfa029..bee0cc8 100644
968--- a/src/save_map.cpp
969+++ b/src/save_map.cpp
970@@ -42,6 +42,7 @@
971 // boost
972 #include <boost/algorithm/string.hpp>
973 #include <boost/optional.hpp>
974+#include <boost/version.hpp>
975 #include <boost/property_tree/ptree.hpp>
976 #include <boost/property_tree/xml_parser.hpp>
977
978@@ -869,7 +870,11 @@ void save_map(Map const & map, std::string const& filename, bool explicit_defaul
979 {
980 ptree pt;
981 serialize_map(pt,map,explicit_defaults);
982+#if BOOST_VERSION >= 105600
983+ write_xml(filename,pt,std::locale(),boost::property_tree::xml_writer_make_settings<ptree::key_type>(' ',4));
984+#else
985 write_xml(filename,pt,std::locale(),boost::property_tree::xml_writer_make_settings(' ',4));
986+#endif
987 }
988
989 std::string save_map_to_string(Map const & map, bool explicit_defaults)
990@@ -877,7 +882,11 @@ std::string save_map_to_string(Map const & map, bool explicit_defaults)
991 ptree pt;
992 serialize_map(pt,map,explicit_defaults);
993 std::ostringstream ss;
994+#if BOOST_VERSION >= 105600
995+ write_xml(ss,pt,boost::property_tree::xml_writer_make_settings<ptree::key_type>(' ',4));
996+#else
997 write_xml(ss,pt,boost::property_tree::xml_writer_make_settings(' ',4));
998+#endif
999 return ss.str();
1000 }
1001
1002diff --git a/SConstruct b/SConstruct
1003index de9ea89..4bd700e 100644
1004--- a/SConstruct
1005+++ b/SConstruct
1006@@ -1623,6 +1623,15 @@ if not preconfigured:
1007 debug_defines = ['-DDEBUG', '-DMAPNIK_DEBUG']
1008 ndebug_defines = ['-DNDEBUG']
1009
1010+ boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1])
1011+ if boost_version_from_header > 53 or 'c++11' in env['CUSTOM_CXXFLAGS']:
1012+ env.Append(CPPDEFINES = '-DBOOST_SPIRIT_USE_PHOENIX_V3=1')
1013+ # - workaround boost gil channel_algorithm.hpp narrowing error
1014+ # TODO - remove when building against >= 1.55
1015+ # https://github.com/mapnik/mapnik/issues/1970
1016+ if 'clang++' in env['CXX']:
1017+ env.Append(CXXFLAGS = '-Wno-c++11-narrowing')
1018+
1019 # Enable logging in debug mode (always) and release mode (when specified)
1020 if env['DEFAULT_LOG_SEVERITY']:
1021 if env['DEFAULT_LOG_SEVERITY'] not in severities:
1022diff --git a/include/mapnik/marker.hpp b/include/mapnik/marker.hpp
1023index 568f565..9c8c0e4 100644
1024--- a/include/mapnik/marker.hpp
1025+++ b/include/mapnik/marker.hpp
1026@@ -124,12 +124,12 @@ class marker: private mapnik::noncopyable
1027
1028 inline bool is_bitmap() const
1029 {
1030- return bitmap_data_;
1031+ return bitmap_data_ ? true : false;
1032 }
1033
1034 inline bool is_vector() const
1035 {
1036- return vector_data_;
1037+ return vector_data_ ? true : false;
1038 }
1039
1040 boost::optional<mapnik::image_ptr> get_bitmap_data() const
This page took 1.647928 seconds and 4 git commands to generate.