Skip to content

Commit f57a971

Browse files
Charles Plantedmorissette
authored andcommitted
#5922 - Support rotation of TrueType symbol in UTFGrid
1 parent 8f2de5b commit f57a971

3 files changed

Lines changed: 43 additions & 0 deletions

File tree

maputfgrid.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,16 @@ int utfgridRenderGlyphs(imageObj *img, textPathObj *tp, colorObj *c, colorObj *o
808808
box.line_to((x+size)/r->utfresolution,(y-size)/r->utfresolution);
809809
box.line_to((x)/r->utfresolution,(y-size)/r->utfresolution);
810810

811+
/* Rotation if necessary. */
812+
if( tp->glyphs->rot != 0) {
813+
mapserver::trans_affine mtx;
814+
mtx *= mapserver::trans_affine_translation(-x/r->utfresolution,-y/r->utfresolution);
815+
mtx *= mapserver::trans_affine_rotation(-tp->glyphs->rot);
816+
mtx *= mapserver::trans_affine_translation(x/r->utfresolution,y/r->utfresolution);
817+
box.transform(mtx);
818+
}
819+
820+
811821
/* Rendering the symbol */
812822
utfgridRenderPath(img, box);
813823

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"grid":[" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," !! "," !!!! "," !!!!!! "," !!!!!! "," !!!! "," !! "," "," "," "],"keys":["","1"],"data":{}}

msautotest/renderers/utfgrid_truetype_symbol.map

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# RUN_PARMS: utfgrid_truetype_symbol_labelcache.json [SHP2IMG] -m [MAPFILE] -l symbol-labelcache -i json -o [RESULT]
22
# RUN_PARMS: utfgrid_truetype_symbol_nolabelcache.json [SHP2IMG] -m [MAPFILE] -l symbol-nolabelcache -i json -o [RESULT]
3+
# RUN_PARMS: utfgrid_truetype_symbol_rotation.json [SHP2IMG] -m [MAPFILE] -l symbol-rotation -i json -o [RESULT]
34
#
45
#
56
MAP
@@ -70,4 +71,35 @@ LAYER
7071
TEXT 'label_sample'
7172
END
7273
END
74+
75+
# This layer renders the symbol to the utfgrid whith a rotation
76+
LAYER
77+
NAME "symbol-rotation"
78+
TYPE point
79+
STATUS OFF
80+
LABELCACHE OFF
81+
CLASS
82+
NAME "test1"
83+
STYLE
84+
SYMBOL "ttf"
85+
COLOR 0 0 0
86+
SIZE 15
87+
ANGLE 45
88+
END
89+
LABEL
90+
COLOR 12 0 150
91+
OUTLINECOLOR 0 0 255
92+
TYPE truetype
93+
SIZE 6
94+
POSITION AUTO
95+
END
96+
END
97+
FEATURE
98+
POINTS
99+
50 50
100+
END
101+
TEXT 'label_sample'
102+
END
103+
END
104+
73105
END #MAP

0 commit comments

Comments
 (0)