[Qgis-developer] Passing pointer arrays in python

Tim Sutton lists at linfiniti.com
Fri Aug 6 05:09:36 EDT 2010


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?


2160 extern "C" {static PyObject
*meth_QgsRasterLayer_computeMinimumMaximumEstimates(PyObject *,
PyObject *);}
2161 static PyObject
*meth_QgsRasterLayer_computeMinimumMaximumEstimates(PyObject *sipSelf,
PyObject *sipArgs)
2162 {
2163     int sipArgsParsed = 0;
2164
2165     {
2166         int a0;
2167         double a1;
2168         QgsRasterLayer *sipCpp;
2169
2170         if
(sipParseArgs(&sipArgsParsed,sipArgs,"Bi",&sipSelf,sipType_QgsRasterLayer,&sipCpp,&a0))
2171         {
2172             Py_BEGIN_ALLOW_THREADS
2173             sipCpp->computeMinimumMaximumEstimates(a0,&a1);
2174             Py_END_ALLOW_THREADS
2175
2176             return PyFloat_FromDouble(a1);
2177         }
2178     }


Regards

-- 
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================


More information about the Qgis-developer mailing list