Mapscript API: for object manipulation, not object creation?

Sean Gillies sgillies at FRII.COM
Mon May 30 17:54:23 EDT 2005


On May 30, 2005, at 2:02 PM, Rick Innis wrote:

>>
>> Great. The sooner, the better. We're aiming for a 4.6 release to
>> coincide with next month's meeting.
>
>
>> No, I forgot momentarily that SWIG-Java doesn't support optional
>> method arguments as we have with Python. There is no zero argument
>> constructor for Java. Calling the ordinary constructor with a NULL
>> argument should be equivalent.
>
> Doesn't appear to be. This is what I get in the logfile:
>
> An unexpected exception has been detected in native code outside the
> VM.
> Unexpected Signal : 11 occurred at PC=0x400A3D89
> Function=__libc_free+0x49
> Library=/lib/tls/libc.so.6
>
> Current Java thread:
>          at edu.umn.gis.mapscript.mapscriptJNI.mapObj_insertLayer
> (Native Method)
>          at edu.umn.gis.mapscript.mapObj.insertLayer(mapObj.java:341)
>
> Two possibly related items:
>
> While the docs say the insert methods return the index at which the
> object was inserted, the Java API doesn't seem to support this - it
> supports a range of "insertFoo(foo, index)" methods.
>

I'm looking at mapObj.java generated using SWIG 1.3.21 and MapServer
4.4. Should be what you get out of the box. I see a

   public int insertLayer(layerObj layer, int index)

Once again I forgot that there are no optional method arguments for
Java. Sorry. In the Python mapscript, this method's signature is

   insertLayer(layer, index=-1)

and we can omit the index, it defaults to -1, or the end of the layers
list. In your case, insert a layer at the end with

   li = map.insertLayer(layer, -1)


> Also, I notice that if I do a "make clean" in mapserver-4.4.2, I need
> to do a "make interface" in mapserver-4.4.2/mapscript/java before I
> can rebuild the Java API - which is then slightly different from the
> one I get "out of the box". Mainly seems to be in the MS_ classes,
> which define their statics as objects "out of the box" but ints after
> a rebuild.
>
>      --Rick.
>

Which version of SWIG are you using?

Sean


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



More information about the mapserver-users mailing list