Permalink
Browse files

Fixed case when drawing legend shapes with style geomtransforms. (#5193)

  • Loading branch information...
1 parent 078a6a3 commit 4f7d463d734cc8c6ad4ecd04cc0dca8cd4ffe371 @sdlime sdlime committed with tbonfort Feb 4, 2016
Showing with 11 additions and 0 deletions.
  1. +9 −0 mapgeomtransform.c
  2. +2 −0 maplegend.c
View
@@ -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;
View
@@ -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;
@@ -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;

0 comments on commit 4f7d463

Please sign in to comment.