Skip to content
Permalink
Browse files

No need for custom conversion code when QVariantMap type is returned

  • Loading branch information
nyalldawson authored and wonder-sk committed Jan 4, 2021
1 parent fde80e3 commit c69b80453c06e14460508e6c9261514712f78f7b
@@ -56,8 +56,7 @@ Ctor

~QgsPointCloudDataProvider();


SIP_PYLIST identify( float maxErrorInMapCoords, QgsGeometry extentGeometry, const QgsDoubleRange extentZRange = QgsDoubleRange(), int pointsLimit = 1000 );
QVector<QVariantMap> identify( double maxErrorInMapCoords, const QgsGeometry &extentGeometry, const QgsDoubleRange &extentZRange = QgsDoubleRange(), int pointsLimit = 1000 );
%Docstring
Returns the list of points of the point cloud according to a zoom level
defined by ``maxErrorInMapCoords``, an extent ``geometry`` in the 2D plane
@@ -71,23 +70,6 @@ the number of points returned to ``pointsLimit`` points
this function does not handle elevation properties and you need to
change elevation coordinates yourself after returning from the function
%End
%MethodCode
{
QVector<QMap<QString, QVariant>> res = sipCpp->identify( a0, *a1, *a2, a3 );
sipRes = PyList_New( res.size() );
for ( int i = 0; i < res.size(); ++i )
{
PyObject *dict = PyDict_New();
for ( QString key : res[i].keys() )
{
PyObject *keyObj = sipConvertFromNewType( new QString( key ), sipType_QString, Py_None );
PyObject *valObj = sipConvertFromNewType( new QVariant( res[i][key] ), sipType_QVariant, Py_None );
PyDict_SetItem( dict, keyObj, valObj );
}
PyList_SET_ITEM( sipRes, i, dict );
}
}
%End

virtual QgsPointCloudDataProvider::Capabilities capabilities() const;
%Docstring
@@ -74,8 +74,6 @@ class CORE_EXPORT QgsPointCloudDataProvider: public QgsDataProvider

~QgsPointCloudDataProvider() override;

#ifndef SIP_RUN

/**
* Returns the list of points of the point cloud according to a zoom level
* defined by \a maxErrorInMapCoords, an extent \a geometry in the 2D plane
@@ -88,38 +86,6 @@ class CORE_EXPORT QgsPointCloudDataProvider: public QgsDataProvider
* change elevation coordinates yourself after returning from the function
*/
QVector<QVariantMap> identify( double maxErrorInMapCoords, const QgsGeometry &extentGeometry, const QgsDoubleRange &extentZRange = QgsDoubleRange(), int pointsLimit = 1000 );
#else

/**
* Returns the list of points of the point cloud according to a zoom level
* defined by \a maxErrorInMapCoords, an extent \a geometry in the 2D plane
* and a range \a extentZRange for z values. The function will try to limit
* the number of points returned to \a pointsLimit points
*
* \a maxErrorPixels : maximum accepted error factor in pixels
*
* \note this function does not handle elevation properties and you need to
* change elevation coordinates yourself after returning from the function
*/
SIP_PYLIST identify( float maxErrorInMapCoords, QgsGeometry extentGeometry, const QgsDoubleRange extentZRange = QgsDoubleRange(), int pointsLimit = 1000 );
% MethodCode
{
QVector<QMap<QString, QVariant>> res = sipCpp->identify( a0, *a1, *a2, a3 );
sipRes = PyList_New( res.size() );
for ( int i = 0; i < res.size(); ++i )
{
PyObject *dict = PyDict_New();
for ( QString key : res[i].keys() )
{
PyObject *keyObj = sipConvertFromNewType( new QString( key ), sipType_QString, Py_None );
PyObject *valObj = sipConvertFromNewType( new QVariant( res[i][key] ), sipType_QVariant, Py_None );
PyDict_SetItem( dict, keyObj, valObj );
}
PyList_SET_ITEM( sipRes, i, dict );
}
}
% End
#endif

/**
* Returns flags containing the supported capabilities for the data provider.

0 comments on commit c69b804

Please sign in to comment.
You can’t perform that action at this time.