swig mapscript: your opinion on changing layerObj::getShape() for version 4.4

Sean Gillies sgillies at FRII.COM
Mon Sep 20 13:02:19 EDT 2004


Hello mapscripters,

For some time, an alternative API has been available to to those
who build their own SWIG mapscript modules.  I think it is time
to make one feature of the experimental API permanent.

In the experimental API getShape returns a shapeObj and takes
shapeindex and tileindex as arguments.

     shapeObj getShape( int shapeindex [, int tileindex=-1 ] )

The usage for the case of tileindexed shapefiles is like this

     tileindexed_layer.open()
     shape = tileindexed_layer.getShape(shapeindex, tileindex)
     tileindexed_layer.close()

In the case of layers without tileindexing, the second argument
can be omitted because it defaults to -1

     layer.open()
     shape = layer.getShape(shapeindex)
     layer.close()

I'd like to get feedback on 2 facets of this proposal.  The way
I see it

1) return value change from int to shapeObj

    requires update of scripts:    -1
    more like php mapscript:       +1
    prevents shape type conflicts: +1
    reduces need to create shapes: +1
    just plain better:             +1

2) reorder arguments

    less like php mapscript:                       -1
    for postgis layers avoids a useless argument:  +1
    for regular shapefiles avoids useless arg:     +1

Please see this bug for more details:

   http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=878.

cheers,
Sean

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



More information about the mapserver-users mailing list