Skip to content

Commit

Permalink
+ support 'display' property, if set to 'none' don't parse children #…
Browse files Browse the repository at this point in the history
…1137

+ fix memory leak : xmlTextReaderGetAttribute -> string must be deallocated by the caller
+ call xmlTextReaderMoveToElement after xmlTextReaderMoveToFirstAttribute loop to restore
  reader position.

Conflicts:

	src/svg_parser.cpp
  • Loading branch information
artemp committed Apr 11, 2012
1 parent 0cc1dfd commit 57d6d62
Show file tree
Hide file tree
Showing 3 changed files with 302 additions and 154 deletions.
18 changes: 15 additions & 3 deletions include/mapnik/svg/svg_converter.hpp
Expand Up @@ -56,11 +56,10 @@ class svg_converter : boost::noncopyable

void begin_path()
{
push_attr();
unsigned idx = source_.start_new_path();
attributes_.add(path_attributes(cur_attr(), idx));
}

void end_path()
{
if(attributes_.size() == 0)
Expand All @@ -71,7 +70,6 @@ class svg_converter : boost::noncopyable
unsigned idx = attributes_[attributes_.size() - 1].index;
attr.index = idx;
attributes_[attributes_.size() - 1] = attr;
pop_attr();
}

void move_to(double x, double y, bool rel=false) // M, m
Expand Down Expand Up @@ -235,7 +233,21 @@ class svg_converter : boost::noncopyable
cur_attr().visibility_flag = flag;
}

bool visibility()
{
return cur_attr().visibility_flag;
}

void display(bool flag)
{
cur_attr().display_flag = flag;
}

bool display()
{
return cur_attr().display_flag;
}

void stroke_width(double w)
{
cur_attr().stroke_width = w;
Expand Down
4 changes: 4 additions & 0 deletions include/mapnik/svg/svg_path_attributes.hpp
Expand Up @@ -45,6 +45,7 @@ struct path_attributes
bool stroke_flag;
bool even_odd_flag;
bool visibility_flag;
bool display_flag;
agg::line_join_e line_join;
agg::line_cap_e line_cap;
double miter_limit;
Expand All @@ -63,6 +64,7 @@ struct path_attributes
stroke_flag(false),
even_odd_flag(false),
visibility_flag(true),
display_flag(true),
line_join(agg::miter_join),
line_cap(agg::butt_cap),
miter_limit(4.0),
Expand All @@ -83,6 +85,7 @@ struct path_attributes
stroke_flag(attr.stroke_flag),
even_odd_flag(attr.even_odd_flag),
visibility_flag(attr.visibility_flag),
display_flag(attr.display_flag),
line_join(attr.line_join),
line_cap(attr.line_cap),
miter_limit(attr.miter_limit),
Expand All @@ -102,6 +105,7 @@ struct path_attributes
stroke_flag(attr.stroke_flag),
even_odd_flag(attr.even_odd_flag),
visibility_flag(attr.visibility_flag),
display_flag(attr.display_flag),
line_join(attr.line_join),
line_cap(attr.line_cap),
miter_limit(attr.miter_limit),
Expand Down

0 comments on commit 57d6d62

Please sign in to comment.