Skip to content
Permalink
Browse files

Use QVariantMap instead of QMap<QString, QVariant>

  • Loading branch information
nyalldawson authored and wonder-sk committed Jan 4, 2021
1 parent 28dc2a7 commit 8f63af56a998facd3c07cf06ffdecb9815198be0
@@ -125,7 +125,7 @@ Constructor for QgsPointCloudClassifiedRenderer.

virtual void renderBlock( const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context );

virtual bool willRenderPoint( const QMap<QString, QVariant> &pointAttributes );
virtual bool willRenderPoint( const QVariantMap &pointAttributes );

virtual QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const;

@@ -134,7 +134,7 @@ void QgsPointCloudClassifiedRenderer::renderBlock( const QgsPointCloudBlock *blo
context.incrementPointsRendered( rendered );
}

bool QgsPointCloudClassifiedRenderer::willRenderPoint( const QMap<QString, QVariant> &pointAttributes )
bool QgsPointCloudClassifiedRenderer::willRenderPoint( const QVariantMap &pointAttributes )
{
if ( !pointAttributes.contains( mAttribute ) )
return false;
@@ -128,7 +128,7 @@ class CORE_EXPORT QgsPointCloudClassifiedRenderer : public QgsPointCloudRenderer
QString type() const override;
QgsPointCloudRenderer *clone() const override;
void renderBlock( const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context ) override;
bool willRenderPoint( const QMap<QString, QVariant> &pointAttributes ) override;
bool willRenderPoint( const QVariantMap &pointAttributes ) override;
QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
QSet< QString > usedAttributes( const QgsPointCloudRenderContext &context ) const override;
QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) override SIP_FACTORY;
@@ -204,10 +204,11 @@ static double _pointZ( const char *ptr, int i, int pointRecordSize, int zOffset,
/**
* Retrieves all the attributes of a point
*/
QMap<QString, QVariant> _attributeMap( const char *data, std::size_t recordOffset, const QgsPointCloudAttributeCollection &attributeCollection )
QVariantMap _attributeMap( const char *data, std::size_t recordOffset, const QgsPointCloudAttributeCollection &attributeCollection )
{
QMap<QString, QVariant> map;
for ( QgsPointCloudAttribute attr : attributeCollection.attributes() )
QVariantMap map;
const QVector<QgsPointCloudAttribute> attributes = attributeCollection.attributes();
for ( const QgsPointCloudAttribute &attr : attributes )
{
QString attributeName = attr.name();
int attributeOffset;
@@ -269,9 +270,9 @@ struct MapIndexedPointCloudNode
: mRequest( request ), mIndexScale( indexScale ), mIndexOffset( indexOffset ), mExtentGeometry( extentGeometry ), mZRange( zRange ), mIndex( index ), mPointsLimit( pointsLimit )
{ }

QVector<QMap<QString, QVariant>> operator()( const IndexedPointCloudNode &n )
QVector<QVariantMap> operator()( IndexedPointCloudNode n )
{
QVector<QMap<QString, QVariant>> acceptedPoints;
QVector<QVariantMap> acceptedPoints;
std::unique_ptr<QgsPointCloudBlock> block( mIndex->nodeData( n, mRequest ) );

if ( !block || pointsCount == mPointsLimit )
@@ -295,7 +296,7 @@ struct MapIndexedPointCloudNode

if ( mZRange.contains( z ) && extentEngine->contains( &pointXY ) )
{
QMap<QString, QVariant> pointAttr = _attributeMap( ptr, i * recordSize, blockAttributes );
QVariantMap pointAttr = _attributeMap( ptr, i * recordSize, blockAttributes );
pointAttr[ QStringLiteral( "X" ) ] = x;
pointAttr[ QStringLiteral( "Y" ) ] = y;
pointAttr[ QStringLiteral( "Z" ) ] = z;
@@ -316,12 +317,12 @@ struct MapIndexedPointCloudNode
int pointsCount = 0;
};

QVector<QMap<QString, QVariant>> QgsPointCloudDataProvider::identify(
float maxErrorInMapCoords,
const QgsGeometry &extentGeometry,
const QgsDoubleRange extentZRange, int pointsLimit )
QVector<QVariantMap> QgsPointCloudDataProvider::identify(
double maxErrorInMapCoords,
const QgsGeometry &extentGeometry,
const QgsDoubleRange &extentZRange, int pointsLimit )
{
QVector<QMap<QString, QVariant>> acceptedPoints;
QVector<QVariantMap> acceptedPoints;

QgsPointCloudIndex *index = this->index();
const IndexedPointCloudNode root = index->root();
@@ -87,7 +87,7 @@ class CORE_EXPORT QgsPointCloudDataProvider: public QgsDataProvider
* \note this function does not handle elevation properties and you need to
* change elevation coordinates yourself after returning from the function
*/
QVector<QMap<QString, QVariant>> identify( float maxErrorInMapCoords, const QgsGeometry &extentGeometry, const QgsDoubleRange extentZRange = QgsDoubleRange(), int pointsLimit = 1000 );
QVector<QVariantMap> identify( double maxErrorInMapCoords, const QgsGeometry &extentGeometry, const QgsDoubleRange &extentZRange = QgsDoubleRange(), int pointsLimit = 1000 );
#else

/**
@@ -195,9 +195,9 @@ void QgsPointCloudRenderer::setPointSymbol( PointSymbol symbol )
mPointSymbol = symbol;
}

QVector<QMap<QString, QVariant>> QgsPointCloudRenderer::identify( QgsPointCloudLayer *layer, QgsRenderContext renderContext, const QgsGeometry &geometry )
QVector<QVariantMap> QgsPointCloudRenderer::identify( QgsPointCloudLayer *layer, const QgsRenderContext &renderContext, const QgsGeometry &geometry )
{
QVector<QMap<QString, QVariant>> selectedPoints;
QVector<QVariantMap> selectedPoints;

QgsPointCloudIndex *index = layer->dataProvider()->index();
const IndexedPointCloudNode root = index->root();
@@ -285,7 +285,7 @@ class CORE_EXPORT QgsPointCloudRenderer
* Returns the list of visible points of the point cloud layer \a layer and an extent defined by
* a geometry in the 2D plane \a geometry.
*/
QVector<QMap<QString, QVariant>> identify( QgsPointCloudLayer *layer, QgsRenderContext context, const QgsGeometry &geometry ) SIP_SKIP;
QVector<QVariantMap> identify( QgsPointCloudLayer *layer, const QgsRenderContext &context, const QgsGeometry &geometry ) SIP_SKIP;

/**
* Checks whether the point holding \a pointAttributes attributes will be rendered

0 comments on commit 8f63af5

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