Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Apply clang-tidy modernization checks
  • Loading branch information
nyalldawson committed Jul 23, 2018
1 parent 1201df5 commit 5e37e82
Show file tree
Hide file tree
Showing 66 changed files with 114 additions and 230 deletions.
3 changes: 1 addition & 2 deletions src/3d/qgs3dmapscene.cpp
Expand Up @@ -43,8 +43,7 @@


Qgs3DMapScene::Qgs3DMapScene( const Qgs3DMapSettings &map, QgsAbstract3DEngine *engine )
: Qt3DCore::QEntity()
, mMap( map )
: mMap( map )
, mEngine( engine )
{

Expand Down
2 changes: 1 addition & 1 deletion src/3d/qgsoffscreen3dengine.h
Expand Up @@ -63,7 +63,7 @@ class _3D_EXPORT QgsOffscreen3DEngine : public QgsAbstract3DEngine
Q_OBJECT
public:
QgsOffscreen3DEngine();
~QgsOffscreen3DEngine();
~QgsOffscreen3DEngine() override;

//! Sets the size of the rendering area (in pixels)
void setSize( const QSize &s );
Expand Down
37 changes: 16 additions & 21 deletions src/3d/qgsraycastingutils_p.cpp
Expand Up @@ -32,26 +32,21 @@ namespace QgsRayCastingUtils

Ray3D::Ray3D()
: m_direction( 0.0f, 0.0f, 1.0f )
, m_distance( 1.0f )
{
}

Ray3D::Ray3D( const QVector3D &origin, const QVector3D &direction, float distance )
Ray3D::Ray3D( QVector3D origin, QVector3D direction, float distance )
: m_origin( origin )
, m_direction( direction )
, m_distance( distance )
{}

Ray3D::~Ray3D()
{
}

QVector3D Ray3D::origin() const
{
return m_origin;
}

void Ray3D::setOrigin( const QVector3D &value )
void Ray3D::setOrigin( QVector3D value )
{
m_origin = value;
}
Expand All @@ -61,7 +56,7 @@ namespace QgsRayCastingUtils
return m_direction;
}

void Ray3D::setDirection( const QVector3D &value )
void Ray3D::setDirection( QVector3D value )
{
if ( value.isNull() )
return;
Expand Down Expand Up @@ -107,7 +102,7 @@ namespace QgsRayCastingUtils
return !( *this == other );
}

bool Ray3D::contains( const QVector3D &point ) const
bool Ray3D::contains( QVector3D point ) const
{
QVector3D ppVec( point - m_origin );
if ( ppVec.isNull() ) // point coincides with origin
Expand All @@ -126,22 +121,22 @@ namespace QgsRayCastingUtils
return contains( ray.origin() );
}

