Fix python build

This commit is contained in:
Nyall Dawson 2023-03-06 12:23:10 +10:00
parent 1938f6e255
commit 4adc1c8278
3 changed files with 50 additions and 4 deletions

View File

@ -42,7 +42,9 @@ Constructor version used with only expressions to filter symbols (no extent or p
Runs the map hit test
%End
QMap<QString, QSet<QString>> results() const;
QMap<QString, QList<QString>> resultsPy() const /PyName=results/;
%Docstring
Returns the hit test results, which are a map of layer ID to
visible symbol legend keys.
@ -107,7 +109,9 @@ Constructor for QgsMapHitTestTask, filtering by expressions.
:param layerFilterExpression: Expression string for each layer id to evaluate in order to refine the symbol selection
%End
QMap<QString, QSet<QString>> results() const;
QMap<QString, QList<QString>> resultsPy() const /PyName=results/;
%Docstring
Returns the hit test results, which are a map of layer ID to
visible symbol legend keys.

View File

@ -96,6 +96,16 @@ QMap<QString, QSet<QString> > QgsMapHitTest::results() const
return mHitTestRuleKey;
}
QMap<QString, QList<QString> > QgsMapHitTest::resultsPy() const
{
QMap<QString, QList<QString> > res;
for ( auto it = mHitTestRuleKey.begin(); it != mHitTestRuleKey.end(); ++it )
{
res.insert( it.key(), qgis::setToList( it.value() ) );
}
return res;
}
bool QgsMapHitTest::symbolVisible( QgsSymbol *symbol, QgsVectorLayer *layer ) const
{
if ( !symbol || !layer )
@ -296,6 +306,16 @@ QMap<QString, QSet<QString> > QgsMapHitTestTask::results() const
return mResults;
}
QMap<QString, QList<QString> > QgsMapHitTestTask::resultsPy() const
{
QMap<QString, QList<QString> > res;
for ( auto it = mResults.begin(); it != mResults.end(); ++it )
{
res.insert( it.key(), qgis::setToList( it.value() ) );
}
return res;
}
void QgsMapHitTestTask::prepare()
{
const QList< QgsMapLayer * > layers = mSettings.layers( true );

View File

@ -61,9 +61,21 @@ class CORE_EXPORT QgsMapHitTest
* Returns the hit test results, which are a map of layer ID to
* visible symbol legend keys.
*
* \note Not available in Python bindings
* \since QGIS 3.32
*/
QMap<QString, QSet<QString>> results() const;
QMap<QString, QSet<QString>> results() const SIP_SKIP;
///@cond PRIVATE
/**
* Returns the hit test results, which are a map of layer ID to
* visible symbol legend keys.
*
* \since QGIS 3.32
*/
QMap<QString, QList<QString>> resultsPy() const SIP_PYNAME( results );
///@endcond PRIVATE
/**
* Tests whether a symbol is visible for a specified layer.
@ -164,8 +176,18 @@ class CORE_EXPORT QgsMapHitTestTask : public QgsTask
/**
* Returns the hit test results, which are a map of layer ID to
* visible symbol legend keys.
* \note Not available in Python bindings
*/
QMap<QString, QSet<QString>> results() const;
QMap<QString, QSet<QString>> results() const SIP_SKIP;
///@cond PRIVATE
/**
* Returns the hit test results, which are a map of layer ID to
* visible symbol legend keys.
*/
QMap<QString, QList<QString>> resultsPy() const SIP_PYNAME( results );
///@endcond PRIVATE
void cancel() override;