Problem with cartoline

Mathieu Bertrand mjbertrand at GMAIL.COM
Thu Nov 10 15:39:14 EST 2005


Hi,

I have a problem when I come to draw a cartoline with many points very close.

Please see the original .png attach with this message.  You will see
that sometime, the perpendicular line is drawn twice and not with the
same angle, the problem always appear in the curve of the line where
the points are very close.

Here is my style define in my .map:
--------------
--------------
	CLASSITEM "TYPE"
		CLASS
		NAME "Secondary Road - Paved"
		STYLE
			COLOR 0 0 0
			SYMBOL "circle"
			SIZE 1
			ANTIALIAS TRUE
		END
		STYLE
			COLOR 0 0 0
			SYMBOL "test"
			SIZE 10
			OFFSET -6 -99
			ANTIALIAS TRUE
		END
-------------
-------------

and my symbol (also define in my .map):
-------------
-------------
SYMBOL
  NAME 'test'
  TYPE CARTOLINE
  LINECAP BUTT
  LINEJOIN none
  STYLE 1 20 END
END
----------
----------

I played a little bit with the source code and discover that the
problem come from the last part of the function "RenderCartoLine"
(mapgd.c)

------
  if (drawpoly) {
    if (gox)
    {
      poly_points[2].x = MS_NINT(bn+db_pxn*size);
      poly_points[2].y = MS_NINT(an+da_pxn*size);
      poly_points[3].x = MS_NINT(bn);
      poly_points[3].y = MS_NINT(an);
    }
    else
    {
      poly_points[2].x = MS_NINT(an+da_pxn*size);
      poly_points[2].y = MS_NINT(bn+db_pxn*size);
      poly_points[3].x = MS_NINT(an);
      poly_points[3].y = MS_NINT(bn);
    }

	if (antialias) {
	/* gdImageSetAntiAliased(img, color); */
	  gdImageSetAntiAliasedDontBlend(img, color, color);
	  if (size > 1)
	  {
		gdImageFilledPolygon(img, poly_points, 4, gdAntiAliased);
	  }
	  else
	  {
		gdImageLine(img, poly_points[0].x, poly_points[0].y,
poly_points[3].x, poly_points[3].y, gdAntiAliased);
	  }
	}
	else
	{
	  if (size > 1)
	  {
		gdImageFilledPolygon(img, poly_points, 4, color);
	  }
	  else
	  {
		gdImageLine(img, poly_points[0].x, poly_points[0].y,
poly_points[3].x, poly_points[3].y, color);
	  }
	}
  }
---------

What is the objective of that code, it's seem that it's only repeating
the code above (but I know that it's not)... If I set drawpoly = 0
just before "if (drawpoly)", it's resolve the problem, but then there
is problem when drawing a cartoline with a style like "4 10" (width of
the perpendicular line more than 1)

Anybody could help me with that problem ? Anybody with idea ?

Thank you
-Mathieu Bertrand
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image_cartoline_problem.png
Type: image/png
Size: 14590 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20051110/da6a1e35/image_cartoline_problem.png


More information about the mapserver-dev mailing list