should (classObj.getLabel() == null) when MAP.LAYER.CLASS has no LABEL ?

Umberto Nicoletti umberto.nicoletti at GMAIL.COM
Thu Jan 10 03:03:30 EST 2008


This is the intended behaviour. Every classObj allocates a labelObj
(even if it doesn't use it) at construction time because of the way
the C struct has been defined.
This is also valid for many others members like metadata, colorObj, etc.

Regards,
Umberto

On Jan 10, 2008 2:41 AM, rich.fromm <nospam420 at yahoo.com> wrote:
> Within each MAP.LAYER.CLASS in my *.map files, some classes have a LABEL, but
> many do not.  My guess had been that when parsing the classObj in Java
> mapscript, that if there was no LABEL, that classObj.getLabel() would return
> a
> null labelObj.  This is not the case.  A non-null labelObj is returned
> whether
> or not there is a LABEL.
>
> Is this intended behavior, or a bug?
>
> There's no way to tell from the mapscript docs, as getLabel() isn't even
> listed in "classObj Methods".  (Which I guess is a minor documentation bug
> regardless.)
>
> If I look at the classObj.java source, it shows:
>
> --- begin ---
>   public labelObj getLabel() {
>     long cPtr = mapscriptJNI.get_classObj_label(swigCPtr);
>     return (cPtr == 0) ? null : new labelObj(cPtr, false);
>   }
> --- end ---
>
> I don't totally understand all of the SWIG stuff, but I would guess from
> looking at it that it ought to be returning null if not applicable.  But it
> doesn't appear to be doing that.
>
> --
> View this message in context: http://www.nabble.com/should-%28classObj.getLabel%28%29-%3D%3D-null%29-when-MAP.LAYER.CLASS-has-no-LABEL---tp14726078p14726078.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
>



More information about the mapserver-users mailing list