On Oct 18, 2005, at 8:30 PM, David Niergarth wrote:
Hi Sean,
I suspect that you might be doing something like this:
class.label = mapscript.labelObj()
right? This could be your problem.
Yes, that's exactly it.
Instances of mapscript.classObj are **complete**. There is no need to
create new attributes for them. A new instance of classObj already
has a
properly initialized labelObj as a "label" attribute. New instances of
labelObj (as above) won't be properly initialized. That's just the way
MapServer/mapscript is. Underneath the Python wrapper is a lot of C
code
which still presumes that we're parsing a mapfile.
Ok, I see now how it works now.
Here's an example session:
Python 2.3 (#1, Sep 13 2003, 00:49:11)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import mapscript
c = mapscript.classObj()
c.label.minsize
4
c.label.maxsize
256
those are the normal defaults, and will give you working labels. Now,
the problematic usage:
l = mapscript.labelObj()
l.minsize
0
l.maxsize
0
this label is going to fail.
You have x-ray vision, I see! ;)
Rule of thumb: whenever an object has another object attribute with a
single value (such as the label attribute of a classObj), that
attribute
will be created and initialize by the parent's constructor.
Thanks for your help,
--David
You're welcome, David, I hope you haven't been struggling too long with
this problem.
Sean
--
Sean Gillies
sgillies at frii dot com
http://zcologia.com