Opened 15 years ago

Last modified 13 years ago

#2866 new defect

Drawing ‘Straight’ label with LABEL_NO_CLIP, if “Follow” label drawing fails.

Reported by: nnikolov Owned by: aboudreault
Priority: normal Milestone: 5.6 release
Component: MapServer C Library Version: 5.2
Severity: normal Keywords: LABEL_NO_CLIP option
Cc: sdlime

Description

When ANGLE “Follow” option is set for label rendering, if a “follow” label drawing fails (in msPolylineLabelPath()) under some circumstances, it defaults to drawing ‘straight’ labels (using msPolylineLabelPoint()). However, when LABEL_NO_CLIP option is ON, the code does not follow the above logic. There are two identical places in mapdraw.c file (line 1403 - 1407 and 1605-1609) where the problem is:

if(layer->class[c]->label.autofollow == MS_TRUE ) {

annopath = msPolylineLabelPath(&annoshape, layer->class[c]->label.minfeaturesize, &(map->fontset), shape->text, &(layer->class[c]->label), layer->scalefactor, &status);

} else {

annocallret = msPolylineLabelPoint(&annoshape, &annopnt, layer->class[c]->label.minfeaturesize, &angle, &length);

}

The proposed fix is to replace the above lines (in both places) with the following lines:

if(layer->class[c]->label.autofollow == MS_TRUE ) {

annopath = msPolylineLabelPath(&annoshape, layer->class[c]->label.minfeaturesize, &(map->fontset), labelshapePtr->text, &(layer->class[c]->label), layer->scalefactor, &status);

}

/* Use regular label algorithm if angle is AUTO or a number, or if ANGLE FOLLOW failed */

if ( layer->class[c]->label.autofollow == MS_FALSE
(!annopath && status != MS_FAILURE) ) {

annocallret = msPolylineLabelPoint(&annoshape, &annopnt, layer->class[c]->label.minfeaturesize, &angle, &length);

}

Change History (5)

comment:1 by sdlime, 15 years ago

Milestone: 5.4 release
Status: newassigned

comment:2 by aboudreault, 14 years ago

Steve, Do you want I take care of this one?

comment:3 by sdlime, 13 years ago

Cc: aboudreault added

Alan: This looks to still be an issue, can you take a peek? The label path code is more complex in 6.0 and it's not clear at first glance how you detect failure. Must be a 0 in one of the counters.

Steve

comment:4 by aboudreault, 13 years ago

Cc: sdlime added; aboudreault removed
Owner: changed from sdlime to aboudreault
Status: assignednew

Will take a look.

comment:5 by aboudreault, 13 years ago

nnikolov, could you attach a test case to test this easily?

Note: See TracTickets for help on using tickets.