+ 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;
*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;
*y += y2;
@ -1526,7 +1527,7 @@ namespace agg
};
//-----------------------------------------------------------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
//-----------------------------------------------------------------------
@ -1538,11 +1539,11 @@ namespace agg
// Example of declarations path_storage with std::vector as a container
//---------------------------------------------------------------------------
//#include <vector>
//namespace agg
//{
// typedef path_base<vertex_stl_storage<std::vector<vertex_d> > > stl_path_storage;
//}
#include <vector>
namespace agg
{
typedef path_base<vertex_stl_storage<std::vector<vertex_d> > > path_storage;
}

View file

@ -71,8 +71,9 @@ namespace mapnik { namespace svg {
using qi::no_case;
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] )
>> coord[move_to_(_1,_a)] // move_to
>> *(-lit(',') >> coord [ line_to_(_1,_a) ] ); // *line_to
@ -127,6 +128,7 @@ namespace mapnik { namespace svg {
// rules
qi::rule<Iterator,SkipType> start;
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> L; // L,l
qi::rule<Iterator,qi::locals<bool>,SkipType> H; // H,h