Skip to content

Commit 5e37e82

Browse files
committed
Apply clang-tidy modernization checks
1 parent 1201df5 commit 5e37e82

File tree

66 files changed

+114
-230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+114
-230
lines changed

src/3d/qgs3dmapscene.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343

4444

4545
Qgs3DMapScene::Qgs3DMapScene( const Qgs3DMapSettings &map, QgsAbstract3DEngine *engine )
46-
: Qt3DCore::QEntity()
47-
, mMap( map )
46+
: mMap( map )
4847
, mEngine( engine )
4948
{
5049

src/3d/qgsoffscreen3dengine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class _3D_EXPORT QgsOffscreen3DEngine : public QgsAbstract3DEngine
6363
Q_OBJECT
6464
public:
6565
QgsOffscreen3DEngine();
66-
~QgsOffscreen3DEngine();
66+
~QgsOffscreen3DEngine() override;
6767

6868
//! Sets the size of the rendering area (in pixels)
6969
void setSize( const QSize &s );

src/3d/qgsraycastingutils_p.cpp

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,21 @@ namespace QgsRayCastingUtils
3232

3333
Ray3D::Ray3D()
3434
: m_direction( 0.0f, 0.0f, 1.0f )
35-
, m_distance( 1.0f )
3635
{
3736
}
3837

39-
Ray3D::Ray3D( const QVector3D &origin, const QVector3D &direction, float distance )
38+
Ray3D::Ray3D( QVector3D origin, QVector3D direction, float distance )
4039
: m_origin( origin )
4140
, m_direction( direction )
4241
, m_distance( distance )
4342
{}
4443

45-
Ray3D::~Ray3D()
46-
{
47-
}
48-
4944
QVector3D Ray3D::origin() const
5045
{
5146
return m_origin;
5247
}
5348

54-
void Ray3D::setOrigin( const QVector3D &value )
49+
void Ray3D::setOrigin( QVector3D value )
5550
{
5651
m_origin = value;
5752
}
@@ -61,7 +56,7 @@ namespace QgsRayCastingUtils
6156
return m_direction;
6257
}
6358

64-
void Ray3D::setDirection( const QVector3D &value )
59+
void Ray3D::setDirection( QVector3D value )
6560
{
6661
if ( value.isNull() )
6762
return;
@@ -107,7 +102,7 @@ namespace QgsRayCastingUtils
107102
return !( *this == other );
108103
}
109104

110-
bool Ray3D::contains( const QVector3D &point ) const
105+
bool Ray3D::contains( QVector3D point ) const
111106
{
112107
QVector3D ppVec( point - m_origin );
113108
if ( ppVec.isNull() ) // point coincides with origin
@@ -126,22 +121,22 @@ namespace QgsRayCastingUtils
126121
return contains( ray.origin() );
127122
}
128123

129-
float Ray3D::projectedDistance( const QVector3D &point ) const
124+
float Ray3D::projectedDistance( QVector3D point ) const
130125
{
131126
Q_ASSERT( !m_direction.isNull() );
132127

133128
return QVector3D::dotProduct( point - m_origin, m_direction ) /
134129
m_direction.lengthSquared();
135130
}
136131

137-
QVector3D Ray3D::project( const QVector3D &vector ) const
132+
QVector3D Ray3D::project( QVector3D vector ) const
138133
{
139134
QVector3D norm = m_direction.normalized();
140135
return QVector3D::dotProduct( vector, norm ) * norm;
141136
}
142137

143138

