Skip to content

Commit

Permalink
#5922 - Support rotation of TrueType symbol in UTFGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Plante authored and dmorissette committed Nov 14, 2019
1 parent 8f2de5b commit f57a971
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions maputfgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,16 @@ int utfgridRenderGlyphs(imageObj *img, textPathObj *tp, colorObj *c, colorObj *o
box.line_to((x+size)/r->utfresolution,(y-size)/r->utfresolution);
box.line_to((x)/r->utfresolution,(y-size)/r->utfresolution);

/* Rotation if necessary. */
if( tp->glyphs->rot != 0) {
mapserver::trans_affine mtx;
mtx *= mapserver::trans_affine_translation(-x/r->utfresolution,-y/r->utfresolution);
mtx *= mapserver::trans_affine_rotation(-tp->glyphs->rot);
mtx *= mapserver::trans_affine_translation(x/r->utfresolution,y/r->utfresolution);
box.transform(mtx);
}


/* Rendering the symbol */
utfgridRenderPath(img, box);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"grid":[" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," !! "," !!!! "," !!!!!! "," !!!!!! "," !!!! "," !! "," "," "," "],"keys":["","1"],"data":{}}
32 changes: 32 additions & 0 deletions msautotest/renderers/utfgrid_truetype_symbol.map
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# RUN_PARMS: utfgrid_truetype_symbol_labelcache.json [SHP2IMG] -m [MAPFILE] -l symbol-labelcache -i json -o [RESULT]
# RUN_PARMS: utfgrid_truetype_symbol_nolabelcache.json [SHP2IMG] -m [MAPFILE] -l symbol-nolabelcache -i json -o [RESULT]
# RUN_PARMS: utfgrid_truetype_symbol_rotation.json [SHP2IMG] -m [MAPFILE] -l symbol-rotation -i json -o [RESULT]
#
#
MAP
Expand Down Expand Up @@ -70,4 +71,35 @@ LAYER
TEXT 'label_sample'
END
END

# This layer renders the symbol to the utfgrid whith a rotation
LAYER
NAME "symbol-rotation"
TYPE point
STATUS OFF
LABELCACHE OFF
CLASS
NAME "test1"
STYLE
SYMBOL "ttf"
COLOR 0 0 0
SIZE 15
ANGLE 45
END
LABEL
COLOR 12 0 150
OUTLINECOLOR 0 0 255
TYPE truetype
SIZE 6
POSITION AUTO
END
END
FEATURE
POINTS
50 50
END
TEXT 'label_sample'
END
END

END #MAP

0 comments on commit f57a971

Please sign in to comment.