Merge pull request #2490 from MapQuest/group-margin

Use margin attribute in group symbolizer
This commit is contained in:
Dane Springmeyer 2014-10-03 12:19:02 -07:00
commit b09df2fa13
10 changed files with 239 additions and 3 deletions

View file

@ -164,9 +164,9 @@ bool group_symbolizer_helper::collision(box2d<double> const& box, value_unicode_
!query_extent_.contains(box + (scale_factor_ * placement_->properties.minimum_padding)))
||
(!placement_->properties.allow_overlap &&
((repeat_key.length() == 0 && !detector_.has_placement(box, placement_->properties.minimum_distance * scale_factor_))
((repeat_key.length() == 0 && !detector_.has_placement(box, placement_->properties.margin * scale_factor_))
||
(repeat_key.length() > 0 && !detector_.has_placement(box, placement_->properties.minimum_distance * scale_factor_,
(repeat_key.length() > 0 && !detector_.has_placement(box, placement_->properties.margin * scale_factor_,
repeat_key, placement_->properties.repeat_distance * scale_factor_))))
)
{

View file

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

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -35,7 +35,7 @@ lat,long,name1,ref1,name2,ref2
<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%]">
<GroupSymbolizer start-column="1" num-columns="2" placement="point" avoid-edges="false">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>

View file

@ -0,0 +1,87 @@
<?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
0.2,-0.35
0.2,0.35
</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,margin
0,-0.35,One,1,Two,2,0
0,0.35,One,1,Two,2,30
</Parameter>
</Datasource>
</Layer>
<Style name="grouped">
<Rule>
<GroupSymbolizer start-column="1" num-columns="2" placement="point" avoid-edges="false" margin="[margin]">
<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="frame" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>frame</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
lat,long,nr
-0.5,-1,0
-0.5,1,1
0.5,-1,2
0.5,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
0,-0.35
0,0.35
</Parameter>
</Datasource>
</Layer>
<Style name="center">
<Rule>
<PointSymbolizer allow-overlap="true" ignore-placement="true" file="../../data/raster/white-alpha.png"/>
<DebugSymbolizer />
</Rule>
</Style>
</Map>

View file

@ -267,6 +267,7 @@ files = {
'polygon-winding-order': {'sizes':[(300,300)]},
'group-symbolizer-1':{'sizes':[(512,512)]},
'group-symbolizer-2':{'sizes':[(512,512)]},
'group-symbolizer-3':{'sizes':[(512,256)]},
'group-symbolizer-line-1':{'sizes':[(512,512)]},
'group-symbolizer-line-2':{'sizes':[(512,512)]},
'text-charplacement':{'sizes':[(512,512)]},