Opened 14 years ago

Closed 12 years ago

#3303 closed defect (fixed)

Issue with "labelcache_map_edge_buffer" and label buffers

Reported by: rbranson Owned by: sdlime
Priority: normal Milestone: 6.0.2 release
Component: MapServer C Library Version: svn-trunk (development)
Severity: normal Keywords:
Cc: tbonfort, dmorissette

Description

It looks like msDrawLabelCache (mapdraw.c) is adding the label buffer value from the mapfile to the labelcache_map_edge_buffer value (typically negative), which gets passed down to labelInImage (maplabel.c) thru msTestLabelCacheCollisions (maplabel.c). This buffer value, say -50 (14 [label buffer] + -64 [labelcache_map_edge_buffer]), gets negated (therefore making it positive), and used as the minimum X and Y pixel coordinates to test if the label will fall outside of the labelcache_map_edge_buffer value.

The software on the receiving end of the map image is cuts off the 64 pixel gutter around the edge of the image, but there are labels crossing the gutter boundary since the net gutter used by labelInImage is 50.

I've attached a quick patch to mapdraw.c (sorry it's a git patch, but it's short) illustrating a simple way to fix this issue. It probably doesn't work as intended with non-labelcache_map_edge_buffer maps though.

Attachments (1)

mapdraw.c.patch (2.2 KB ) - added by rbranson 14 years ago.
Dirty hack patch file.

Download all attachments as: .zip

Change History (6)

by rbranson, 14 years ago

Attachment: mapdraw.c.patch added

Dirty hack patch file.

comment:1 by sdlime, 12 years ago

Status: newassigned

Not sure how I missed this one. Running up against it myself. -Steve

comment:2 by sdlime, 12 years ago

Milestone: 6.0.2 release

Actually, patch seems to work ok in the non-tiling case too. Needs more testing though. I don't like the combining of the edge buffer and general buffer though.

Steve

comment:3 by sdlime, 12 years ago

Seems to me that labelInImage should be outside and separate from the between label collisions. The edge buffer is useful in that case and the label buffer in the latter case.

Steve

comment:4 by sdlime, 12 years ago

Cc: tbonfort dmorissette added

comment:5 by sdlime, 12 years ago

Resolution: fixed
Status: assignedclosed

Refactored labelInImage() in r12911 (branch-6-0). You now pass a gutter which effectively makes the image smaller. A label buffer could make the gutter smaller or even negative if there is no gutter. I think this makes more intuitive sense. So you effectively pass:

labelcache_map_edge_buffer - label_buffer

Change was simple just switching some signs in labelInImage(). As a result the labelcache_map_edge_buffer can be given as either as positive or negative value (we take the abs()). The code in maptile.c already does this.

I'll commit to trunk as part of RFC 77 integration.

Steve

Note: See TracTickets for help on using tickets.