144-
float Ray3D::distance( const QVector3D &point ) const
139+
float Ray3D::distance( QVector3D point ) const
145140
{
146141
float t = projectedDistance( point );
147142
return ( point - ( m_origin + t * m_direction ) ).length();
@@ -198,7 +193,7 @@ struct ray
198193
// https://tavianator.com/fast-branchless-raybounding-box-intersections/
199194
// https://tavianator.com/fast-branchless-raybounding-box-intersections-part-2-nans/
200195

201-
bool intersection( box b, ray r )
196+
bool intersection( const box &b, const ray &r )
202197
{
203198
double t1 = ( b.min[0] - r.origin[0] ) * r.dir_inv[0];
204199
double t2 = ( b.max[0] - r.origin[0] ) * r.dir_inv[0];
@@ -253,9 +248,9 @@ namespace QgsRayCastingUtils
253248
// copied from intersectsSegmentTriangle() from qt3d/src/render/backend/triangleboundingvolume.cpp
254249
// by KDAB, licensed under the terms of LGPL
255250
bool rayTriangleIntersection( const Ray3D &ray,
256-
const QVector3D &a,
257-
const QVector3D &b,
258-
const QVector3D &c,
251+
QVector3D a,
252+
QVector3D b,
253+
QVector3D c,
259254
QVector3D &uvw,
260255
float &t )
261256
{
@@ -305,7 +300,7 @@ namespace QgsRayCastingUtils
305300

306301

307302

308-
static QRect windowViewport( const QSize &area, const QRectF &relativeViewport )
303+
static QRect windowViewport( QSize area, const QRectF &relativeViewport )
309304
{
310305
if ( area.isValid() )
311306
{
@@ -320,8 +315,8 @@ static QRect windowViewport( const QSize &area, const QRectF &relativeViewport )
320315
}
321316

322317

323-
static QgsRayCastingUtils::Ray3D intersectionRay( const QPointF &pos, const QMatrix4x4 &viewMatrix,
324-
const QMatrix4x4 &projectionMatrix, const QRect &viewport )
318+
static QgsRayCastingUtils::Ray3D intersectionRay( QPointF pos, const QMatrix4x4 &viewMatrix,
319+
const QMatrix4x4 &projectionMatrix, QRect viewport )
325320
{
326321
// if something seems wrong slightly off with the returned intersection rays,
327322
// it may be the case that unproject() has hit qFuzzyIsNull() condition inside
@@ -342,8 +337,8 @@ static QgsRayCastingUtils::Ray3D intersectionRay( const QPointF &pos, const QMat
342337
namespace QgsRayCastingUtils
343338
{
344339

345-
Ray3D rayForViewportAndCamera( const QSize &area,
346-
const QPointF &pos,
340+
Ray3D rayForViewportAndCamera( QSize area,
341+
QPointF pos,
347342
const QRectF &relativeViewport,
348343
const Qt3DRender::QCamera *camera )
349344
{

src/3d/qgsraycastingutils_p.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,26 @@ namespace QgsRayCastingUtils
4949
{
5050
public:
5151
Ray3D();
52-
explicit Ray3D( const QVector3D &origin, const QVector3D &direction = QVector3D( 0.0f, 0.0f, 1.0f ), float distance = 1.0f );
53-
~Ray3D();
52+
explicit Ray3D( QVector3D origin, QVector3D direction = QVector3D( 0.0f, 0.0f, 1.0f ), float distance = 1.0f );
5453

5554
QVector3D origin() const;
56-
void setOrigin( const QVector3D &value );
55+
void setOrigin( QVector3D value );
5756

5857
QVector3D direction() const;
59-
void setDirection( const QVector3D &value );
58+
void setDirection( QVector3D value );
6059

6160
float distance() const;
6261
void setDistance( float distance );
6362

64-
bool contains( const QVector3D &point ) const;
63+
bool contains( QVector3D point ) const;
6564
bool contains( const Ray3D &ray ) const;
6665

6766
QVector3D point( float t ) const;
68-
float projectedDistance( const QVector3D &point ) const;
67+
float projectedDistance( QVector3D point ) const;
6968

70-
QVector3D project( const QVector3D &vector ) const;
69+
QVector3D project( QVector3D vector ) const;
7170

72-
float distance( const QVector3D &point ) const;
71+
float distance( QVector3D point ) const;
7372

7473
Ray3D &transform( const QMatrix4x4 &matrix );
7574
Ray3D transformed( const QMatrix4x4 &matrix ) const;
@@ -80,7 +79,7 @@ namespace QgsRayCastingUtils
8079
private:
8180
QVector3D m_origin;
8281
QVector3D m_direction;
83-
float m_distance;
82+
float m_distance = 1.0f;
8483
};
8584

8685
/**
@@ -111,9 +110,9 @@ namespace QgsRayCastingUtils
111110
* \since QGIS 3.4
112111
*/
113112
bool rayTriangleIntersection( const Ray3D &ray,
114-
const QVector3D &a,
115-
const QVector3D &b,
116-
const QVector3D &c,
113+
QVector3D a,
114+
QVector3D b,
115+
QVector3D c,
117116
QVector3D &uvw,
118117
float &t );
119118

src/analysis/interpolation/NormVecDecorator.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ NormVecDecorator::~NormVecDecorator()
3333

3434
delete mNormVec;
3535
delete mPointState;
36-
37-
if ( mTIN )
38-
{
39-
delete mTIN;
40-
}
36+
delete mTIN;
4137
}
4238

4339
int NormVecDecorator::addPoint( const QgsPoint &p )

src/analysis/processing/qgsalgorithmdifference.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ QVariantMap QgsDifferenceAlgorithm::processAlgorithm( const QVariantMap &paramet
8282

8383
int count = 0;
8484
int total = sourceA->featureCount();
85-
QgsOverlayUtils::difference( *sourceA.get(), *sourceB.get(), *sink.get(), context, feedback, count, total, QgsOverlayUtils::OutputA );
85+
QgsOverlayUtils::difference( *sourceA, *sourceB, *sink, context, feedback, count, total, QgsOverlayUtils::OutputA );
8686

8787
return outputs;
8888
}

src/analysis/processing/qgsalgorithmintersection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ QVariantMap QgsIntersectionAlgorithm::processAlgorithm( const QVariantMap &param
106106
int count = 0;
107107
int total = sourceA->featureCount();
108108

109-
QgsOverlayUtils::intersection( *sourceA.get(), *sourceB.get(), *sink.get(), context, feedback, count, total, fieldIndicesA, fieldIndicesB );
109+
QgsOverlayUtils::intersection( *sourceA, *sourceB, *sink, context, feedback, count, total, fieldIndicesA, fieldIndicesB );
110110

111111
return outputs;
112112
}

src/analysis/processing/qgsalgorithmreclassifybylayer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class QgsReclassifyAlgorithmBase : public QgsProcessingAlgorithm
3333
{
3434
public:
3535

36-
QString group() const override final;
37-
QString groupId() const override final;
38-
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override final;
36+
QString group() const final;
37+
QString groupId() const final;
38+
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) final;
3939

4040
protected:
4141

@@ -45,7 +45,7 @@ class QgsReclassifyAlgorithmBase : public QgsProcessingAlgorithm
4545
*/
4646
virtual void addAlgorithmParams() = 0;
4747

48-
bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override final;
48+
bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
4949

5050
/**
5151
* Prepares the reclassify algorithm subclass for execution.
@@ -60,7 +60,7 @@ class QgsReclassifyAlgorithmBase : public QgsProcessingAlgorithm
6060
const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) = 0;
6161

6262
QVariantMap processAlgorithm( const QVariantMap &parameters,
63-
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override final;
63+
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
6464

6565
std::unique_ptr< QgsRasterInterface > mInterface;
6666

src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ QVariantMap QgsSymmetricalDifferenceAlgorithm::processAlgorithm( const QVariantM
8282
int count = 0;
8383
int total = sourceA->featureCount() + sourceB->featureCount();
8484

85-
QgsOverlayUtils::difference( *sourceA.get(), *sourceB.get(), *sink.get(), context, feedback, count, total, QgsOverlayUtils::OutputAB );
85+
QgsOverlayUtils::difference( *sourceA, *sourceB, *sink, context, feedback, count, total, QgsOverlayUtils::OutputAB );
8686

87-
QgsOverlayUtils::difference( *sourceB.get(), *sourceA.get(), *sink.get(), context, feedback, count, total, QgsOverlayUtils::OutputBA );
87+
QgsOverlayUtils::difference( *sourceB, *sourceA, *sink, context, feedback, count, total, QgsOverlayUtils::OutputBA );
8888

8989
return outputs;
9090
}

src/analysis/processing/qgsalgorithmunion.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ QVariantMap QgsUnionAlgorithm::processAlgorithm( const QVariantMap &parameters,
8383
if ( !sourceB )
8484
{
8585
// we are doing single layer union
86-
QgsOverlayUtils::resolveOverlaps( *sourceA.get(), *sink.get(), feedback );
86+
QgsOverlayUtils::resolveOverlaps( *sourceA, *sink, feedback );
8787
return outputs;
8888
}
8989

@@ -93,11 +93,11 @@ QVariantMap QgsUnionAlgorithm::processAlgorithm( const QVariantMap &parameters,
9393
int count = 0;
9494
int total = sourceA->featureCount() * 2 + sourceB->featureCount();
9595

96-
QgsOverlayUtils::intersection( *sourceA.get(), *sourceB.get(), *sink.get(), context, feedback, count, total, fieldIndicesA, fieldIndicesB );
96+
QgsOverlayUtils::intersection( *sourceA, *sourceB, *sink, context, feedback, count, total, fieldIndicesA, fieldIndicesB );
9797

98-
QgsOverlayUtils::difference( *sourceA.get(), *sourceB.get(), *sink.get(), context, feedback, count, total, QgsOverlayUtils::OutputAB );
98+
QgsOverlayUtils::difference( *sourceA, *sourceB, *sink, context, feedback, count, total, QgsOverlayUtils::OutputAB );
9999

100-
QgsOverlayUtils::difference( *sourceB.get(), *sourceA.get(), *sink.get(), context, feedback, count, total, QgsOverlayUtils::OutputBA );
100+
QgsOverlayUtils::difference( *sourceB, *sourceA, *sink, context, feedback, count, total, QgsOverlayUtils::OutputBA );
101101

102102
return outputs;
103103
}

0 commit comments

Comments
 (0)