Skip to content

Commit

Permalink
Fix some clazy/clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson authored and wonder-sk committed Jan 4, 2021
1 parent d045f75 commit e14750e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/core/pointcloud/qgspointclouddataprovider.cpp
Expand Up @@ -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 );
Expand All @@ -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;
Expand Down Expand Up @@ -305,7 +305,7 @@ struct MapIndexedPointCloudNode
}
}
return acceptedPoints;
};
}

QgsPointCloudRequest &mRequest;
QgsVector3D mIndexScale;
Expand All @@ -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 );

Expand All @@ -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;

Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/core/pointcloud/qgspointclouddataprovider.h
Expand Up @@ -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
6 changes: 3 additions & 3 deletions src/core/pointcloud/qgspointcloudrenderer.cpp
Expand Up @@ -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
Expand All @@ -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 ) )
Expand All @@ -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 )
Expand Down

0 comments on commit e14750e

Please sign in to comment.