Permalink
Browse files

+ support 'display' property, if set to 'none' don't parse children #…

…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 57d6d62440ce0193546fb45d3567d9e09b466d67
Showing with 302 additions and 154 deletions.
  1. +15 −3 include/mapnik/svg/svg_converter.hpp
  2. +4 −0 include/mapnik/svg/svg_path_attributes.hpp
  3. +283 −151 src/svg_parser.cpp
@@ -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)
@@ -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
@@ -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;
@@ -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;
@@ -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),
@@ -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),
@@ -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),
Oops, something went wrong.

0 comments on commit 57d6d62

Please sign in to comment.