Skip to content

Commit

Permalink
Fixed case when drawing legend shapes with style geomtransforms. (#5193)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdlime authored and tbonfort committed Feb 23, 2016
1 parent 078a6a3 commit 4f7d463
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mapgeomtransform.c
Expand Up @@ -180,6 +180,15 @@ int msDrawTransformedShape(mapObj *map, symbolSetObj *symbolset, imageObj *image

p.shape = shape; /* set a few parser globals (hence the lock) */
p.expr = &(style->_geomtransform);

if(p.expr->tokens == NULL) { /* this could happen if drawing originates from legend code (#5193) */
status = msTokenizeExpression(p.expr, NULL, NULL);
if(status != MS_SUCCESS) {
msSetError(MS_MISCERR, "Unable to tokenize expression.", "msDrawTransformedShape()");
return MS_FAILURE;
}
}

p.expr->curtoken = p.expr->tokens; /* reset */
p.type = MS_PARSE_TYPE_SHAPE;

Expand Down
2 changes: 2 additions & 0 deletions maplegend.c
Expand Up @@ -124,6 +124,7 @@ int msDrawLegendIcon(mapObj *map, layerObj *lp, classObj *theclass,
box.numlines = 1;
box.line[0].point = (pointObj *)msSmallMalloc(sizeof(pointObj)*5);
box.line[0].numpoints = 5;
box.type = MS_SHAPE_POLYGON;

box.line[0].point[0].x = dstX + polygon_contraction;
box.line[0].point[0].y = dstY + polygon_contraction;
Expand Down Expand Up @@ -249,6 +250,7 @@ int msDrawLegendIcon(mapObj *map, layerObj *lp, classObj *theclass,
zigzag.numlines = 1;
zigzag.line[0].point = (pointObj *)msSmallMalloc(sizeof(pointObj)*4);
zigzag.line[0].numpoints = 4;
zigzag.type = MS_SHAPE_LINE;

zigzag.line[0].point[0].x = dstX + offset;
zigzag.line[0].point[0].y = dstY + height - offset;
Expand Down

0 comments on commit 4f7d463

Please sign in to comment.