Skip to content

Commit 4f7d463

Browse files
sdlimetbonfort
authored andcommitted
Fixed case when drawing legend shapes with style geomtransforms. (#5193)
1 parent 078a6a3 commit 4f7d463

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

mapgeomtransform.c

+9
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ int msDrawTransformedShape(mapObj *map, symbolSetObj *symbolset, imageObj *image
180180

181181
p.shape = shape; /* set a few parser globals (hence the lock) */
182182
p.expr = &(style->_geomtransform);
183+
184+
if(p.expr->tokens == NULL) { /* this could happen if drawing originates from legend code (#5193) */
185+
status = msTokenizeExpression(p.expr, NULL, NULL);
186+
if(status != MS_SUCCESS) {
187+
msSetError(MS_MISCERR, "Unable to tokenize expression.", "msDrawTransformedShape()");
188+
return MS_FAILURE;
189+
}
190+
}
191+
183192
p.expr->curtoken = p.expr->tokens; /* reset */
184193
p.type = MS_PARSE_TYPE_SHAPE;
185194

maplegend.c

+2
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ int msDrawLegendIcon(mapObj *map, layerObj *lp, classObj *theclass,
124124
box.numlines = 1;
125125
box.line[0].point = (pointObj *)msSmallMalloc(sizeof(pointObj)*5);
126126
box.line[0].numpoints = 5;
127+
box.type = MS_SHAPE_POLYGON;
127128

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

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

0 commit comments

Comments
 (0)