Skip to content
Permalink
Browse files

Fix some clazy/clang warnings

  • Loading branch information
nyalldawson authored and wonder-sk committed Jan 4, 2021
1 parent d045f75 commit e14750e97d6b21e499c453ed401ab6bdb2ba09e5
@@ -184,7 +184,7 @@ QVariant QgsPointCloudDataProvider::metadataClassStatistic( const QString &, con
/**
* Retrieves the x & y values for the point at index \a i.
*/
static void _pointXY( const char *ptr, int i, int pointRecordSize, int xOffset, int yOffset, QgsVector3D indexScale, QgsVector3D indexOffset, double &x, double &y )
static void _pointXY( const char *ptr, int i, std::size_t pointRecordSize, int xOffset, int yOffset, const QgsVector3D &indexScale, const QgsVector3D &indexOffset, double &x, double &y )
{
const qint32 ix = *reinterpret_cast< const qint32 * >( ptr + i * pointRecordSize + xOffset );
const qint32 iy = *reinterpret_cast< const qint32 * >( ptr + i * pointRecordSize + yOffset );
@@ -195,7 +195,7 @@ static void _pointXY( const char *ptr, int i, int pointRecordSize, int xOffset,
/**
* Retrieves the z value for the point at index \a i.
*/
static double _pointZ( const char *ptr, int i, int pointRecordSize, int zOffset, QgsVector3D indexScale, QgsVector3D indexOffset )
static double _pointZ( const char *ptr, int i, std::size_t pointRecordSize, int zOffset, const QgsVector3D &indexScale, const QgsVector3D &indexOffset )
{
const qint32 iz = *reinterpret_cast<const qint32 * >( ptr + i * pointRecordSize + zOffset );
return indexOffset.z() + indexScale.z() * iz;
@@ -305,7 +305,7 @@ struct MapIndexedPointCloudNode
}
}
return acceptedPoints;
};
}

QgsPointCloudRequest &mRequest;
QgsVector3D mIndexScale;
@@ -328,7 +328,7 @@ QVector<QVariantMap> QgsPointCloudDataProvider::identify(
const IndexedPointCloudNode root = index->root();

QgsRectangle rootNodeExtentMapCoords = index->nodeMapExtent( root );
const float rootErrorInMapCoordinates = rootNodeExtentMapCoords.width() / index->span();
const double rootErrorInMapCoordinates = rootNodeExtentMapCoords.width() / index->span();

QVector<IndexedPointCloudNode> nodes = traverseTree( index, root, maxErrorInMapCoords, rootErrorInMapCoordinates, extentGeometry, extentZRange );

@@ -347,10 +347,10 @@ QVector<QVariantMap> QgsPointCloudDataProvider::identify(
QVector<IndexedPointCloudNode> QgsPointCloudDataProvider::traverseTree(
const QgsPointCloudIndex *pc,
IndexedPointCloudNode n,
float maxError,
float nodeError,
double maxError,
double nodeError,
const QgsGeometry &extentGeometry,
const QgsDoubleRange extentZRange )
const QgsDoubleRange &extentZRange )
{
QVector<IndexedPointCloudNode> nodes;

@@ -363,7 +363,7 @@ QVector<IndexedPointCloudNode> QgsPointCloudDataProvider::traverseTree(

nodes.append( n );

float childrenError = nodeError / 2.0f;
double childrenError = nodeError / 2.0;
if ( childrenError < maxError )
return nodes;

@@ -343,7 +343,7 @@ class CORE_EXPORT QgsPointCloudDataProvider: public QgsDataProvider
void indexGenerationStateChanged( PointCloudIndexGenerationState state );

private:
QVector<IndexedPointCloudNode> traverseTree( const QgsPointCloudIndex *pc, IndexedPointCloudNode n, float maxError, float nodeError, const QgsGeometry &extentGeometry, const QgsDoubleRange extentZRange );
QVector<IndexedPointCloudNode> traverseTree( const QgsPointCloudIndex *pc, IndexedPointCloudNode n, double maxError, double nodeError, const QgsGeometry &extentGeometry, const QgsDoubleRange &extentZRange );
};

#endif // QGSMESHDATAPROVIDER_H
@@ -202,7 +202,7 @@ QVector<QVariantMap> QgsPointCloudRenderer::identify( QgsPointCloudLayer *layer,
QgsPointCloudIndex *index = layer->dataProvider()->index();
const IndexedPointCloudNode root = index->root();

const float maxErrorPixels = renderContext.convertToPainterUnits( maximumScreenError(), maximumScreenErrorUnit() );// in pixels
const double maxErrorPixels = renderContext.convertToPainterUnits( maximumScreenError(), maximumScreenErrorUnit() );// in pixels

QgsRectangle rootNodeExtentMapCoords = index->nodeMapExtent( root );
try
@@ -214,7 +214,7 @@ QVector<QVariantMap> QgsPointCloudRenderer::identify( QgsPointCloudLayer *layer,
QgsDebugMsg( QStringLiteral( "Could not transform node extent to map CRS" ) );
}

const float rootErrorInMapCoordinates = rootNodeExtentMapCoords.width() / index->span(); // in map coords
const double rootErrorInMapCoordinates = rootNodeExtentMapCoords.width() / index->span(); // in map coords

double mapUnitsPerPixel = renderContext.mapToPixel().mapUnitsPerPixel();
if ( ( rootErrorInMapCoordinates < 0.0 ) || ( mapUnitsPerPixel < 0.0 ) || ( maxErrorPixels < 0.0 ) )
@@ -223,7 +223,7 @@ QVector<QVariantMap> QgsPointCloudRenderer::identify( QgsPointCloudLayer *layer,
return selectedPoints;
}

float maxErrorInMapCoordinates = maxErrorPixels * mapUnitsPerPixel;
double maxErrorInMapCoordinates = maxErrorPixels * mapUnitsPerPixel;

QgsGeometry selectionGeometry = geometry;
if ( geometry.type() == QgsWkbTypes::PointGeometry )

0 comments on commit e14750e

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