Merge pull request #2328 from plepe/bug-expr-horizontal-alignment

Bug: TextSymbolizer.horizontal-alignment - always left when using expressions
This commit is contained in:
Dane Springmeyer 2014-08-01 12:56:58 -07:00
commit f284589627
7 changed files with 185 additions and 0 deletions

View file

@ -0,0 +1,145 @@
{
"keys": [
"",
"1",
"2",
"3",
"10",
"4",
"5",
"6",
"11",
"7",
"8",
"9",
"12"
],
"data": {},
"grid": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" !! !! # ## $$ $$ %% %% ",
" !! ! # # $$ $ %% % ",
" ! !! # ## # $ $ $ % % % ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" & & ' '' ' (( ( ) ))) ",
" && & & '' ' ((( ( )))) ",
" && && '' (( (( )) )) ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ** *** + ++ ,,, ,, - -- - ",
" * + + , - - ",
" ** * + ++ ,, , - -- ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map>
<Map background-color="white" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<FontSet name="book">
<Font face-name="DejaVu Sans Book"/>
</FontSet>
<Layer name="layer" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
lat,long,horizontal_alignment,vertical_alignment,dy,text
0.25,-0.35,left,top,0
0.25,-0.12,middle,top,0
0.25, 0.11,right,top,0
0 ,-0.35,left,middle,0
0 ,-0.12,middle,middle,0
0 , 0.11,right,middle,0
-0.25,-0.35,left,bottom,0
-0.25,-0.12,middle,bottom,0
-0.25, 0.11,right,bottom,0
# right column: auto vertical alignment
0.25, 0.35,right,auto,-0.0001
0 , 0.35,middle,auto,0
-0.25, 0.35,left,auto,0.0001
</Parameter>
</Datasource>
</Layer>
<Style name="My Style">
<Rule>
<PointSymbolizer ignore-placement="true"/>
<TextSymbolizer fontset-name="book" size="16" placement="point" dx="0" dy="[dy]" vertical-alignment="[vertical_alignment]" horizontal-alignment="[horizontal_alignment]">XX</TextSymbolizer>
</Rule>
</Style>
</Map>

View file

@ -79,6 +79,7 @@ sizes_many_in_small_range = [(490, 100), (495, 100), (497, 100), (498, 100),
(499, 100), (500, 100), (501, 100), (502, 100), (505, 100), (510, 100)] (499, 100), (500, 100), (501, 100), (502, 100), (505, 100), (510, 100)]
default_text_box = mapnik.Box2d(-0.05, -0.01, 0.95, 0.01) default_text_box = mapnik.Box2d(-0.05, -0.01, 0.95, 0.01)
large_text_box = mapnik.Box2d(-0.5, -0.5, 0.5, 0.5)
merc_z1_bboxes = { merc_z1_bboxes = {
'0,0':mapnik.Box2d(-20037508.342,0,0,20037508.342), # upper left '0,0':mapnik.Box2d(-20037508.342,0,0,20037508.342), # upper left
@ -142,6 +143,7 @@ files = {
'formatting-6': {'bbox':default_text_box}, 'formatting-6': {'bbox':default_text_box},
'formatting-7': {'bbox':default_text_box}, 'formatting-7': {'bbox':default_text_box},
'formatting-8': {'bbox':default_text_box}, 'formatting-8': {'bbox':default_text_box},
'formatting-expr-alignment': {'bbox':large_text_box, 'sizes': [(500, 500)]},
'expressionformat': {'bbox':default_text_box}, 'expressionformat': {'bbox':default_text_box},
'shieldsymbolizer-1': {'sizes': sizes_many_in_small_range,'bbox':default_text_box}, 'shieldsymbolizer-1': {'sizes': sizes_many_in_small_range,'bbox':default_text_box},
'shieldsymbolizer-2': {'sizes': sizes_many_in_small_range,'bbox':default_text_box}, 'shieldsymbolizer-2': {'sizes': sizes_many_in_small_range,'bbox':default_text_box},