Skip to content

Commit 7121ac7

Browse files
committed
Recalculate scale factor in drawLegendIcon from mapscript (#5287)
1 parent f2b0310 commit 7121ac7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mapscript/swiginc/class.i

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,14 @@
176176
return (char *) msNextKeyFromHashTable(&(self->metadata), lastkey);
177177
}
178178

179-
int drawLegendIcon(mapObj *map, layerObj *layer, int width, int height, imageObj *dstImage, int dstX, int dstY) {
179+
int drawLegendIcon(mapObj *map, layerObj *layer, int width, int height, imageObj *dstImage, int dstX, int dstY) {
180+
if(layer->sizeunits != MS_PIXELS) {
181+
map->cellsize = msAdjustExtent(&(map->extent), map->width, map->height);
182+
layer->scalefactor = (msInchesPerUnit(layer->sizeunits,0)/msInchesPerUnit(map->units,0)) / map->cellsize;
183+
}
184+
else
185+
layer->scalefactor = map->resolution/map->defresolution;
186+
180187
return msDrawLegendIcon(map, layer, self, width, height, dstImage, dstX, dstY, MS_TRUE, NULL);
181188
}
182189

0 commit comments

Comments
 (0)