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)
Change History (11)
by , 15 years ago
Attachment: | not_disappeared.png added |
---|
comment:3 by , 15 years ago
Owner: | changed from | to
---|
comment:4 by , 15 years ago
Component: | MapServer C Library → AGG |
---|---|
Status: | new → assigned |
follow-up: 7 comment:5 by , 15 years ago
Cc: | 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 , 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);
comment:7 by , 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
all lines drawn normally