Merge pull request #2632 from mapnik/better-svg-marker-overrides
Amend/partially revert #2609
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
10
tests/data/svg/rect-no-fill.svg
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
|
||||
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<!-- no fill is default black in SVG spec and stroke is default not showing unless a width is provided -->
|
||||
<rect width="15" height="15" style="stroke-width:100" />
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 393 B |
10
tests/data/svg/rect-no-stroke.svg
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
|
||||
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<!-- no fill is default black in SVG spec and stroke is default not showing unless a width is provided -->
|
||||
<rect width="15" height="15" style="fill:green;stroke-opacity:0" />
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 404 B |
|
@ -69,40 +69,40 @@
|
|||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" !!!!!! ",
|
||||
" !!!!!!!!!!! !",
|
||||
" !!! !!!!!! !!!!! ",
|
||||
" !! !!!!!! !!!!! !!!!! ",
|
||||
" ! !!!!! !!!!!!!!!!!! !!!!! ",
|
||||
" !!!!! !!!!!!!!!!!! !!!!! ! ",
|
||||
" !!!!! !!!!! !!!!!! !!!!! !! ",
|
||||
" !!!! !!!!! !!!!!! !!!!! !!! ",
|
||||
" !!! !!!!! !!!!! !!!!!! !!!! ",
|
||||
" ! !!!!!! !!!!!!!!!!!! !!!!! ",
|
||||
" !!!!!! !!!!!!!!!!! !!!!!! ",
|
||||
" !!!!!!!!!!!! !!!!! !!!!!! ! ",
|
||||
" !!!! !!!!!! !!!!! !!!!! !!! ",
|
||||
" !!! !!!!!! !!!!! !!!!! !!!! ",
|
||||
" !! !!!!! !!!!!! !!!!! !!!!! ",
|
||||
" ! !!!!! !!!!!!!!!!!! !!!!! ",
|
||||
" !!!!! !!!!! !!!!!! !!!!! ! ",
|
||||
" !!!!! !!!!! !!!!!! !!!!! !! ",
|
||||
" !!!! !!!!! !!!!! !!!!!! !!! ",
|
||||
" !!!!!!!!! !!!!! !!!!!! !!!! ",
|
||||
" ! !!!!!! !!!!!!!!!!! !!!!!! ",
|
||||
" !!!!!! !!!!!!!!!!! !!!!!! ",
|
||||
" !!!!! !!!!!! !!!!! !!!!! !! ",
|
||||
" !!!! !!!!!! !!!!! !!!!! !!! ",
|
||||
" !!! !!!!! !!!!!! !!!!! !!!! ",
|
||||
" !! !!!!! !!!!!! !!!!! !!!!! ",
|
||||
" ! !!!!! !!!!!!!!!!!! !!!!! ",
|
||||
" !!!!! !!!!! !!!!!! !!!!! ! ",
|
||||
" !!!!! !!!!! !!!!! !!!!!! !! ",
|
||||
"!!!!!! !!!!! !!!!!! !!! ",
|
||||
" !!!!! !!!!! !!!!! ",
|
||||
"!!!!!! !!!!!! ",
|
||||
" !!!!! ! ",
|
||||
" !! ",
|
||||
" !!! ",
|
||||
" !!! !!!! !",
|
||||
" ! !!!! !!!!! ",
|
||||
" !!! !!!!! !! ",
|
||||
" !!! !!!!!!!!!! ",
|
||||
" !!! !!!!!!!!!! ! ",
|
||||
" !!! !!! !!!! !!! ",
|
||||
" !! !!!! !!!! !!! ",
|
||||
" !!! !!!! !! ",
|
||||
" !!! !!!!!! !!! ",
|
||||
" !!! !!!!!!!!! ! ",
|
||||
" !!! !!!! !!!! !! ",
|
||||
" !! !!!! !!!!! !! ",
|
||||
" ! !!!! !!!!! !! ",
|
||||
" !!! !!!!! !! ",
|
||||
" !!! !!!!!!!!!! ",
|
||||
" !!! !!!! !!!! !! ",
|
||||
" !!! !!!! !!!! !! ",
|
||||
" !! !!!! !!!!! !! ",
|
||||
" !!! !!!!! !! ",
|
||||
" !!! !!!!!! !!! ",
|
||||
" !!! !!!!!!!!! ! ",
|
||||
" !!! !!!! !!!! !! ",
|
||||
" !! !!!!! !!!!! !! ",
|
||||
" ! !!!! !!!!! !!! ",
|
||||
" !!! !!!!! !!! ",
|
||||
" !!! !!!!!!!!!! ",
|
||||
" !!! !!!! !!!! !! ",
|
||||
" !!! !!!! !!!!! !! ",
|
||||
" !!!! !!!!! !! ",
|
||||
" !!!!! !! ",
|
||||
"!!!!! ",
|
||||
" ! ",
|
||||
" ",
|
||||
" ",
|
||||
" "
|
||||
]
|
||||
|
|
|
@ -66,44 +66,44 @@
|
|||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ! ",
|
||||
" !!!!!!! ",
|
||||
" !!!!!!!!!!! ",
|
||||
" !!!! !!!!!!!!!! ",
|
||||
" !!!!!!!!! !!!!!!!!!! !",
|
||||
" !! !!!!!!!!!!! !!!!!!!!!! ",
|
||||
" !!!!!!! !!!!!!!!!!! !!!!!!!!!!! ",
|
||||
" !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!! ",
|
||||
" !!!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! ",
|
||||
" !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! ",
|
||||
" !! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!!! ",
|
||||
" !!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!!!!!!! !!!! ",
|
||||
" !!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! ",
|
||||
" !!!!! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!! ",
|
||||
" !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! ! ",
|
||||
" !!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!!!!! ",
|
||||
" !!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!!!! !!! ",
|
||||
" ! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! ",
|
||||
" !!!!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!! ",
|
||||
" !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!! ",
|
||||
" !!! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!! ",
|
||||
" !!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!!!!!!! !!! ",
|
||||
" ! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! ",
|
||||
" !!!!!! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!! ",
|
||||
" !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!! ",
|
||||
" !!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!!!! ",
|
||||
" !!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!!!!! !! ",
|
||||
" !! !!!!!!!!!! !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!! ",
|
||||
" !!!!!!! !!!!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!! ",
|
||||
" !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!! ",
|
||||
" !!!!!!!!!! !!!!!!!!!!! !!!!!!!!!!! !!!!!!! ",
|
||||
" !!!!!!!!!! !!!!!!!!!! !!!!!!!!!!! !! ",
|
||||
" !!!!!!!!!!! !!!!!!!!!! !!!!!!!!! ",
|
||||
" !!!!!!!!!!! !!!!!!!!!!! !!!! ",
|
||||
"! !!!!!!!!!! !!!!!!!!!!! ",
|
||||
" !!!!!!!!!! !!!!!!! ",
|
||||
" !!!!!!!!!! ! ",
|
||||
" !!!!!!!!! ",
|
||||
" !!!! "
|
||||
" ",
|
||||
" !!! ",
|
||||
" !!!!!! ",
|
||||
" !!!!! ",
|
||||
" !!!!!! !!!!!!! !",
|
||||
" !!!!!! !!!!!!!!! ",
|
||||
" !!! !!!!!!!! !!!!!!!! ",
|
||||
" !!!!!! !!!!!!!!!!! !!!!!!! ",
|
||||
" ! !!!!!!! !!!!!!!!! !!!! ",
|
||||
" !!!!! !!!!!!!! !!!!!!!! !! ",
|
||||
" !!!!!! !!!!!!!!! !!!! ",
|
||||
" !!!! !!!!!!! !!!!!!! !!!! ",
|
||||
" !!!!!! !!!!!!!!!! !! !!!! ",
|
||||
" ! !!!!!!!! !!!!!!!!! !!!!! ",
|
||||
" !!!!!! !!!!!!!! !!!!!!!! ! ",
|
||||
" !!!!! !!!!!!!!! !!!!! ",
|
||||
" !!!! !!!!!!! !!!!!!! !!!! ",
|
||||
" !!!!! !!!!!!!!!! ! !!!! ",
|
||||
" !! !!!!!!! !!!!!!!!! !!!! ",
|
||||
" !!!!!! !!!!!!!! !!!!!!!!! ",
|
||||
" !!!!!! !!!!!!!!!! !!!! ",
|
||||
" !!!!! !!!!!!! !!!!!! !!! ",
|
||||
" !!!!!! !!!!!!!!!! !!!! ",
|
||||
" !! !!!!!!!! !!!!!!!!! !!!!! ",
|
||||
" !!!!!! !!!!!!!! !!!!!!!!! ",
|
||||
" !!!!! !!!!!!!!! !!!!! ",
|
||||
" !!!!! !!!!!!! !!!!!! !!! ",
|
||||
" !!!!!! !!!!!!!!! !!!! ",
|
||||
" !!! !!!!!!!! !!!!!!!! !!!! ",
|
||||
" !!!!!! !!!!!!!!!!! !!!!!!! ",
|
||||
" !!!!!! !!!!!!!!!! !!!! ",
|
||||
" !!!!!!! !!!!!!! !! ",
|
||||
" !!!!!!!!!! !!!!! ",
|
||||
" !!!!!!!! !!!!! ",
|
||||
"! !! !!! ",
|
||||
" !!!!! ",
|
||||
" ! ",
|
||||
" ",
|
||||
" "
|
||||
]
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"keys": [
|
||||
"",
|
||||
"4",
|
||||
"3",
|
||||
"2",
|
||||
"1"
|
||||
],
|
||||
"data": {},
|
||||
"grid": [
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" !!!!! ",
|
||||
" !!!!! ",
|
||||
" !!!!! ",
|
||||
" !!!!! ",
|
||||
" !!!!! ",
|
||||
" #### ",
|
||||
" #### ",
|
||||
" #### ",
|
||||
" #### ",
|
||||
" ",
|
||||
" ",
|
||||
" $$$ ",
|
||||
" $$$ ",
|
||||
" $$$ ",
|
||||
" ",
|
||||
" %%%% ",
|
||||
" %%%% ",
|
||||
" %%%% ",
|
||||
" %%%% ",
|
||||
" ",
|
||||
" ",
|
||||
" "
|
||||
]
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"keys": [
|
||||
"",
|
||||
"3",
|
||||
"1"
|
||||
],
|
||||
"data": {},
|
||||
"grid": [
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" !!!!!!! ",
|
||||
" !!!!!!! ",
|
||||
" !!!!!!! ",
|
||||
" !!!!!!! ",
|
||||
" !!!!!!! ",
|
||||
" !!!!!!! ",
|
||||
" !!!!!!! ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ####### ",
|
||||
" ####### ",
|
||||
" ####### ",
|
||||
" ####### ",
|
||||
" ####### ",
|
||||
" ####### ",
|
||||
" ####### ",
|
||||
" "
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 275 B |
After Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 243 B |
After Width: | Height: | Size: 293 B |
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 317 B |
58
tests/visual_tests/styles/marker-svg.xml
Normal file
|
@ -0,0 +1,58 @@
|
|||
<Map srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
|
||||
|
||||
<Style name="ellipse">
|
||||
<Rule>
|
||||
<Filter>[id]=1</Filter>
|
||||
<MarkersSymbolizer file="../../data/svg/rect-no-fill.svg" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[id]=2</Filter>
|
||||
<MarkersSymbolizer fill-opacity=".5" file="../../data/svg/rect2.svg" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[id]=3</Filter>
|
||||
<MarkersSymbolizer file="../../data/svg/rect-no-stroke.svg" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[id]=4</Filter>
|
||||
<MarkersSymbolizer stroke-width="2" stroke-opacity=".5" file="../../data/svg/rect-no-stroke.svg" />
|
||||
</Rule>
|
||||
</Style>
|
||||
|
||||
<Layer name="layer" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
|
||||
<StyleName>ellipse</StyleName>
|
||||
<Datasource>
|
||||
<Parameter name="type">csv</Parameter>
|
||||
<Parameter name="inline">
|
||||
x,y,id
|
||||
1,1,1
|
||||
2,2,2
|
||||
3,3,3
|
||||
4,4,4
|
||||
</Parameter>
|
||||
</Datasource>
|
||||
</Layer>
|
||||
|
||||
<!-- points to frame data view -->
|
||||
|
||||
<Style name="frame">
|
||||
<Rule>
|
||||
<PointSymbolizer />
|
||||
</Rule>
|
||||
</Style>
|
||||
|
||||
<Layer name="frame" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
|
||||
<StyleName>frame</StyleName>
|
||||
<Datasource>
|
||||
<Parameter name="type">csv</Parameter>
|
||||
<Parameter name="inline">
|
||||
x,y
|
||||
0,0
|
||||
5,0
|
||||
0,5
|
||||
5,5
|
||||
</Parameter>
|
||||
</Datasource>
|
||||
</Layer>
|
||||
|
||||
</Map>
|