Skip to content

Commit 230e3b4

Browse files
committed
Address some clazy warnings
1 parent ca427d3 commit 230e3b4

File tree

77 files changed

+390
-369
lines changed

Some content is hidden

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

77 files changed

+390
-369
lines changed

src/3d/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,20 @@ SET(QGIS_3D_MOC_HDRS
5959
qgstessellatedpolygongeometry.h
6060
qgswindow3dengine.h
6161

62+
chunks/qgschunkboundsentity_p.h
6263
chunks/qgschunkedentity_p.h
6364
chunks/qgschunkloader_p.h
6465
chunks/qgschunkqueuejob_p.h
6566

6667
processing/qgs3dalgorithms.h
6768

6869
terrain/qgsdemterraintileloader_p.h
70+
terrain/qgsflatterraingenerator.h
6971
terrain/qgsterrainentity_p.h
7072
terrain/qgsterraintexturegenerator_p.h
7173
terrain/qgsterraintextureimage_p.h
7274
terrain/qgsterraintileentity_p.h
75+
terrain/qgsterraintileloader_p.h
7376
)
7477

7578
QT5_WRAP_CPP(QGIS_3D_MOC_SRCS ${QGIS_3D_MOC_HDRS})
@@ -96,7 +99,6 @@ SET(QGIS_3D_HDRS
9699
qgsvectorlayer3drenderer.h
97100
qgswindow3dengine.h
98101

99-
chunks/qgschunkboundsentity_p.h
100102
chunks/qgschunkedentity_p.h
101103
chunks/qgschunklist_p.h
102104
chunks/qgschunkloader_p.h
@@ -114,13 +116,11 @@ SET(QGIS_3D_HDRS
114116
terrain/qgsdemterraingenerator.h
115117
terrain/qgsdemterraintilegeometry_p.h
116118
terrain/qgsdemterraintileloader_p.h
117-
terrain/qgsflatterraingenerator.h
118119
terrain/qgsterrainentity_p.h
119120
terrain/qgsterraingenerator.h
120121
terrain/qgsterraintexturegenerator_p.h
121122
terrain/qgsterraintextureimage_p.h
122123
terrain/qgsterraintileentity_p.h
123-
terrain/qgsterraintileloader_p.h
124124
#terrain/quantizedmeshgeometry.h
125125
#terrain/quantizedmeshterraingenerator.h
126126
)

src/3d/chunks/qgschunkboundsentity_p.cpp

+1-37
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,14 @@
1515

1616
#include "qgschunkboundsentity_p.h"
1717

18-
#include <Qt3DRender/QAttribute>
1918
#include <Qt3DRender/QBuffer>
20-
#include <Qt3DRender/QGeometry>
21-
#include <Qt3DRender/QGeometryRenderer>
2219
#include <Qt3DExtras/QPhongMaterial>
2320

2421
#include "qgsaabb.h"
2522

2623

2724
///@cond PRIVATE
2825

29-
class LineMeshGeometry : public Qt3DRender::QGeometry
30-
{
31-
public:
32-
LineMeshGeometry( Qt3DCore::QNode *parent = nullptr );
33-
34-
int vertexCount()
35-
{
36-
return mVertices.size();
37-
}
38-
39-
void setVertices( QList<QVector3D> vertices );
40-
41-
private:
42-
Qt3DRender::QAttribute *mPositionAttribute = nullptr;
43-
Qt3DRender::QBuffer *mVertexBuffer = nullptr;
44-
QList<QVector3D> mVertices;
45-
46-
};
47-
48-
4926
LineMeshGeometry::LineMeshGeometry( Qt3DCore::QNode *parent )
5027
: Qt3DRender::QGeometry( parent )
5128
, mPositionAttribute( new Qt3DRender::QAttribute( this ) )
@@ -60,7 +37,7 @@ LineMeshGeometry::LineMeshGeometry( Qt3DCore::QNode *parent )
6037
addAttribute( mPositionAttribute );
6138
}
6239

