Skip to content
Permalink
Browse files

Apply clang-tidy modernization checks

  • Loading branch information
nyalldawson committed Jul 23, 2018
1 parent 1201df5 commit 5e37e824027ce5ba54a3f310ce5b03f82a05065c
Showing with 114 additions and 230 deletions.
  1. +1 −2 src/3d/qgs3dmapscene.cpp
  2. +1 −1 src/3d/qgsoffscreen3dengine.h
  3. +16 −21 src/3d/qgsraycastingutils_p.cpp
  4. +11 −12 src/3d/qgsraycastingutils_p.h
  5. +1 −5 src/analysis/interpolation/NormVecDecorator.cpp
  6. +1 −1 src/analysis/processing/qgsalgorithmdifference.cpp
  7. +1 −1 src/analysis/processing/qgsalgorithmintersection.cpp
  8. +5 −5 src/analysis/processing/qgsalgorithmreclassifybylayer.h
  9. +2 −2 src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp
  10. +4 −4 src/analysis/processing/qgsalgorithmunion.cpp
  11. +2 −2 src/analysis/processing/qgsalgorithmvectorize.h
  12. +2 −8 src/analysis/raster/qgsrastercalcnode.cpp
  13. +0 −4 src/app/3d/qgs3danimationsettings.cpp
  14. +1 −1 src/app/3d/qgs3danimationsettings.h
  15. +1 −1 src/app/3d/qgs3danimationwidget.h
  16. +1 −1 src/app/dwg/qgsdwgimporter.h
  17. +2 −4 src/app/gps/qgsgpsinformationwidget.cpp
  18. +0 −2 src/app/mesh/qgsmeshdatasetgrouptreeview.cpp
  19. +0 −2 src/app/mesh/qgsmeshdatasetgrouptreeview.h
  20. +0 −1 src/app/mesh/qgsmeshlayerproperties.h
  21. +0 −1 src/app/mesh/qgsmeshrendereractivedatasetwidget.h
  22. +0 −1 src/app/mesh/qgsmeshrenderermeshsettingswidget.h
  23. +0 −1 src/app/mesh/qgsmeshrendererscalarsettingswidget.h
  24. +0 −1 src/app/mesh/qgsmeshrenderervectorsettingswidget.h
  25. +0 −1 src/app/mesh/qgsrenderermeshpropertieswidget.h
  26. +4 −8 src/app/qgsdecorationgrid.cpp
  27. +3 −7 src/app/qgsidentifyresultsdialog.cpp
  28. +1 −1 src/app/qgsvariantdelegate.cpp
  29. +1 −4 src/app/vertextool/qgsvertexeditor.cpp
  30. +2 −2 src/app/vertextool/qgsvertextool.cpp
  31. +0 −1 src/auth/oauth2/qgsauthoauth2edit.h
  32. +0 −1 src/auth/oauth2/qgsauthoauth2method.cpp
  33. +1 −1 src/auth/oauth2/qgsauthoauth2method.h
  34. +1 −1 src/auth/oauth2/qgso2.h
  35. +3 −3 src/auth/oauth2/qjsonwrapper/Json.cpp
  36. +2 −2 src/auth/oauth2/qjsonwrapper/Json.h
  37. +1 −1 src/core/geometry/qgsgeometry.cpp
  38. +2 −6 src/core/gps/qgsgpsdetector.cpp
  39. +2 −2 src/core/layertree/qgslayertreemodellegendnode.cpp
  40. +3 −5 src/core/mesh/qgsmeshlayer.cpp
  41. +1 −2 src/core/pal/pointset.cpp
  42. +7 −16 src/core/pal/problem.cpp
  43. +1 −2 src/core/qgslocalec.cpp
  44. +0 −4 src/core/qgsnetworkcontentfetcherregistry.cpp
  45. +1 −1 src/core/qgsnetworkcontentfetcherregistry.h
  46. +1 −2 src/core/qgsproperty.cpp
  47. +1 −1 src/core/qgssqliteutils.cpp
  48. +1 −1 src/core/qgstessellator.cpp
  49. +1 −1 src/core/qgsvectorlayer.cpp
  50. +1 −3 src/core/qgsvectorlayerexporter.cpp
  51. +1 −2 src/gui/attributetable/qgsattributetableview.cpp
  52. +2 −4 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
  53. +1 −5 src/gui/effects/qgseffectstackpropertieswidget.cpp
  54. +0 −4 src/gui/processing/qgsprocessingalgorithmdialogbase.cpp
  55. +1 −1 src/gui/processing/qgsprocessingalgorithmdialogbase.h
  56. +1 −4 src/gui/processing/qgsprocessingconfigurationwidgets.cpp
  57. +0 −6 src/gui/qgsadvanceddigitizingdockwidget.cpp
  58. +1 −2 src/gui/qgsattributedialog.cpp
  59. +1 −1 src/gui/qgsoptionsdialoghighlightwidgetsimpl.cpp
  60. +5 −6 src/gui/symbology/qgscptcitycolorrampdialog.cpp
  61. +1 −4 src/plugins/evis/evis.cpp
  62. +1 −5 src/plugins/topology/topolTest.cpp
  63. +2 −10 src/providers/ogr/qgsogrtransaction.cpp
  64. +2 −8 src/providers/virtual/qgsvirtuallayersqlitemodule.cpp
  65. +1 −1 src/providers/wfs/qgswfsnewconnection.h
  66. +1 −4 src/providers/wfs/qgswfsprovider.cpp
@@ -43,8 +43,7 @@


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

@@ -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 );
@@ -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;
}
@@ -61,7 +56,7 @@ namespace QgsRayCastingUtils
return m_direction;
}

void Ray3D::setDirection( const QVector3D &value )
void Ray3D::setDirection( QVector3D value )
{
if ( value.isNull() )
return;
@@ -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
@@ -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();
@@ -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];
@@ -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 )
{
@@ -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() )
{
@@ -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
@@ -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 )
{
@@ -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;
@@ -80,7 +79,7 @@ namespace QgsRayCastingUtils
private:
QVector3D m_origin;
QVector3D m_direction;
float m_distance;
float m_distance = 1.0f;
};

/**
@@ -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 );

@@ -33,11 +33,7 @@ NormVecDecorator::~NormVecDecorator()

delete mNormVec;
delete mPointState;

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

int NormVecDecorator::addPoint( const QgsPoint &p )
@@ -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;
}
@@ -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;
}
@@ -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:

@@ -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.
@@ -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;

@@ -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;
}
@@ -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;
}

@@ -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;
}
@@ -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:
@@ -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
@@ -18,10 +18,6 @@
#include <QEasingCurve>
#include <QDomDocument>

Qgs3DAnimationSettings::Qgs3DAnimationSettings()
{
}

float Qgs3DAnimationSettings::duration() const
{
return mKeyframes.isEmpty() ? 0 : mKeyframes.constLast().time;
@@ -32,7 +32,7 @@ class QgsReadWriteContext;
class Qgs3DAnimationSettings
{
public:
Qgs3DAnimationSettings();
Qgs3DAnimationSettings() = default;

//! keyframe definition
struct Keyframe
@@ -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 );

@@ -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;
@@ -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() );
@@ -87,8 +87,6 @@ QgsMeshDatasetGroupTreeModel::QgsMeshDatasetGroupTreeModel( QObject *parent )
{
}

QgsMeshDatasetGroupTreeModel::~QgsMeshDatasetGroupTreeModel() = default;

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

0 comments on commit 5e37e82

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