+ refactor path grammar to match svg spec close

+ ensure first 'moveto' command is always in
  absolute coordinates
  FIXME:probably better to modify path grammar
        to handle this.
+ vertex_stl_storage
This commit is contained in:
Artem Pavlenko 2010-06-13 20:24:46 +00:00
parent 68522e39fc
commit 03092107b6
2 changed files with 12 additions and 9 deletions

View file

@ -869,7 +869,8 @@ namespace agg
*x += x2; *x += x2;
*y += y2; *y += y2;
} }
else if (is_vertex(m_vertices.prev_vertex(&x2, &y2))) else if (!is_stop(m_vertices.last_command()) &&
is_vertex(m_vertices.prev_vertex(&x2, &y2)))
{ {
*x += x2; *x += x2;
*y += y2; *y += y2;
@ -1526,7 +1527,7 @@ namespace agg
}; };
//-----------------------------------------------------------path_storage //-----------------------------------------------------------path_storage
typedef path_base<vertex_block_storage<double> > path_storage; //typedef path_base<vertex_block_storage<double> > path_storage;
// Example of declarations path_storage with pod_bvector as a container // Example of declarations path_storage with pod_bvector as a container
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
@ -1538,11 +1539,11 @@ namespace agg
// Example of declarations path_storage with std::vector as a container // Example of declarations path_storage with std::vector as a container
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
//#include <vector> #include <vector>
//namespace agg namespace agg
//{ {
// typedef path_base<vertex_stl_storage<std::vector<vertex_d> > > stl_path_storage; typedef path_base<vertex_stl_storage<std::vector<vertex_d> > > path_storage;
//} }

View file

@ -71,7 +71,8 @@ namespace mapnik { namespace svg {
using qi::no_case; using qi::no_case;
start = +cmd; start = +cmd;
cmd = M | L | H | V | C | S | Q | T | A | Z; cmd = M >> *drawto_cmd;
drawto_cmd = L | H | V | C | S | Q | T | A | Z;
M = (lit('M')[_a = false] | lit('m')[_a = true] ) M = (lit('M')[_a = false] | lit('m')[_a = true] )
>> coord[move_to_(_1,_a)] // move_to >> coord[move_to_(_1,_a)] // move_to
@ -127,6 +128,7 @@ namespace mapnik { namespace svg {
// rules // rules
qi::rule<Iterator,SkipType> start; qi::rule<Iterator,SkipType> start;
qi::rule<Iterator,SkipType> cmd; qi::rule<Iterator,SkipType> cmd;
qi::rule<Iterator,SkipType> drawto_cmd;
qi::rule<Iterator,qi::locals<bool>,SkipType> M; // M,m qi::rule<Iterator,qi::locals<bool>,SkipType> M; // M,m
qi::rule<Iterator,qi::locals<bool>,SkipType> L; // L,l qi::rule<Iterator,qi::locals<bool>,SkipType> L; // L,l
qi::rule<Iterator,qi::locals<bool>,SkipType> H; // H,h qi::rule<Iterator,qi::locals<bool>,SkipType> H; // H,h