63-
void LineMeshGeometry::setVertices( QList<QVector3D> vertices )
40+
void LineMeshGeometry::setVertices( const QList<QVector3D> &vertices )
6441
{
6542
QByteArray vertexBufferData;
6643
vertexBufferData.resize( vertices.size() * 3 * sizeof( float ) );
@@ -81,19 +58,6 @@ void LineMeshGeometry::setVertices( QList<QVector3D> vertices )
8158
// ----------------
8259

8360

84-
//! Geometry renderer for axis aligned bounding boxes - draws a box edges as lines
85-
class AABBMesh : public Qt3DRender::QGeometryRenderer
86-
{
87-
public:
88-
AABBMesh( Qt3DCore::QNode *parent = nullptr );
89-
90-
void setBoxes( const QList<QgsAABB> &bboxes );
91-
92-
private:
93-
LineMeshGeometry *mLineMeshGeo = nullptr;
94-
};
95-
96-
9761
AABBMesh::AABBMesh( Qt3DCore::QNode *parent )
9862
: Qt3DRender::QGeometryRenderer( parent )
9963
{

src/3d/chunks/qgschunkboundsentity_p.h

+43
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
//
2929

3030
#include <Qt3DCore/QEntity>
31+
#include <Qt3DRender/QAttribute>
32+
#include <Qt3DRender/QGeometry>
33+
#include <QVector3D>
34+
#include <Qt3DRender/QGeometryRenderer>
3135

3236
class QgsAABB;
3337
class AABBMesh;
@@ -40,6 +44,8 @@ class AABBMesh;
4044
*/
4145
class QgsChunkBoundsEntity : public Qt3DCore::QEntity
4246
{
47+
Q_OBJECT
48+
4349
public:
4450
//! Constructs the entity
4551
QgsChunkBoundsEntity( Qt3DCore::QNode *parent = nullptr );
@@ -51,6 +57,43 @@ class QgsChunkBoundsEntity : public Qt3DCore::QEntity
5157
AABBMesh *mAabbMesh = nullptr;
5258
};
5359

60+
61+
class LineMeshGeometry : public Qt3DRender::QGeometry
62+
{
63+
Q_OBJECT
64+
65+
public:
66+
LineMeshGeometry( Qt3DCore::QNode *parent = nullptr );
67+
68+
int vertexCount()
69+
{
70+
return mVertices.size();
71+
}
72+
73+
void setVertices( const QList<QVector3D> &vertices );
74+
75+
private:
76+
Qt3DRender::QAttribute *mPositionAttribute = nullptr;
77+
Qt3DRender::QBuffer *mVertexBuffer = nullptr;
78+
QList<QVector3D> mVertices;
79+
80+
};
81+
82+
83+
//! Geometry renderer for axis aligned bounding boxes - draws a box edges as lines
84+
class AABBMesh : public Qt3DRender::QGeometryRenderer
85+
{
86+
Q_OBJECT
87+
88+
public:
89+
AABBMesh( Qt3DCore::QNode *parent = nullptr );
90+
91+
void setBoxes( const QList<QgsAABB> &bboxes );
92+
93+
private:
94+
LineMeshGeometry *mLineMeshGeo = nullptr;
95+
};
96+
5497
/// @endcond
5598

5699
#endif // QGSCHUNKBOUNDSENTITY_P_H

src/3d/chunks/qgschunknode_p.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ QgsChunkNode::~QgsChunkNode()
5454
delete mChildren[i];
5555
}
5656

57-
bool QgsChunkNode::allChildChunksResident( const QTime &currentTime ) const
57+
bool QgsChunkNode::allChildChunksResident( QTime currentTime ) const
5858
{
5959
for ( int i = 0; i < 4; ++i )
6060
{

src/3d/chunks/qgschunknode_p.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class QgsChunkNode
121121
QgsChunkQueueJob *updater() const { return mUpdater; }
122122

123123
//! Returns true if all child chunks are available and thus this node could be swapped to the child nodes
124-
bool allChildChunksResident( const QTime &currentTime ) const;
124+
bool allChildChunksResident( QTime currentTime ) const;
125125

126126
//! make sure that all child nodes are at least skeleton nodes
127127
void ensureAllChildrenExist();

src/3d/qgs3dmapscene.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ void Qgs3DMapScene::onLayerEntityPickEvent( Qt3DRender::QPickEvent *event )
446446
// unfortunately we can't access which sub-entity triggered the pick event
447447
// so as a temporary workaround let's just ignore the entity with selection
448448
// and hope the event was the main entity (QTBUG-58206)
449-
if ( geomRenderer->objectName() != "main" )
449+
if ( geomRenderer->objectName() != QLatin1String( "main" ) )
450450
continue;
451451

452452
if ( QgsTessellatedPolygonGeometry *g = qobject_cast<QgsTessellatedPolygonGeometry *>( geomRenderer->geometry() ) )
@@ -510,7 +510,7 @@ void Qgs3DMapScene::addLayerEntity( QgsMapLayer *layer )
510510
// This is a bit of a hack and it should be handled in QgsMapLayer::setRenderer3D() but in qgis_core
511511
// the vector layer 3D renderer class is not available. Maybe we need an intermediate map layer 3D renderer
512512
// class in qgis_core that can be used to handle this case nicely.
513-
if ( layer->type() == QgsMapLayer::VectorLayer && renderer->type() == "vector" )
513+
if ( layer->type() == QgsMapLayer::VectorLayer && renderer->type() == QLatin1String( "vector" ) )
514514
{
515515
static_cast<QgsVectorLayer3DRenderer *>( renderer )->setLayer( static_cast<QgsVectorLayer *>( layer ) );
516516
}

0 commit comments

Comments
 (0)