Odd issue with drawing a shape multiple times

Sean Gillies sgillies at FRII.COM
Tue Mar 1 11:29:30 EST 2005


Can anyone share their insight into shape rendering with me?  I'm
finding it impossible to redraw a single shape using the same map and
layer objects using shapeObj.draw (and msDrawShape).  Is there some
caching or other magic at work here that's tripping me up?

The script is run from mapserver/tests:

     import mapscript

     mo = mapscript.mapObj('test.map')

     # Use the POLYGON layer to render feature
     lo = mo.getLayerByName('POLYGON')

     # Get one polygon shape
     lo.open()
     so = lo.getFeature(0)
     lo.close()

     so.classindex = 0

     def inspect_shape(so):
         for item in dir(so):
             print item, getattr(so, item)

     # render the shape
     im = mo.prepareImage()
     print "p1a\n---\n"
     inspect_shape(so)
     so.draw(mo, lo, im)
     im.save('p1a.png')

     # render the shape in a new image
     im = mo.prepareImage()
     print "p1b\n---\n"
     inspect_shape(so)
     so.draw(mo, lo, im)
     im.save('p1b.png')

Produces the images

p1a (is correct):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p1a.png
Type: image/png
Size: 405 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20050301/1e781f2f/p1a.png
-------------- next part --------------

p1b (is blank):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p1b.png
Type: image/png
Size: 211 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20050301/1e781f2f/p1b.png
-------------- next part --------------


I'm stepping through the code with gdb but am finding it to be slow
going.  Any clues from the mapdraw.c and mapgd.c programmers (Steve?)
would be greatly appreciated!

thanks,
Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies


More information about the mapserver-dev mailing list