Merge pull request #2732 from zerebubuth/fix-group-symbolizer-avoid-edges

Fix GroupSymbolizer placement options
This commit is contained in:
Dane Springmeyer 2015-03-19 00:18:05 -07:00
commit 1b9ae043f2
15 changed files with 772 additions and 2 deletions

View file

@ -147,10 +147,10 @@ bool group_symbolizer_helper::collision(box2d<double> const& box, value_unicode_
{
if (!detector_.extent().intersects(box)
||
(text_props_->avoid_edges && !query_extent_.contains(box))
(text_props_->avoid_edges && !dims_.contains(box))
||
(text_props_->minimum_padding > 0 &&
!query_extent_.contains(box + (scale_factor_ * text_props_->minimum_padding)))
!dims_.contains(box + (scale_factor_ * text_props_->minimum_padding)))
||
(!text_props_->allow_overlap &&
((repeat_key.length() == 0 && !detector_.has_placement(box, text_props_->margin * scale_factor_))

View file

@ -0,0 +1,138 @@
{
"keys": [
"",
"1",
"2"
],
"data": {},
"grid": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" !!!!! ###### ",
" !!!!! ###### ",
" !!!!! ###### ",
" !!!!! ###### ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
]
}

View file

@ -0,0 +1,138 @@
{
"keys": [
"",
"1",
"2"
],
"data": {},
"grid": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
]
}

View file

@ -0,0 +1,138 @@
{
"keys": [
"",
"1",
"2"
],
"data": {},
"grid": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" !!!!! ###### ",
" !!!!! ###### ",
" !!!!! ###### ",
" !!!!! ###### ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
]
}

View file

@ -0,0 +1,138 @@
{
"keys": [
"",
"1",
"2"
],
"data": {},
"grid": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" !!!!!!!!!!! ########### ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -0,0 +1,109 @@
<?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">
<Parameters>
<Parameter name="sizes">512,512</Parameter>
</Parameters>
<!-- 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" repeat-key="[key%]">
<PairLayout item-margin="1"/>
<GroupRule>
<ShieldSymbolizer file="../../data/svg/rect.svg" face-name="DejaVu Sans Book" size="10" minimum-distance="1" placement="point" dy="0" fill="#ff0000">[key%]</ShieldSymbolizer>
</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" repeat-distance="20" spacing="1" repeat-key="bar">
<PairLayout item-margin="1"/>
<GroupRule>
<ShieldSymbolizer file="../../data/svg/rect.svg" face-name="DejaVu Sans Book" size="10" placement="point" dy="0" fill="#ffffff">bar</ShieldSymbolizer>
</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="true" repeat-distance="20" spacing="1" repeat-key="foo">
<PairLayout item-margin="1"/>
<GroupRule>
<ShieldSymbolizer file="../../data/svg/rect.svg" face-name="DejaVu Sans Book" size="10" placement="point" dy="0" fill="#000000">foo</ShieldSymbolizer>
</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/>
<DebugSymbolizer/>
</Rule>
</Style>
</Map>

View file

@ -0,0 +1,109 @@
<?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">
<Parameters>
<Parameter name="sizes">512,512</Parameter>
</Parameters>
<!-- 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" repeat-key="[key%]">
<PairLayout item-margin="1"/>
<GroupRule>
<ShieldSymbolizer file="../../data/svg/rect.svg" face-name="DejaVu Sans Book" size="10" minimum-distance="1" placement="point" dy="0" fill="#ff0000">[key%]</ShieldSymbolizer>
</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" repeat-distance="20" spacing="1" repeat-key="bar">
<PairLayout item-margin="1"/>
<GroupRule>
<ShieldSymbolizer file="../../data/svg/rect.svg" face-name="DejaVu Sans Book" size="10" placement="point" dy="0" fill="#ffffff">bar</ShieldSymbolizer>
</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-padding="15" repeat-distance="20" spacing="1" repeat-key="foo">
<PairLayout item-margin="1"/>
<GroupRule>
<ShieldSymbolizer file="../../data/svg/rect.svg" face-name="DejaVu Sans Book" size="10" placement="point" dy="0" fill="#000000">foo</ShieldSymbolizer>
</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/>
<DebugSymbolizer/>
</Rule>
</Style>
</Map>