Skip to content
Permalink
Browse files
#5922 - Support rotation of TrueType symbol in UTFGrid
  • Loading branch information
Charles Plante authored and dmorissette committed Nov 14, 2019
1 parent 8f2de5b commit f57a97175599a8e919062d8f2c5b97e7becb2ef5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
@@ -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);

@@ -0,0 +1 @@
{"grid":[" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," !! "," !!!! "," !!!!!! "," !!!!!! "," !!!! "," !! "," "," "," "],"keys":["","1"],"data":{}}
@@ -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
@@ -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.