From 40047e7a564d03f75df3fae3814a8db7feec3f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20L=C3=B3pez?= Date: Sat, 5 Feb 2011 07:08:01 +0000 Subject: [PATCH] SVG_RENDERER working again after changes introduced in r2302. + a boost::iterator is used to handle iteration in path grammar + svg_path_data_grammar consumes a reference to geometry, rather than a geometry, avoiding copy-construction + a size_type was added to geometry so it could model the attribute container concept --- SConstruct | 2 +- include/mapnik/feature_style_processor.hpp | 8 ++--- include/mapnik/geometry.hpp | 1 + include/mapnik/geometry_iterator.hpp | 6 ++++ include/mapnik/svg/svg_output_grammars.hpp | 41 ++++------------------ 5 files changed, 18 insertions(+), 40 deletions(-) diff --git a/SConstruct b/SConstruct index a61152c92..8e61f8985 100644 --- a/SConstruct +++ b/SConstruct @@ -329,7 +329,7 @@ opts.AddVariables( # Variables affecting rendering back-ends BoolVariable('INTERNAL_LIBAGG', 'Use provided libagg', 'True'), - BoolVariable('SVG_RENDERER', 'build support for native svg renderer', 'False'), + BoolVariable('SVG_RENDERER', 'build support for native svg renderer', 'True'), # Variables for optional dependencies ('GEOS_CONFIG', 'The path to the geos-config executable.', 'geos-config'), diff --git a/include/mapnik/feature_style_processor.hpp b/include/mapnik/feature_style_processor.hpp index 2bf153ebc..f216135c6 100644 --- a/include/mapnik/feature_style_processor.hpp +++ b/include/mapnik/feature_style_processor.hpp @@ -313,9 +313,9 @@ private: // if the underlying renderer is not able to process the complete set of symbolizers, // process one by one. -#ifdef SVG_RENDERER +//#ifdef SVG_RENDERER if(!p.process(symbols,*feature,prj_trans)) -#endif +//#endif { BOOST_FOREACH (symbolizer const& sym, symbols) @@ -337,9 +337,9 @@ private: rule::symbolizers const& symbols = r->get_symbolizers(); // if the underlying renderer is not able to process the complete set of symbolizers, // process one by one. -#ifdef SVG_RENDERER +//#ifdef SVG_RENDERER if(!p.process(symbols,*feature,prj_trans)) -#endif +//#endif { BOOST_FOREACH (symbolizer const& sym, symbols) { diff --git a/include/mapnik/geometry.hpp b/include/mapnik/geometry.hpp index 5aff4e3e9..293215354 100644 --- a/include/mapnik/geometry.hpp +++ b/include/mapnik/geometry.hpp @@ -48,6 +48,7 @@ class geometry { public: typedef T vertex_type; + typedef std::size_t size_type; typedef typename vertex_type::type value_type; typedef Container container_type; private: diff --git a/include/mapnik/geometry_iterator.hpp b/include/mapnik/geometry_iterator.hpp index c3a711985..29a2d2d7c 100644 --- a/include/mapnik/geometry_iterator.hpp +++ b/include/mapnik/geometry_iterator.hpp @@ -90,6 +90,12 @@ private: } } + template + bool equal(geometry_iterator const& other) const + { + return this->base_reference() == other.base(); + } + Container const& geometry_; boost::shared_ptr first_value_; }; diff --git a/include/mapnik/svg/svg_output_grammars.hpp b/include/mapnik/svg/svg_output_grammars.hpp index 1c6c0f1a1..d25295ea8 100644 --- a/include/mapnik/svg/svg_output_grammars.hpp +++ b/include/mapnik/svg/svg_output_grammars.hpp @@ -32,6 +32,7 @@ // boost #include +#include #include #include #include @@ -42,34 +43,6 @@ // std #include -/*! - * mapnik::vertex2d is adapted as a fusion sequence in order to - * be used directly by the svg_path_data_grammar (below). - * - * The resulting sequence is as follows: (cmd, x, y, x, y). - * Notice that x and y are listed twice; this is because the current - * grammar requires to consume them twice, once to retrieve their - * original value (in map coordinates) and once to generate them - * with their value in user coordinates (after conversion). - */ -/*BOOST_FUSION_ADAPT_STRUCT( - mapnik::vertex2d, - (unsigned, cmd) - (double, x) - (double, y) - (double, x) - (double, y) - )*/ -/*BOOST_FUSION_ADAPT_STRUCT( - mapnik::geometry_iterator::value_type, - (unsigned, get<2>()) - (mapnik::geometry_iterator::container_type::value_type, get<0>()) - (mapnik::geometry_iterator::container_type::value_type, get<1>()) - (mapnik::geometry_iterator::container_type::value_type, get<0>()) - (mapnik::geometry_iterator::container_type::value_type, get<1>()) -) -*/ - /*! * mapnik::svg::path_output_attributes is adapted as a fusion sequence * in order to be used directly by the svg_path_attributes_grammar (below). @@ -207,13 +180,11 @@ namespace mapnik { namespace svg { }; template - struct svg_path_data_grammar : karma::grammar + struct svg_path_data_grammar : karma::grammar { typedef path_coordinate_transformer coordinate_transformer; - //typedef mapnik::vertex_vector2::vertex_type vertex_type; typedef mapnik::geometry_iterator_type::value_type vertex_type; - //typedef mapnik::vertex_vector2::value_type vertex_component_type; - typedef mapnik::geometry_type::value_type vertex_component_type; + typedef mapnik::geometry_type::value_type& vertex_component_type; explicit svg_path_data_grammar(PathType const& path_type) : svg_path_data_grammar::base_type(svg_path), @@ -235,8 +206,8 @@ namespace mapnik { namespace svg { path_vertex = path_vertex_command - << omit[path_vertex_component_x] - << omit[path_vertex_component_y] + << omit[path_vertex_component_x] + << omit[path_vertex_component_y] << path_vertex_transformed_x << lit(' ') << path_vertex_transformed_y; @@ -252,7 +223,7 @@ namespace mapnik { namespace svg { path_vertex_transformed_y = double_[_1 = _a][bind(&coordinate_transformer::current_y, &ct_, _a)]; } - karma::rule svg_path; + karma::rule svg_path; karma::rule path_vertex; karma::rule path_vertex_command; karma::rule > path_vertex_component_x, path_vertex_component_y;