float Ray3D::projectedDistance( const QVector3D &point ) const
float Ray3D::projectedDistance( QVector3D point ) const
{
Q_ASSERT( !m_direction.isNull() );

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

QVector3D Ray3D::project( const QVector3D &vector ) const
QVector3D Ray3D::project( QVector3D vector ) const
{
QVector3D norm = m_direction.normalized();
return QVector3D::dotProduct( vector, norm ) * norm;
}


float Ray3D::distance( const QVector3D &point ) const
float Ray3D::distance( QVector3D point ) const
{
float t = projectedDistance( point );
return ( point - ( m_origin + t * m_direction ) ).length();
Expand Down Expand Up @@ -198,7 +193,7 @@ struct ray
// https://tavianator.com/fast-branchless-raybounding-box-intersections/
// https://tavianator.com/fast-branchless-raybounding-box-intersections-part-2-nans/

bool intersection( box b, ray r )
bool intersection( const box &b, const ray &r )
{
double t1 = ( b.min[0] - r.origin[0] ) * r.dir_inv[0];
double t2 = ( b.max[0] - r.origin[0] ) * r.dir_inv[0];
Expand Down Expand Up @@ -253,9 +248,9 @@ namespace QgsRayCastingUtils
// copied from intersectsSegmentTriangle() from qt3d/src/render/backend/triangleboundingvolume.cpp
// by KDAB, licensed under the terms of LGPL
bool rayTriangleIntersection( const Ray3D &ray,
const QVector3D &a,
const QVector3D &b,
const QVector3D &c,
QVector3D a,
QVector3D b,
QVector3D c,
QVector3D &uvw,
float &t )
{
Expand Down Expand Up @@ -305,7 +300,7 @@ namespace QgsRayCastingUtils



static QRect windowViewport( const QSize &area, const QRectF &relativeViewport )
static QRect windowViewport( QSize area, const QRectF &relativeViewport )
{
if ( area.isValid() )
{
Expand All @@ -320,8 +315,8 @@ static QRect windowViewport( const QSize &area, const QRectF &relativeViewport )
}


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

Ray3D rayForViewportAndCamera( const QSize &area,
const QPointF &pos,
Ray3D rayForViewportAndCamera( QSize area,
QPointF pos,
const QRectF &relativeViewport,
const Qt3DRender::QCamera *camera )
{
Expand Down
23 changes: 11 additions & 12 deletions src/3d/qgsraycastingutils_p.h
Expand Up @@ -49,27 +49,26 @@ namespace QgsRayCastingUtils
{
public:
Ray3D();
explicit Ray3D( const QVector3D &origin, const QVector3D &direction = QVector3D( 0.0f, 0.0f, 1.0f ), float distance = 1.0f );
~Ray3D();
explicit Ray3D( QVector3D origin, QVector3D direction = QVector3D( 0.0f, 0.0f, 1.0f ), float distance = 1.0f );

QVector3D origin() const;
void setOrigin( const QVector3D &value );
void setOrigin( QVector3D value );

QVector3D direction() const;
void setDirection( const QVector3D &value );
void setDirection( QVector3D value );

float distance() const;
void setDistance( float distance );

bool contains( const QVector3D &point ) const;
bool contains( QVector3D point ) const;
bool contains( const Ray3D &ray ) const;

QVector3D point( float t ) const;
float projectedDistance( const QVector3D &point ) const;
float projectedDistance( QVector3D point ) const;

QVector3D project( const QVector3D &vector ) const;
QVector3D project( QVector3D vector ) const;

float distance( const QVector3D &point ) const;
float distance( QVector3D point ) const;

Ray3D &transform( const QMatrix4x4 &matrix );
Ray3D transformed( const QMatrix4x4 &matrix ) const;
Expand All @@ -80,7 +79,7 @@ namespace QgsRayCastingUtils
private:
QVector3D m_origin;
QVector3D m_direction;
float m_distance;
float m_distance = 1.0f;
};

/**
Expand Down Expand Up @@ -111,9 +110,9 @@ namespace QgsRayCastingUtils
* \since QGIS 3.4
*/
bool rayTriangleIntersection( const Ray3D &ray,
const QVector3D &a,
const QVector3D &b,
const QVector3D &c,
QVector3D a,
QVector3D b,
QVector3D c,
QVector3D &uvw,
float &t );

Expand Down
6 changes: 1 addition & 5 deletions src/analysis/interpolation/NormVecDecorator.cpp
Expand Up @@ -33,11 +33,7 @@ NormVecDecorator::~NormVecDecorator()

delete mNormVec;
delete mPointState;

if ( mTIN )
{
delete mTIN;
}
delete mTIN;
}

int NormVecDecorator::addPoint( const QgsPoint &p )
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmdifference.cpp
Expand Up @@ -82,7 +82,7 @@ QVariantMap QgsDifferenceAlgorithm::processAlgorithm( const QVariantMap &paramet

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

return outputs;
}
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmintersection.cpp
Expand Up @@ -106,7 +106,7 @@ QVariantMap QgsIntersectionAlgorithm::processAlgorithm( const QVariantMap &param
int count = 0;
int total = sourceA->featureCount();

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

return outputs;
}
Expand Down
10 changes: 5 additions & 5 deletions src/analysis/processing/qgsalgorithmreclassifybylayer.h
Expand Up @@ -33,9 +33,9 @@ class QgsReclassifyAlgorithmBase : public QgsProcessingAlgorithm
{
public:

QString group() const override final;
QString groupId() const override final;
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override final;
QString group() const final;
QString groupId() const final;
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) final;

protected:

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

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

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

QVariantMap processAlgorithm( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override final;
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;

std::unique_ptr< QgsRasterInterface > mInterface;

Expand Down
4 changes: 2 additions & 2 deletions src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp
Expand Up @@ -82,9 +82,9 @@ QVariantMap QgsSymmetricalDifferenceAlgorithm::processAlgorithm( const QVariantM
int count = 0;
int total = sourceA->featureCount() + sourceB->featureCount();

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

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

return outputs;
}
Expand Down
8 changes: 4 additions & 4 deletions src/analysis/processing/qgsalgorithmunion.cpp
Expand Up @@ -83,7 +83,7 @@ QVariantMap QgsUnionAlgorithm::processAlgorithm( const QVariantMap &parameters,
if ( !sourceB )
{
// we are doing single layer union
QgsOverlayUtils::resolveOverlaps( *sourceA.get(), *sink.get(), feedback );
QgsOverlayUtils::resolveOverlaps( *sourceA, *sink, feedback );
return outputs;
}

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

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

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

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

return outputs;
}
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/processing/qgsalgorithmvectorize.h
Expand Up @@ -39,8 +39,8 @@ class QgsVectorizeAlgorithm : public QgsProcessingAlgorithm
QStringList tags() const override;
QString shortHelpString() const override;
QgsVectorizeAlgorithm *createInstance() const override SIP_FACTORY;
QString group() const override final;
QString groupId() const override final;
QString group() const final;
QString groupId() const final;
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;

protected:
Expand Down
10 changes: 2 additions & 8 deletions src/analysis/raster/qgsrastercalcnode.cpp
Expand Up @@ -47,14 +47,8 @@ QgsRasterCalcNode::QgsRasterCalcNode( const QString &rasterName )

QgsRasterCalcNode::~QgsRasterCalcNode()
{
if ( mLeft )
{
delete mLeft;
}
if ( mRight )
{
delete mRight;
}
delete mLeft;
delete mRight;
}

bool QgsRasterCalcNode::calculate( QMap<QString, QgsRasterBlock * > &rasterData, QgsRasterMatrix &result, int row ) const
Expand Down
4 changes: 0 additions & 4 deletions src/app/3d/qgs3danimationsettings.cpp
Expand Up @@ -18,10 +18,6 @@
#include <QEasingCurve>
#include <QDomDocument>

Qgs3DAnimationSettings::Qgs3DAnimationSettings()
{
}

float Qgs3DAnimationSettings::duration() const
{
return mKeyframes.isEmpty() ? 0 : mKeyframes.constLast().time;
Expand Down
2 changes: 1 addition & 1 deletion src/app/3d/qgs3danimationsettings.h
Expand Up @@ -32,7 +32,7 @@ class QgsReadWriteContext;
class Qgs3DAnimationSettings
{
public:
Qgs3DAnimationSettings();
Qgs3DAnimationSettings() = default;

//! keyframe definition
struct Keyframe
Expand Down
2 changes: 1 addition & 1 deletion src/app/3d/qgs3danimationwidget.h
Expand Up @@ -30,7 +30,7 @@ class Qgs3DAnimationWidget : public QWidget, private Ui::Animation3DWidget
Q_OBJECT
public:
explicit Qgs3DAnimationWidget( QWidget *parent = nullptr );
~Qgs3DAnimationWidget();
~Qgs3DAnimationWidget() override;

void setCameraController( QgsCameraController *cameraController );

Expand Down
2 changes: 1 addition & 1 deletion src/app/dwg/qgsdwgimporter.h
Expand Up @@ -57,7 +57,7 @@ class QgsDwgImporter : public DRW_Interface

void addBlock( const DRW_Block &data ) override;

void setBlock( const int handle ) override;
void setBlock( int handle ) override;

//! Called to end the current block
void endBlock() override;
Expand Down
6 changes: 2 additions & 4 deletions src/app/gps/qgsgpsinformationwidget.cpp
Expand Up @@ -1093,10 +1093,8 @@ void QgsGpsInformationWidget::populateDevices()

void QgsGpsInformationWidget::createRubberBand()
{
if ( mpRubberBand )
{
delete mpRubberBand;
}
delete mpRubberBand;

mpRubberBand = new QgsRubberBand( mpCanvas, QgsWkbTypes::LineGeometry );
mpRubberBand->setColor( mBtnTrackColor->color() );
mpRubberBand->setWidth( mSpinTrackWidth->value() );
Expand Down
2 changes: 0 additions & 2 deletions src/app/mesh/qgsmeshdatasetgrouptreeview.cpp
Expand Up @@ -87,8 +87,6 @@ QgsMeshDatasetGroupTreeModel::QgsMeshDatasetGroupTreeModel( QObject *parent )
{
}

QgsMeshDatasetGroupTreeModel::~QgsMeshDatasetGroupTreeModel() = default;

int QgsMeshDatasetGroupTreeModel::columnCount( const QModelIndex &parent ) const
{
if ( parent.isValid() )
Expand Down

0 comments on commit 5e37e82

Please sign in to comment.