Skip to content

Commit

Permalink
Fix clang-tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 13, 2024
1 parent cd63b0f commit fe4e900
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/3d/qgs3dutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ void Qgs3DUtils::extractPointPositions( const QgsFeature &f, const Qgs3DRenderCo
{
geomZ = pt.z();
}
const float terrainZ = context.terrainRenderingEnabled() && context.terrainGenerator() ? context.terrainGenerator()->heightAt( pt.x(), pt.y(), context ) * context.terrainSettings()->verticalScale() : 0;
const float terrainZ = context.terrainRenderingEnabled() && context.terrainGenerator() ? static_cast<float>( context.terrainGenerator()->heightAt( pt.x(), pt.y(), context ) * context.terrainSettings()->verticalScale() ) : 0.f;
float h = 0.0f;
switch ( altClamp )
{
Expand Down
6 changes: 3 additions & 3 deletions src/3d/qgsrulebasedchunkloader_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ QgsRuleBasedChunkedEntity::QgsRuleBasedChunkedEntity( Qgs3DMapSettings *map, Qgs
mTransform = new Qt3DCore::QTransform;
if ( applyTerrainOffset() )
{
mTransform->setTranslation( QVector3D( 0.0f, map->terrainSettings()->elevationOffset(), 0.0f ) );
mTransform->setTranslation( QVector3D( 0.0f, static_cast<float>( map->terrainSettings()->elevationOffset() ), 0.0f ) );
}
this->addComponent( mTransform );
connect( map, &Qgs3DMapSettings::terrainSettingsChanged, this, &QgsRuleBasedChunkedEntity::onTerrainElevationOffsetChanged );
Expand Down Expand Up @@ -256,8 +256,8 @@ bool QgsRuleBasedChunkedEntity::applyTerrainOffset() const

void QgsRuleBasedChunkedEntity::onTerrainElevationOffsetChanged()
{
float previousOffset = mTransform->translation()[1];
float newOffset = qobject_cast<Qgs3DMapSettings *>( sender() )->terrainSettings()->elevationOffset();
const float previousOffset = mTransform->translation()[1];
float newOffset = static_cast<float>( qobject_cast<Qgs3DMapSettings *>( sender() )->terrainSettings()->elevationOffset() );
if ( !applyTerrainOffset() )
{
newOffset = 0.0;
Expand Down
4 changes: 2 additions & 2 deletions src/3d/qgsvectorlayerchunkloader_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ QgsVectorLayerChunkedEntity::QgsVectorLayerChunkedEntity( Qgs3DMapSettings *map,
mTransform = new Qt3DCore::QTransform;
if ( applyTerrainOffset() )
{
mTransform->setTranslation( QVector3D( 0.0f, map->terrainSettings()->elevationOffset(), 0.0f ) );
mTransform->setTranslation( QVector3D( 0.0f, static_cast<float>( map->terrainSettings()->elevationOffset() ), 0.0f ) );
}
this->addComponent( mTransform );

Expand Down Expand Up @@ -250,7 +250,7 @@ bool QgsVectorLayerChunkedEntity::applyTerrainOffset() const
void QgsVectorLayerChunkedEntity::onTerrainElevationOffsetChanged()
{
QgsDebugMsgLevel( QStringLiteral( "QgsVectorLayerChunkedEntity::onTerrainElevationOffsetChanged" ), 2 );
float newOffset = qobject_cast<Qgs3DMapSettings *>( sender() )->terrainSettings()->elevationOffset();
float newOffset = static_cast<float>( qobject_cast<Qgs3DMapSettings *>( sender() )->terrainSettings()->elevationOffset() );
if ( !applyTerrainOffset() )
{
newOffset = 0.0;
Expand Down

0 comments on commit fe4e900

Please sign in to comment.