Added more tests for group symbolizer.

The first test shows how an obstacle under the group being displayed
will cause the whole group to not display. Above is an replica of
the same layout using non-grouped symbolizers, which shows that
only the parts which intersect the obstacle will not be drawn.

The second is a line placement test, which just tests placement
of groups on a line with variable spacing.

The third is a test of repeat key in group symbolizer.
The test shows two items with different repeat keys ("foo" and "bar")
and rows of other group symbolizers sensitive to either one. The
reference images show that the "bar"-sensitive rows are displaced
by the "bar" item, but not the "foo" item.
This commit is contained in:
Matt Amos 2014-01-10 14:48:25 +00:00 committed by Jordan Hollinger
parent 3d1c30db1e
commit f8097748a4
10 changed files with 307 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Without unlock-image -->
<!DOCTYPE Map>
<Map background-color="green" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" minimum-version="2.0.0">
<Layer name="obstacle" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>obstacle</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
lat,long,nr
0.33,0.4,0
-0.33,0.4,1
</Parameter>
</Datasource>
</Layer>
<Style name="obstacle">
<Rule>
<PointSymbolizer/>
</Rule>
</Style>
<Layer name="layer" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>grouped</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
lat,long,name1,ref1,name2,ref2
-0.33,-0.33,One,1,Two,2
-0.33,0.33,One,1,Two,2
</Parameter>
</Datasource>
</Layer>
<Style name="grouped">
<Rule>
<GroupSymbolizer start-column="1" num-columns="2" placement="point" avoid-edges="false" minimum-distance="10" spacing="20" repeat-key="[name%]+'-'+[ref%]">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="10">[name%]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="-10">[ref%]</TextSymbolizer>
</GroupRule>
</GroupSymbolizer>
</Rule>
</Style>
<Layer name="layer" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>non-grouped</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
lat,long,name1,ref1,name2,ref2
0.33,-0.33,One,1,Two,2
0.33,0.33,One,1,Two,2
</Parameter>
</Datasource>
</Layer>
<Style name="non-grouped">
<Rule>
<ShieldSymbolizer face-name="DejaVu Sans Book" dx="-16.25" file="../../data/svg/rect.svg"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dx="-0.25" dy="10">[name1]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dx="-11.25" dy="-10">[ref1]</TextSymbolizer>
<ShieldSymbolizer face-name="DejaVu Sans Book" dx="15" file="../../data/svg/rect.svg"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dx="0.25" dy="10">[name2]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dx="10" dy="-10">[ref2]</TextSymbolizer>
</Rule>
</Style>
<Layer name="layer2" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>frame</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
lat,long,nr
-1,-1,0
-1,1,1
1,-1,2
1,1,3
</Parameter>
</Datasource>
</Layer>
<Style name="frame">
<Rule>
<PointSymbolizer/>
</Rule>
</Style>
<Layer name="layer3" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>center</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
lat,long,nr
-0.33,-0.33,0
0.33,-0.33,1
-0.33,0.33,2
0.33,0.33,3
</Parameter>
</Datasource>
</Layer>
<Style name="center">
<Rule>
<PointSymbolizer allow-overlap="true" ignore-placement="true" file="../../data/raster/white-alpha.png"/>
</Rule>
</Style>
</Map>

