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

Lowell Filak lfilak at MEDINACO.ORG
Mon Sep 20 13:14:53 EDT 2004


The following message was sent by Sean Gillies <sgillies at FRII.COM> on
Mon, 20 Sep 2004 11:02:19 -0600.

> 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,

I vote for the change(s).
The method should just return a shape and not requiring the
documentation of a flag (-1) for things to work correctly are a good thing.

Lowell



More information about the mapserver-users mailing list