[Qgis-developer] Passing pointer arrays in python

Martin Dobias wonder.sk at gmail.com
Fri Aug 6 08:43:25 EDT 2010


Hi Tim

On Fri, Aug 6, 2010 at 11:09 AM, Tim Sutton <lists at linfiniti.com> wrote:
> Hi Martin & other pythonistas
>
> I'm trying to use
>
> void QgsRasterLayer::computeMinimumMaximumFromLastExtent        (       int
> theBand, double *       theMinMax )
>
> Via python. However I can't seem to figure out how to pass the
> arguments. I tried doing:
>
> void QgsRasterLayer::computeMinimumMaximumFromLastExtent        (       int
> theBand,        double *        theMinMax )
>
>
> Looking at the generated sip file:
>
> qgis/build/python/core/sipcoreQgsRasterLayer.cpp
>
> If doesnt seem to internally use a double* for the a1 var. (line 2167
> below). Is this a bug with the sip file defs, or am I missing how to
> use the method?

Indeed the wrapper has not been generated correctly because it has
quite specific semantics (sip expected that only one value is going to
be returned). As a workaround, I've added another override in r14017
which can be handled automatically by sip:

>>> layer.computeMinimumMaximumFromLastExtent(1)
(0.0, 255.0)

Cheers
Martin


More information about the Qgis-developer mailing list