[Mapserver-users] Bug 663 (Re: Clarifications about mapscript
eric at gomoos.org
Thu May 13 15:56:31 EDT 2004
On Thu, 2004-05-13 at 13:19, Sean Gillies wrote:
> Eric, add your email to the tracker if you want to follow this
> I've figured it out. Has to do with the MapServer "pens", when setting
> style colors we are not resetting the value of pens, hence the set color
> appears to stick. The following works:
> def testDrawPoints(self):
> points = [mapscript.pointObj(-0.2, 51.5),
> mapscript.pointObj(0.0, 51.0),
> mapscript.pointObj(0.2, 51.5)]
> colors = [mapscript.colorObj(255,0,0),
> img = self.mapobj1.prepareImage()
> layer = self.mapobj1.getLayerByName('POINT')
> class0 = layer.getClass(0)
> for i in range(len(points)):
> style0 = class0.getStyle(0)
> style0.color = colors[i]
> style0.color.pen = -4
> assert style0.color.toHex() == colors[i].toHex()
> points[i].draw(self.mapobj1, layer, img, 0, "foo")
> and results in red, green, and blue points. I'm going to find a
> that's better than explicitly setting the pen attribute of a color.
Thanks Sean! Not only figures out the bug but provides a work-around!
The beauty of open source.
I guess setRGB() is an obvious place to set color.pen = MS_PEN_UNSET. I
guess the color constructor could also, if RGB parameters are present.
More information about the mapserver-users