Skip to content

Commit

Permalink
Fix non-labelcache'd drawing of line and polygon labels (#4837)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbonfort committed Jan 9, 2014
1 parent 898ab8b commit e52b4b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions mapdraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,16 @@ int lineLayerDrawShape(mapObj *map, imageObj *image, layerObj *layer, shapeObj *
goto line_cleanup;
}
} else {
if(!ts_auto->textpath) {
if(UNLIKELY(MS_FAILURE == msComputeTextPath(map,ts_auto))) {
ret = MS_FAILURE;
free(lar.angles);
free(lar.label_points);
freeTextSymbol(ts_auto);
free(ts_auto);
goto line_cleanup;
}
}
ret = msDrawTextSymbol(map,image,lar.label_points[i],ts_auto);
freeTextSymbol(ts_auto);
free(ts_auto); /* TODO RFC98: could we not re-use the original ts instead of duplicating into ts_auto ?
Expand Down Expand Up @@ -1738,12 +1748,10 @@ int polygonLayerDrawShape(mapObj *map, imageObj *image, layerObj *layer,
} else {
for (i = 0; i < layer->class[c]->numlabels; i++)
if(msGetLabelStatus(map,layer,shape,layer->class[c]->labels[i]) == MS_ON) {
char *annotext = msShapeGetLabelAnnotation(layer,shape,layer->class[c]->labels[i]);
char *annotext = msShapeGetLabelAnnotation(layer,shape,layer->class[c]->labels[i]); /*ownership taken by msDrawLabel, no need to free */
if(UNLIKELY(MS_FAILURE == msDrawLabel(map, image, annopnt, annotext, layer->class[c]->labels[i], layer->scalefactor))) {
free(annotext);
return MS_FAILURE;
}
free(annotext);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion msautotest
Submodule msautotest updated from ea67d9 to f8cf02

0 comments on commit e52b4b5

Please sign in to comment.