Opened 17 years ago

Closed 17 years ago

#2271 closed defect (fixed)

Polygon outline drawn twice with STYLEITEM AUTO and AGG output

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

Description

In #2264, tbonfort reported that the outline of the polygons appears aliased because it is drawn twice with styleitem auto:

Thomas wrote:

by the way flavio, your outlines are showing up aliased because they are drawn twice: once along with the fill, and a second time alone. I don't know if this is coming from the styling in the shapefile, or if it's a bug in the stylitem auto code in mapserver. do you have a way to check this ?

Flavio wrote:

Styling: I suppose it is coming from the STYLEITEM auto which does not

use antialising on the borders. We will continue testing, will have to adopt our mapping files quite a bit for AGG, as far as I see (such as lines tend to show quite a bit thicker).

Thomas wrote:

this is not the case, antialiasing is always on. what happens is that your

outline is drawn twice, and therefore appears thicker (i.e. the alpha values of the antilaliased pixels are more or less twice what they should be, therefore making the whole line appear aliased)

ogrinfo gives this for your table

BRUSH(fc:#cdff80,bc:#000000,id:"mapinfo-brush-2.ogr-
brush-0");PEN(w:1px,c:#000000,id:"mapinfo-pen-2.ogr-pen-0")

which confirms that the outline is drawn twice (once with the brush's bc,

once with the pen's c)

Change History (4)

comment:1 by dmorissette, 17 years ago

Cc: flavio sdlime added

Thomas, is this a bug with styleitem auto?

If I'm not mistaken, at the moment we produce a class with 2 styles: the first style for the polygon fill and the second for the outline. This is the way things have always worked with GD rendering. What should styleitem auto do in this case?

comment:2 by dmorissette, 17 years ago

After discussing this with Thomas, it seems that the issue is that OGR STYLEITEM AUTO sets style[0]->outlinecolor as well as style[1]->outlinecolor:

mapogr.cpp, around line 2228:

                  // This is a multipart symbology, so pen defn goes in the
                  // overlaysymbol params (also set outlinecolor just in case)
                  if (msMaybeAllocateStyle(c, 1))
                  {
                      RELEASE_OGR_LOCK;
                      return(MS_FAILURE);
                  }

                  c->styles[0]->outlinecolor = c->styles[1]->outlinecolor = 
                      oPenColor;
                  c->styles[1]->size = nPenSize;
                  c->styles[1]->symbol = nPenSymbol;

I need to check that.

in reply to:  2 comment:3 by tbonfort, 17 years ago

changing

c->styles[0]->outlinecolor = c->styles[1]->outlinecolor = 
                       oPenColor;

to

c->styles[1]->outlinecolor = oPenColor;

fixes the issue for me... don't know about the side-effects though

comment:4 by dmorissette, 17 years ago

Resolution: fixed
Status: newclosed

As I had written in the comment, I think I had set the styles[0]->outlinecolor just in case and it was a bad idea so it's safe to remove.

Fixed in r6735.

Note: See TracTickets for help on using tickets.