diff --git a/include/mapnik/svg/svg_converter.hpp b/include/mapnik/svg/svg_converter.hpp
index 14378b9b7..ddde41d82 100644
--- a/include/mapnik/svg/svg_converter.hpp
+++ b/include/mapnik/svg/svg_converter.hpp
@@ -255,11 +255,13 @@ public:
}
void fill_none()
{
+ cur_attr().fill_none = true;
cur_attr().fill_flag = false;
}
void stroke_none()
{
+ cur_attr().stroke_none = true;
cur_attr().stroke_flag = false;
}
diff --git a/include/mapnik/svg/svg_path_attributes.hpp b/include/mapnik/svg/svg_path_attributes.hpp
index c6ceaf801..29194ba70 100644
--- a/include/mapnik/svg/svg_path_attributes.hpp
+++ b/include/mapnik/svg/svg_path_attributes.hpp
@@ -50,7 +50,9 @@ struct path_attributes
agg::line_join_e line_join;
agg::line_cap_e line_cap;
bool fill_flag;
+ bool fill_none;
bool stroke_flag;
+ bool stroke_none;
bool even_odd_flag;
bool visibility_flag;
bool display_flag;
@@ -71,7 +73,9 @@ struct path_attributes
line_join(agg::miter_join),
line_cap(agg::butt_cap),
fill_flag(true),
+ fill_none(false),
stroke_flag(false),
+ stroke_none(false),
even_odd_flag(false),
visibility_flag(true),
display_flag(true)
@@ -94,7 +98,9 @@ struct path_attributes
line_join(attr.line_join),
line_cap(attr.line_cap),
fill_flag(attr.fill_flag),
+ fill_none(attr.fill_none),
stroke_flag(attr.stroke_flag),
+ stroke_none(attr.stroke_none),
even_odd_flag(attr.even_odd_flag),
visibility_flag(attr.visibility_flag),
display_flag(attr.display_flag)
@@ -115,7 +121,9 @@ struct path_attributes
line_join(attr.line_join),
line_cap(attr.line_cap),
fill_flag(attr.fill_flag),
+ fill_none(attr.fill_none),
stroke_flag(attr.stroke_flag),
+ stroke_none(attr.stroke_none),
even_odd_flag(attr.even_odd_flag),
visibility_flag(attr.visibility_flag),
display_flag(attr.display_flag)
diff --git a/src/marker_helpers.cpp b/src/marker_helpers.cpp
index 8273acf39..d1f7cc2bb 100644
--- a/src/marker_helpers.cpp
+++ b/src/marker_helpers.cpp
@@ -76,41 +76,50 @@ bool push_explicit_style(svg_attribute_type const& src,
bool success = false;
for(unsigned i = 0; i < src.size(); ++i)
{
- success = true;
dst.push_back(src[i]);
mapnik::svg::path_attributes & attr = dst.last();
- if (stroke_width)
+ if (!attr.visibility_flag)
+ continue;
+ success = true;
+
+ if (!attr.stroke_none)
{
- attr.stroke_width = *stroke_width;
- attr.stroke_flag = true;
+ if (stroke_width)
+ {
+ attr.stroke_width = *stroke_width;
+ attr.stroke_flag = true;
+ }
+ if (stroke_color)
+ {
+ color const& s_color = *stroke_color;
+ attr.stroke_color = agg::rgba(s_color.red()/255.0,
+ s_color.green()/255.0,
+ s_color.blue()/255.0,
+ s_color.alpha()/255.0);
+ attr.stroke_flag = true;
+ }
+ if (stroke_opacity)
+ {
+ attr.stroke_opacity = *stroke_opacity;
+ attr.stroke_flag = true;
+ }
}
- if (stroke_color)
+ if (!attr.fill_none)
{
- color const& s_color = *stroke_color;
- attr.stroke_color = agg::rgba(s_color.red()/255.0,
- s_color.green()/255.0,
- s_color.blue()/255.0,
- s_color.alpha()/255.0);
- attr.stroke_flag = true;
- }
- if (stroke_opacity)
- {
- attr.stroke_opacity = *stroke_opacity;
- attr.stroke_flag = true;
- }
- if (fill_color)
- {
- color const& f_color = *fill_color;
- attr.fill_color = agg::rgba(f_color.red()/255.0,
- f_color.green()/255.0,
- f_color.blue()/255.0,
- f_color.alpha()/255.0);
- attr.fill_flag = true;
- }
- if (fill_opacity)
- {
- attr.fill_opacity = *fill_opacity;
- attr.fill_flag = true;
+ if (fill_color)
+ {
+ color const& f_color = *fill_color;
+ attr.fill_color = agg::rgba(f_color.red()/255.0,
+ f_color.green()/255.0,
+ f_color.blue()/255.0,
+ f_color.alpha()/255.0);
+ attr.fill_flag = true;
+ }
+ if (fill_opacity)
+ {
+ attr.fill_opacity = *fill_opacity;
+ attr.fill_flag = true;
+ }
}
}
return success;
diff --git a/tests/data/svg/rect-no-fill.svg b/tests/data/svg/rect-no-fill.svg
new file mode 100644
index 000000000..d4b32c644
--- /dev/null
+++ b/tests/data/svg/rect-no-fill.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/data/svg/rect-no-stroke.svg b/tests/data/svg/rect-no-stroke.svg
new file mode 100644
index 000000000..06d034275
--- /dev/null
+++ b/tests/data/svg/rect-no-stroke.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/visual_tests/grids/marker-on-line-svg-with-box-600-400-1.0-grid-reference.json b/tests/visual_tests/grids/marker-on-line-svg-with-box-600-400-1.0-grid-reference.json
index 9528a7dac..40618aff4 100644
--- a/tests/visual_tests/grids/marker-on-line-svg-with-box-600-400-1.0-grid-reference.json
+++ b/tests/visual_tests/grids/marker-on-line-svg-with-box-600-400-1.0-grid-reference.json
@@ -69,40 +69,40 @@
" ",
" ",
" ",
- " !!!!!! ",
- " !!!!!!!!!!! !",
- " !!! !!!!!! !!!!! ",
- " !! !!!!!! !!!!! !!!!! ",
- " ! !!!!! !!!!!!!!!!!! !!!!! ",
- " !!!!! !!!!!!!!!!!! !!!!! ! ",
- " !!!!! !!!!! !!!!!! !!!!! !! ",
- " !!!! !!!!! !!!!!! !!!!! !!! ",
- " !!! !!!!! !!!!! !!!!!! !!!! ",
- " ! !!!!!! !!!!!!!!!!!! !!!!! ",
- " !!!!!! !!!!!!!!!!! !!!!!! ",
- " !!!!!!!!!!!! !!!!! !!!!!! ! ",
- " !!!! !!!!!! !!!!! !!!!! !!! ",
- " !!! !!!!!! !!!!! !!!!! !!!! ",
- " !! !!!!! !!!!!! !!!!! !!!!! ",
- " ! !!!!! !!!!!!!!!!!! !!!!! ",
- " !!!!! !!!!! !!!!!! !!!!! ! ",
- " !!!!! !!!!! !!!!!! !!!!! !! ",
- " !!!! !!!!! !!!!! !!!!!! !!! ",
- " !!!!!!!!! !!!!! !!!!!! !!!! ",
- " ! !!!!!! !!!!!!!!!!! !!!!!! ",
- " !!!!!! !!!!!!!!!!! !!!!!! ",
- " !!!!! !!!!!! !!!!! !!!!! !! ",
- " !!!! !!!!!! !!!!! !!!!! !!! ",
- " !!! !!!!! !!!!!! !!!!! !!!! ",
- " !! !!!!! !!!!!! !!!!! !!!!! ",
- " ! !!!!! !!!!!!!!!!!! !!!!! ",
- " !!!!! !!!!! !!!!!! !!!!! ! ",
- " !!!!! !!!!! !!!!! !!!!!! !! ",
- "!!!!!! !!!!! !!!!!! !!! ",
- " !!!!! !!!!! !!!!! ",
- "!!!!!! !!!!!! ",
- " !!!!! ! ",
- " !! ",
+ " !!! ",
+ " !!! !!!! !",
+ " ! !!!! !!!!! ",
+ " !!! !!!!! !! ",
+ " !!! !!!!!!!!!! ",
+ " !!! !!!!!!!!!! ! ",
+ " !!! !!! !!!! !!! ",
+ " !! !!!! !!!! !!! ",
+ " !!! !!!! !! ",
+ " !!! !!!!!! !!! ",
+ " !!! !!!!!!!!! ! ",
+ " !!! !!!! !!!! !! ",
+ " !! !!!! !!!!! !! ",
+ " ! !!!! !!!!! !! ",
+ " !!! !!!!! !! ",
+ " !!! !!!!!!!!!! ",
+ " !!! !!!! !!!! !! ",
+ " !!! !!!! !!!! !! ",
+ " !! !!!! !!!!! !! ",
+ " !!! !!!!! !! ",
+ " !!! !!!!!! !!! ",
+ " !!! !!!!!!!!! ! ",
+ " !!! !!!! !!!! !! ",
+ " !! !!!!! !!!!! !! ",
+ " ! !!!! !!!!! !!! ",
+ " !!! !!!!! !!! ",
+ " !!! !!!!!!!!!! ",
+ " !!! !!!! !!!! !! ",
+ " !!! !!!! !!!!! !! ",
+ " !!!! !!!!! !! ",
+ " !!!!! !! ",
+ "!!!!! ",
+ " ! ",
+ " ",
" ",
" "
]
diff --git a/tests/visual_tests/grids/marker-on-line-svg-with-box-600-400-2.0-grid-reference.json b/tests/visual_tests/grids/marker-on-line-svg-with-box-600-400-2.0-grid-reference.json
index 8785b859c..f71a076f3 100644
--- a/tests/visual_tests/grids/marker-on-line-svg-with-box-600-400-2.0-grid-reference.json
+++ b/tests/visual_tests/grids/marker-on-line-svg-with-box-600-400-2.0-grid-reference.json
@@ -66,44 +66,44 @@
" ",
" ",
" ",
- " ! ",
- " !!!!!!! ",
- " !!!!!!!!!!! ",
- " !!!! !!!!!!!!!! ",
- " !!!!!!!!! !!!!!!!!!! !",
- " !! !!!!!!!!!!! !!!!!!!!!! ",
- " !!!!!!! !!!!!!!!!!! !!!!!!!!!!! ",
- " !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!! ",
- " !!!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! ",
- " !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! ",
- " !! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!!! ",
- " !!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!!!!!!! !!!! ",
- " !!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! ",
- " !!!!! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!! ",
- " !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! ! ",
- " !!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!!!!! ",
- " !!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!!!! !!! ",
- " ! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! ",
- " !!!!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!! ",
- " !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!! ",
- " !!! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!! ",
- " !!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!!!!!!! !!! ",
- " ! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! ",
- " !!!!!! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!! ",
- " !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!! ",
- " !!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!!!! ",
- " !!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!!!! !! ",
- " !! !!!!!!!!!! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!! ",
- " !!!!!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!! ",
- " !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!! ",
- " !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!! ",
- " !!!!!!!!!! !!!!!!!!!! !!!!!!!!!!! !! ",
- " !!!!!!!!!!! !!!!!!!!!! !!!!!!!!! ",
- " !!!!!!!!!!! !!!!!!!!!!! !!!! ",
- "! !!!!!!!!!! !!!!!!!!!!! ",
- " !!!!!!!!!! !!!!!!! ",
- " !!!!!!!!!! ! ",
- " !!!!!!!!! ",
- " !!!! "
+ " ",
+ " !!! ",
+ " !!!!!! ",
+ " !!!!! ",
+ " !!!!!! !!!!!!! !",
+ " !!!!!! !!!!!!!!! ",
+ " !!! !!!!!!!! !!!!!!!! ",
+ " !!!!!! !!!!!!!!!!! !!!!!!! ",
+ " ! !!!!!!! !!!!!!!!! !!!! ",
+ " !!!!! !!!!!!!! !!!!!!!! !! ",
+ " !!!!!! !!!!!!!!! !!!! ",
+ " !!!! !!!!!!! !!!!!!! !!!! ",
+ " !!!!!! !!!!!!!!!! !! !!!! ",
+ " ! !!!!!!!! !!!!!!!!! !!!!! ",
+ " !!!!!! !!!!!!!! !!!!!!!! ! ",
+ " !!!!! !!!!!!!!! !!!!! ",
+ " !!!! !!!!!!! !!!!!!! !!!! ",
+ " !!!!! !!!!!!!!!! ! !!!! ",
+ " !! !!!!!!! !!!!!!!!! !!!! ",
+ " !!!!!! !!!!!!!! !!!!!!!!! ",
+ " !!!!!! !!!!!!!!!! !!!! ",
+ " !!!!! !!!!!!! !!!!!! !!! ",
+ " !!!!!! !!!!!!!!!! !!!! ",
+ " !! !!!!!!!! !!!!!!!!! !!!!! ",
+ " !!!!!! !!!!!!!! !!!!!!!!! ",
+ " !!!!! !!!!!!!!! !!!!! ",
+ " !!!!! !!!!!!! !!!!!! !!! ",
+ " !!!!!! !!!!!!!!! !!!! ",
+ " !!! !!!!!!!! !!!!!!!! !!!! ",
+ " !!!!!! !!!!!!!!!!! !!!!!!! ",
+ " !!!!!! !!!!!!!!!! !!!! ",
+ " !!!!!!! !!!!!!! !! ",
+ " !!!!!!!!!! !!!!! ",
+ " !!!!!!!! !!!!! ",
+ "! !! !!! ",
+ " !!!!! ",
+ " ! ",
+ " ",
+ " "
]
}
\ No newline at end of file
diff --git a/tests/visual_tests/grids/marker-svg-500-100-1.0-grid-reference.json b/tests/visual_tests/grids/marker-svg-500-100-1.0-grid-reference.json
new file mode 100644
index 000000000..dbc0b5f97
--- /dev/null
+++ b/tests/visual_tests/grids/marker-svg-500-100-1.0-grid-reference.json
@@ -0,0 +1,37 @@
+{
+ "keys": [
+ "",
+ "4",
+ "3",
+ "2",
+ "1"
+ ],
+ "data": {},
+ "grid": [
+ " ",
+ " ",
+ " ",
+ " !!!!! ",
+ " !!!!! ",
+ " !!!!! ",
+ " !!!!! ",
+ " !!!!! ",
+ " #### ",
+ " #### ",
+ " #### ",
+ " #### ",
+ " ",
+ " ",
+ " $$$ ",
+ " $$$ ",
+ " $$$ ",
+ " ",
+ " %%%% ",
+ " %%%% ",
+ " %%%% ",
+ " %%%% ",
+ " ",
+ " ",
+ " "
+ ]
+}
\ No newline at end of file
diff --git a/tests/visual_tests/grids/marker-svg-500-100-2.0-grid-reference.json b/tests/visual_tests/grids/marker-svg-500-100-2.0-grid-reference.json
new file mode 100644
index 000000000..8f06b3cd2
--- /dev/null
+++ b/tests/visual_tests/grids/marker-svg-500-100-2.0-grid-reference.json
@@ -0,0 +1,35 @@
+{
+ "keys": [
+ "",
+ "3",
+ "1"
+ ],
+ "data": {},
+ "grid": [
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " !!!!!!! ",
+ " !!!!!!! ",
+ " !!!!!!! ",
+ " !!!!!!! ",
+ " !!!!!!! ",
+ " !!!!!!! ",
+ " !!!!!!! ",
+ " ",
+ " ",
+ " ",
+ " ####### ",
+ " ####### ",
+ " ####### ",
+ " ####### ",
+ " ####### ",
+ " ####### ",
+ " ####### ",
+ " "
+ ]
+}
\ No newline at end of file
diff --git a/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-1.0-agg-reference.png b/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-1.0-agg-reference.png
index 0f77bda96..de22a5c3a 100644
Binary files a/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-1.0-agg-reference.png and b/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-1.0-agg-reference.png differ
diff --git a/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-1.0-cairo-reference.png b/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-1.0-cairo-reference.png
index 8f735c74b..4645618b6 100644
Binary files a/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-1.0-cairo-reference.png and b/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-1.0-cairo-reference.png differ
diff --git a/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-2.0-agg-reference.png b/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-2.0-agg-reference.png
index 618638605..6e0335885 100644
Binary files a/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-2.0-agg-reference.png and b/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-2.0-agg-reference.png differ
diff --git a/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-2.0-cairo-reference.png b/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-2.0-cairo-reference.png
index 0e8bdf250..1f85d5d28 100644
Binary files a/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-2.0-cairo-reference.png and b/tests/visual_tests/images/marker-on-line-svg-with-box-600-400-2.0-cairo-reference.png differ
diff --git a/tests/visual_tests/images/marker-svg-500-100-1.0-agg-reference.png b/tests/visual_tests/images/marker-svg-500-100-1.0-agg-reference.png
new file mode 100644
index 000000000..99881f230
Binary files /dev/null and b/tests/visual_tests/images/marker-svg-500-100-1.0-agg-reference.png differ
diff --git a/tests/visual_tests/images/marker-svg-500-100-1.0-cairo-reference.png b/tests/visual_tests/images/marker-svg-500-100-1.0-cairo-reference.png
new file mode 100644
index 000000000..b182681ed
Binary files /dev/null and b/tests/visual_tests/images/marker-svg-500-100-1.0-cairo-reference.png differ
diff --git a/tests/visual_tests/images/marker-svg-500-100-2.0-agg-reference.png b/tests/visual_tests/images/marker-svg-500-100-2.0-agg-reference.png
new file mode 100644
index 000000000..93084a3b4
Binary files /dev/null and b/tests/visual_tests/images/marker-svg-500-100-2.0-agg-reference.png differ
diff --git a/tests/visual_tests/images/marker-svg-500-100-2.0-cairo-reference.png b/tests/visual_tests/images/marker-svg-500-100-2.0-cairo-reference.png
new file mode 100644
index 000000000..1a6f86f32
Binary files /dev/null and b/tests/visual_tests/images/marker-svg-500-100-2.0-cairo-reference.png differ
diff --git a/tests/visual_tests/images/marker-svg-opacity-500-100-1.0-agg-reference.png b/tests/visual_tests/images/marker-svg-opacity-500-100-1.0-agg-reference.png
index 862c53805..fe9571114 100644
Binary files a/tests/visual_tests/images/marker-svg-opacity-500-100-1.0-agg-reference.png and b/tests/visual_tests/images/marker-svg-opacity-500-100-1.0-agg-reference.png differ
diff --git a/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-agg-reference.png b/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-agg-reference.png
index 85974b5df..88f7e6064 100644
Binary files a/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-agg-reference.png and b/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-agg-reference.png differ
diff --git a/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-cairo-reference.png b/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-cairo-reference.png
index d07cc768b..c428279c7 100644
Binary files a/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-cairo-reference.png and b/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-cairo-reference.png differ
diff --git a/tests/visual_tests/styles/marker-svg.xml b/tests/visual_tests/styles/marker-svg.xml
new file mode 100644
index 000000000..a2252a0c1
--- /dev/null
+++ b/tests/visual_tests/styles/marker-svg.xml
@@ -0,0 +1,58 @@
+
\ No newline at end of file