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
This commit is contained in:
Carlos López 2011-02-05 07:08:01 +00:00
parent a7dd9f0e6b
commit 40047e7a56
5 changed files with 18 additions and 40 deletions

View file

@ -329,7 +329,7 @@ opts.AddVariables(
# Variables affecting rendering back-ends # Variables affecting rendering back-ends
BoolVariable('INTERNAL_LIBAGG', 'Use provided libagg', 'True'), 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 # Variables for optional dependencies
('GEOS_CONFIG', 'The path to the geos-config executable.', 'geos-config'), ('GEOS_CONFIG', 'The path to the geos-config executable.', 'geos-config'),

View file

@ -313,9 +313,9 @@ private:
// if the underlying renderer is not able to process the complete set of symbolizers, // if the underlying renderer is not able to process the complete set of symbolizers,
// process one by one. // process one by one.
#ifdef SVG_RENDERER //#ifdef SVG_RENDERER
if(!p.process(symbols,*feature,prj_trans)) if(!p.process(symbols,*feature,prj_trans))
#endif //#endif
{ {
BOOST_FOREACH (symbolizer const& sym, symbols) BOOST_FOREACH (symbolizer const& sym, symbols)
@ -337,9 +337,9 @@ private:
rule::symbolizers const& symbols = r->get_symbolizers(); rule::symbolizers const& symbols = r->get_symbolizers();
// if the underlying renderer is not able to process the complete set of symbolizers, // if the underlying renderer is not able to process the complete set of symbolizers,
// process one by one. // process one by one.
#ifdef SVG_RENDERER //#ifdef SVG_RENDERER
if(!p.process(symbols,*feature,prj_trans)) if(!p.process(symbols,*feature,prj_trans))
#endif //#endif
{ {
BOOST_FOREACH (symbolizer const& sym, symbols) BOOST_FOREACH (symbolizer const& sym, symbols)
{ {

View file

@ -48,6 +48,7 @@ class geometry
{ {
public: public:
typedef T vertex_type; typedef T vertex_type;
typedef std::size_t size_type;
typedef typename vertex_type::type value_type; typedef typename vertex_type::type value_type;
typedef Container<vertex_type> container_type; typedef Container<vertex_type> container_type;
private: private:

View file

@ -90,6 +90,12 @@ private:
} }
} }
template <typename OtherValue>
bool equal(geometry_iterator<OtherValue, Container> const& other) const
{
return this->base_reference() == other.base();
}
Container const& geometry_; Container const& geometry_;
boost::shared_ptr<Value> first_value_; boost::shared_ptr<Value> first_value_;
}; };

View file

@ -32,6 +32,7 @@
// boost // boost
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>
#include <boost/spirit/include/karma_omit.hpp>
#include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/repository/include/karma_confix.hpp> #include <boost/spirit/repository/include/karma_confix.hpp>
#include <boost/spirit/home/phoenix/bind/bind_member_function.hpp> #include <boost/spirit/home/phoenix/bind/bind_member_function.hpp>
@ -42,34 +43,6 @@
// std // std
#include <iostream> #include <iostream>
/*!
* 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 * mapnik::svg::path_output_attributes is adapted as a fusion sequence
* in order to be used directly by the svg_path_attributes_grammar (below). * in order to be used directly by the svg_path_attributes_grammar (below).
@ -207,13 +180,11 @@ namespace mapnik { namespace svg {
}; };
template <typename OutputIterator, typename PathType> template <typename OutputIterator, typename PathType>
struct svg_path_data_grammar : karma::grammar<OutputIterator, mapnik::geometry_type()> struct svg_path_data_grammar : karma::grammar<OutputIterator, mapnik::geometry_type&()>
{ {
typedef path_coordinate_transformer<PathType> coordinate_transformer; typedef path_coordinate_transformer<PathType> coordinate_transformer;
//typedef mapnik::vertex_vector2<mapnik::vertex2d>::vertex_type vertex_type;
typedef mapnik::geometry_iterator_type::value_type vertex_type; typedef mapnik::geometry_iterator_type::value_type vertex_type;
//typedef mapnik::vertex_vector2<mapnik::vertex2d>::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) explicit svg_path_data_grammar(PathType const& path_type)
: svg_path_data_grammar::base_type(svg_path), : svg_path_data_grammar::base_type(svg_path),
@ -235,8 +206,8 @@ namespace mapnik { namespace svg {
path_vertex = path_vertex =
path_vertex_command path_vertex_command
<< omit[path_vertex_component_x] << omit[path_vertex_component_x]
<< omit[path_vertex_component_y] << omit[path_vertex_component_y]
<< path_vertex_transformed_x << path_vertex_transformed_x
<< lit(' ') << lit(' ')
<< path_vertex_transformed_y; << 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)]; path_vertex_transformed_y = double_[_1 = _a][bind(&coordinate_transformer::current_y, &ct_, _a)];
} }
karma::rule<OutputIterator, mapnik::geometry_type()> svg_path; karma::rule<OutputIterator, mapnik::geometry_type&()> svg_path;
karma::rule<OutputIterator, vertex_type()> path_vertex; karma::rule<OutputIterator, vertex_type()> path_vertex;
karma::rule<OutputIterator, int()> path_vertex_command; karma::rule<OutputIterator, int()> path_vertex_command;
karma::rule<OutputIterator, vertex_component_type(), karma::locals<double> > path_vertex_component_x, path_vertex_component_y; karma::rule<OutputIterator, vertex_component_type(), karma::locals<double> > path_vertex_component_x, path_vertex_component_y;