View file

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Without unlock-image -->
<!DOCTYPE Map>
<Map background-color="green" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" minimum-version="2.0.0">
<Layer name="alpha" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>alpha</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,name1,ref1,name2,ref2
"LINESTRING(0 0, 10 2)",One,1,Two,2
</Parameter>
</Datasource>
</Layer>
<Style name="alpha">
<Rule>
<LineSymbolizer stroke-width="0.2" stroke="#ff0000"/>
<GroupSymbolizer start-column="1" num-columns="2" placement="line" avoid-edges="false" minimum-distance="50" spacing="100" repeat-key="[name%]+'-'+[ref%]">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="10">[name%]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="0" fill="#ffffff">[ref%]</TextSymbolizer>
</GroupRule>
</GroupSymbolizer>
</Rule>
</Style>
<Layer name="beta" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>beta</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,name1,ref1,name2,ref2
"LINESTRING(0 3, 10 5)",One,1,Two,2
</Parameter>
</Datasource>
</Layer>
<Style name="beta">
<Rule>
<LineSymbolizer stroke-width="0.2" stroke="#ff0000"/>
<GroupSymbolizer start-column="1" num-columns="2" placement="line" avoid-edges="false" minimum-distance="40" spacing="80" repeat-key="[name%]+'-'+[ref%]">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="10">[name%]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="0" fill="#ffffff">[ref%]</TextSymbolizer>
</GroupRule>
</GroupSymbolizer>
</Rule>
</Style>
<Layer name="gamma" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>gamma</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,name1,ref1,name2,ref2
"LINESTRING(0 6, 10 8)",One,1,Two,2
</Parameter>
</Datasource>
</Layer>
<Style name="gamma">
<Rule>
<LineSymbolizer stroke-width="0.2" stroke="#ff0000"/>
<GroupSymbolizer start-column="1" num-columns="2" placement="line" avoid-edges="false" minimum-distance="30" spacing="60" repeat-key="[name%]+'-'+[ref%]">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="10">[name%]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="0" fill="#ffffff">[ref%]</TextSymbolizer>
</GroupRule>
</GroupSymbolizer>
<DebugSymbolizer/>
</Rule>
</Style>
</Map>

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Without unlock-image -->
<!DOCTYPE Map>
<Map background-color="green" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" minimum-version="2.0.0">
<!-- the aim here is to test the "repeat-key" parameter. it is
supposed to stop collidable / placeable items from being
too close, even if they're on different features. -->
<Layer name="alpha" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>alpha</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,key1,key2
"POINT(3.3 0)",foo,1
"POINT(6.7 0)",bar,2
</Parameter>
</Datasource>
</Layer>
<Style name="alpha">
<Rule>
<PointSymbolizer ignore-placement="true"/>
<GroupSymbolizer start-column="1" num-columns="1" placement="point" avoid-edges="false" minimum-distance="1" spacing="1" repeat-key="[key%]">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="10" placement="point" dy="0" fill="#ff0000">[key%]</TextSymbolizer>
</GroupRule>
</GroupSymbolizer>
</Rule>
</Style>
<Layer name="beta" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>beta</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,name1,ref1,name2,ref2
"LINESTRING(0 -0.6, 10 -0.6)",One,1,Two,2
"LINESTRING(0 -1.2, 10 -1.2)",One,1,Two,2
"LINESTRING(0 -1.8, 10 -1.8)",One,1,Two,2
"LINESTRING(0 -2.4, 10 -2.4)",One,1,Two,2
</Parameter>
</Datasource>
</Layer>
<Style name="beta">
<Rule>
<GroupSymbolizer start-column="1" num-columns="1" placement="line" avoid-edges="false" minimum-distance="20" spacing="1" repeat-key="bar">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="10" placement="point" dy="0" fill="#ffffff">bar</TextSymbolizer>
</GroupRule>
</GroupSymbolizer>
</Rule>
</Style>
<Layer name="gamma" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>gamma</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,name1,ref1,name2,ref2
"LINESTRING(0 0.6, 10 0.6)",One,1,Two,2
"LINESTRING(0 1.2, 10 1.2)",One,1,Two,2
"LINESTRING(0 1.8, 10 1.8)",One,1,Two,2
"LINESTRING(0 2.4, 10 2.4)",One,1,Two,2
</Parameter>
</Datasource>
</Layer>
<Style name="gamma">
<Rule>
<GroupSymbolizer start-column="1" num-columns="1" placement="line" avoid-edges="false" minimum-distance="20" spacing="1" repeat-key="foo">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="10" placement="point" dy="0" fill="#000000">foo</TextSymbolizer>
</GroupRule>
</GroupSymbolizer>
</Rule>
</Style>
<!-- for framing -->
<Layer name="frame" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>frame</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,nr
"POINT(0 5)",1
"POINT(0 -5)",2
"POINT(10 5)",3
"POINT(10 -5)",4
</Parameter>
</Datasource>
</Layer>
<Style name="frame">
<Rule>
<PointSymbolizer/>
</Rule>
</Style>
</Map>

View file

@ -219,7 +219,10 @@ files = {
'tiff-nodata-tolerance':{'sizes':[(512,512)]},
'tiff-nodata-edge-rgba':{'sizes':[(512,512)]},
'marker-vs-point':{'sizes':[(512,512)]},
'group-symbolizer-1':{'sizes':[(512,512)]}
'group-symbolizer-1':{'sizes':[(512,512)]},
'group-symbolizer-2':{'sizes':[(512,512)]},
'group-symbolizer-line-1':{'sizes':[(512,512)]},
'group-symbolizer-line-2':{'sizes':[(512,512)]}
}
class Reporting: