Opened 15 years ago

Closed 15 years ago

#3059 closed defect (fixed)

Disappearing lines when polygon feature drawn as TYPE LINE with agg output

Reported by: cnieman Owned by: tbonfort
Priority: normal Milestone:
Component: AGG Version: 5.4
Severity: normal Keywords:
Cc: sdlime

Description

I have encountered a problem with drawing polygon features as lines with AGG output. Some of the lines disappear when one vertex is not in the map extent. The attached sample and images illustrate the problem. The order of the vertices are top left, bottom left, bottom right, top right; when the bottom left vertex is not on the map, the left line is not drawn.

I thought it was a problem with the data where I first observed this happening, but I am certain that the geometry of the sample shape is fine, and it still occurs.

Attachments (3)

not_disappeared.png (19.4 KB ) - added by cnieman 15 years ago.
all lines drawn normally
disappeared.png (13.9 KB ) - added by cnieman 15 years ago.
missing line
disappearing_lines.zip (2.5 KB ) - added by cnieman 15 years ago.
sample

Download all attachments as: .zip

Change History (11)

by cnieman, 15 years ago

Attachment: not_disappeared.png added

all lines drawn normally

by cnieman, 15 years ago

Attachment: disappeared.png added

missing line

by cnieman, 15 years ago

Attachment: disappearing_lines.zip added

sample

comment:1 by sdlime, 15 years ago

Does the problem occur with GD too? -Steve

comment:2 by cnieman, 15 years ago

I couldn't reproduce it with GD.

comment:3 by tbonfort, 15 years ago

Owner: changed from sdlime to tbonfort

comment:4 by tbonfort, 15 years ago

Component: MapServer C LibraryAGG
Status: newassigned

comment:5 by tbonfort, 15 years ago

Cc: sdlime added

Reproduced, thanks for the concise testcase.

This is happening because the AGG shape transformer skips degenerate polygons (with less than three points), whereas the GD one does not. When a point of the shape is outside the current extent, msClipPolylineRect will create a shape with multiple lines, some of which can result in degenerate polygons.

Steve, my patch is to change the shape->type to MS_SHAPE_LINE after msClipPoylineRect if we're in a LINE layer. Will this have any side effects?

Index: mapdraw.c
===================================================================
--- mapdraw.c	(revision 9122)
+++ mapdraw.c	(working copy)
@@ -1837,6 +1837,7 @@
 
     if(layer->transform == MS_TRUE) {
       msClipPolylineRect(shape, cliprect);
+      shape->type = MS_SHAPE_LINE;
       if(shape->numlines == 0) {
         if(hasGeomTransform)
           msFreeShape(&nonClippedShape); 

comment:6 by tbonfort, 15 years ago

maybe a better fix would be to do something like:

if(shape->type == MS_SHAPE_POLYGON)
  msClipPolygonRect(shape,cliprect)
else
  msClipPolylineRect(shape, cliprect);

in reply to:  5 comment:7 by sdlime, 15 years ago

I like the latter suggestion better, more concise and less prone to errors downstream although I can't think of what those would be offhand.

Steve

comment:8 by tbonfort, 15 years ago

Resolution: fixed
Status: assignedclosed

committed in r9277

Note: See TracTickets for help on using tickets.