Skip to content

Commit

Permalink
Fix OGR autostyle label rendering (#4449)
Browse files Browse the repository at this point in the history
  • Loading branch information
szekerest committed Sep 9, 2012
1 parent 7b47a44 commit c895823
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mapogr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ static int msOGRUpdateStyle(OGRStyleMgrH hStyleMgr, mapObj *map, layerObj *layer

OGR_ST_SetUnit(hStylePart, OGRSTUPixel, map->cellsize*72.0*39.37);

if (eStylePartType == OGRSTCLabel && c->numlabels >= 1) {
if (eStylePartType == OGRSTCLabel) {
OGRStyleToolH hLabelStyle = hStylePart;

// Enclose the text string inside quotes to make sure it is seen
Expand All @@ -2456,6 +2456,14 @@ static int msOGRUpdateStyle(OGRStyleMgrH hStyleMgr, mapObj *map, layerObj *layer
(char*)CPLSPrintf("\"%s\"", escapedTextString));
free(escapedTextString);

if (c->numlabels == 0) {
/* allocate a new label object */
if(msGrowClassLabels(c) == NULL)
return MS_FAILURE;
c->numlabels++;
initLabel(c->labels[0]);
}

c->labels[0]->angle = OGR_ST_GetParamDbl(hLabelStyle,
OGRSTLabelAngle, &bIsNull);

Expand Down

0 comments on commit c895823

Please sign in to comment.