Skip to content

Commit

Permalink
run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Nov 29, 2024
1 parent 85ecbe0 commit 68a9b38
Show file tree
Hide file tree
Showing 5,658 changed files with 107,389 additions and 142,659 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
27 changes: 13 additions & 14 deletions editors/QtCreator/templates/wizards/qgis/qgis_test/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,38 @@
#include <QObject>
#include <qgsapplication.h>

class %{CN}: public QObject
class % { CN } : public QObject
{

Q_OBJECT

private slots:
void initTestCase(); // will be called before the first testfunction is executed.
void initTestCase(); // will be called before the first testfunction is executed.
void cleanupTestCase(); // will be called after the last testfunction was executed.
void init(); // will be called before each testfunction is executed.
void cleanup(); // will be called after every testfunction.
void init(); // will be called before each testfunction is executed.
void cleanup(); // will be called after every testfunction.

// Add your test methods here
};

void %{CN}::initTestCase()
void % { CN }
::initTestCase()
{

}

void %{CN}::cleanupTestCase()
void % { CN }
::cleanupTestCase()
{

}

void %{CN}::init()
void % { CN }
::init()
{

}

void %{CN}::cleanup()
void % { CN }
::cleanup()
{

}

QGSTEST_MAIN( %{CN} )
QGSTEST_MAIN( % { CN } )
#include "%{JS: Cpp.classToFileName('%{Class}', '.moc')}"
64 changes: 28 additions & 36 deletions src/3d/chunks/qgschunkedentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ QgsChunkedEntity::QgsChunkedEntity( Qgs3DMapSettings *mapSettings, float tau, Qg
mReplacementQueue = new QgsChunkList;

// in case the chunk loader factory supports fetching of hierarchy in background (to avoid GUI freezes)
connect( loaderFactory, &QgsChunkLoaderFactory::childrenPrepared, this, [this]
{
connect( loaderFactory, &QgsChunkLoaderFactory::childrenPrepared, this, [this] {
setNeedsUpdate( true );
emit pendingJobsCountChanged();
} );
Expand All @@ -99,7 +98,7 @@ QgsChunkedEntity::~QgsChunkedEntity()
else if ( node->state() == QgsChunkNode::QueuedForUpdate )
node->cancelQueuedForUpdate();
else
Q_ASSERT( false ); // impossible!
Q_ASSERT( false ); // impossible!
}

delete mChunkLoaderQueue;
Expand Down Expand Up @@ -211,19 +210,12 @@ void QgsChunkedEntity::handleSceneUpdate( const SceneContext &sceneContext )
// start a job from queue if there is anything waiting
startJobs();

mNeedsUpdate = false; // just updated
mNeedsUpdate = false; // just updated

if ( pendingJobsCount() != oldJobsCount )
emit pendingJobsCountChanged();

QgsDebugMsgLevel( QStringLiteral( "update: active %1 enabled %2 disabled %3 | culled %4 | loading %5 loaded %6 | unloaded %7 elapsed %8ms" ).arg( mActiveNodes.count() )
.arg( enabled )
.arg( disabled )
.arg( mFrustumCulled )
.arg( mChunkLoaderQueue->count() )
.arg( mReplacementQueue->count() )
.arg( unloaded )
.arg( t.elapsed() ), 2 );
QgsDebugMsgLevel( QStringLiteral( "update: active %1 enabled %2 disabled %3 | culled %4 | loading %5 loaded %6 | unloaded %7 elapsed %8ms" ).arg( mActiveNodes.count() ).arg( enabled ).arg( disabled ).arg( mFrustumCulled ).arg( mChunkLoaderQueue->count() ).arg( mReplacementQueue->count() ).arg( unloaded ).arg( t.elapsed() ), 2 );
}


Expand Down Expand Up @@ -255,7 +247,7 @@ int QgsChunkedEntity::unloadNodes()
mReplacementQueue->takeEntry( entry );
usedGpuMemory -= Qgs3DUtils::calculateEntityGpuMemorySize( entry->chunk->entity() );
mActiveNodes.removeOne( entry->chunk );
entry->chunk->unloadChunk(); // also deletes the entry
entry->chunk->unloadChunk(); // also deletes the entry
++unloaded;
entry = entryPrev;
}
Expand Down Expand Up @@ -370,7 +362,7 @@ void QgsChunkedEntity::pruneLoaderQueue( const SceneContext &sceneContext )
{
n->cancelQueuedForLoad();
}
else // queued for update
else // queued for update
{
n->cancelQueuedForUpdate();
mReplacementQueue->takeEntry( n->replacementQueueEntry() );
Expand All @@ -392,28 +384,29 @@ int QgsChunkedEntity::pendingJobsCount() const

struct ResidencyRequest
{
QgsChunkNode *node = nullptr;
float dist = 0.0;
int level = -1;
ResidencyRequest() = default;
ResidencyRequest(
QgsChunkNode *n,
float d,
int l )
: node( n )
, dist( d )
, level( l )
{}
QgsChunkNode *node = nullptr;
float dist = 0.0;
int level = -1;
ResidencyRequest() = default;
ResidencyRequest(
QgsChunkNode *n,
float d,
int l
)
: node( n )
, dist( d )
, level( l )
{}
};

struct
{
bool operator()( const ResidencyRequest &request, const ResidencyRequest &otherRequest ) const
{
if ( request.level == otherRequest.level )
return request.dist > otherRequest.dist;
return request.level > otherRequest.level;
}
bool operator()( const ResidencyRequest &request, const ResidencyRequest &otherRequest ) const
{
if ( request.level == otherRequest.level )
return request.dist > otherRequest.dist;
return request.level > otherRequest.level;
}
} ResidencyRequestSorter;

void QgsChunkedEntity::update( QgsChunkNode *root, const SceneContext &sceneContext )
Expand All @@ -422,8 +415,7 @@ void QgsChunkedEntity::update( QgsChunkNode *root, const SceneContext &sceneCont
QVector<ResidencyRequest> residencyRequests;

using slotItem = std::pair<QgsChunkNode *, float>;
auto cmp_funct = []( const slotItem & p1, const slotItem & p2 )
{
auto cmp_funct = []( const slotItem &p1, const slotItem &p2 ) {
return p1.second <= p2.second;
};
int renderedCount = 0;
Expand Down Expand Up @@ -598,7 +590,7 @@ void QgsChunkedEntity::requestResidency( QgsChunkNode *node )
else if ( node->state() == QgsChunkNode::Skeleton )
{
if ( !node->hasData() )
return; // no need to load (we already tried but got nothing back)
return; // no need to load (we already tried but got nothing back)

// add to the loading queue
QgsChunkListEntry *entry = new QgsChunkListEntry( node );
Expand Down Expand Up @@ -712,7 +704,7 @@ QgsChunkQueueJob *QgsChunkedEntity::startJob( QgsChunkNode *node )
}
else
{
Q_ASSERT( false ); // not possible
Q_ASSERT( false ); // not possible
return nullptr;
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/3d/chunks/qgschunkedentity.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace QgsRayCastingUtils
class Ray3D;
struct RayCastContext;
struct RayHit;
}
} // namespace QgsRayCastingUtils

#include <QVector3D>
#include <QMatrix4x4>
Expand All @@ -65,9 +65,7 @@ class QgsChunkedEntity : public Qgs3DMapSceneEntity
Q_OBJECT
public:
//! Constructs a chunked entity
QgsChunkedEntity( Qgs3DMapSettings *mapSettings, float tau, QgsChunkLoaderFactory *loaderFactory, bool ownsFactory,
int primitivesBudget = std::numeric_limits<int>::max(),
Qt3DCore::QNode *parent = nullptr );
QgsChunkedEntity( Qgs3DMapSettings *mapSettings, float tau, QgsChunkLoaderFactory *loaderFactory, bool ownsFactory, int primitivesBudget = std::numeric_limits<int>::max(), Qt3DCore::QNode *parent = nullptr );
~QgsChunkedEntity() override;

//! Called when e.g. camera changes and entity may need updated
Expand Down
2 changes: 1 addition & 1 deletion src/3d/chunks/qgschunklist_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void QgsChunkList::insertEntry( QgsChunkListEntry *entry, QgsChunkListEntry *nex
next->prev = entry;
}
if ( next == mHead )
mHead = entry; // update head if "entry" we was head before
mHead = entry; // update head if "entry" we was head before
}
++mCount;
}
Expand Down
18 changes: 9 additions & 9 deletions src/3d/chunks/qgschunklist_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ class QgsChunkNode;
*/
struct QgsChunkListEntry
{
//! Constructs entry for a particular node
QgsChunkListEntry( QgsChunkNode *node )
: chunk( node )
{
}

QgsChunkListEntry *prev = nullptr;
QgsChunkListEntry *next = nullptr;
QgsChunkNode *chunk; //!< TODO: shared pointer
//! Constructs entry for a particular node
QgsChunkListEntry( QgsChunkNode *node )
: chunk( node )
{
}

QgsChunkListEntry *prev = nullptr;
QgsChunkListEntry *next = nullptr;
QgsChunkNode *chunk; //!< TODO: shared pointer
};


Expand Down
12 changes: 8 additions & 4 deletions src/3d/chunks/qgschunkloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class QgsChunkLoader : public QgsChunkQueueJob
Q_OBJECT
public:
//! Construct chunk loader for a node
QgsChunkLoader( QgsChunkNode *node ) : QgsChunkQueueJob( node ) { }
QgsChunkLoader( QgsChunkNode *node )
: QgsChunkQueueJob( node ) {}

/**
* Run in main thread to use loaded data.
Expand All @@ -59,7 +60,7 @@ class QgsChunkLoader : public QgsChunkQueueJob
* \ingroup 3d
* \brief Factory for chunk loaders for a particular type of entity
*/
class QgsChunkLoaderFactory : public QObject
class QgsChunkLoaderFactory : public QObject
{
Q_OBJECT
public:
Expand Down Expand Up @@ -91,7 +92,11 @@ class QgsChunkLoaderFactory : public QObject
* \see prepareChildren()
* \see createChildren()
*/
virtual bool canCreateChildren( QgsChunkNode *node ) { Q_UNUSED( node ); return true; }
virtual bool canCreateChildren( QgsChunkNode *node )
{
Q_UNUSED( node );
return true;
}

/**
* Requests that node has enough hierarchy information to create children in createChildren().
Expand Down Expand Up @@ -137,7 +142,6 @@ class _3D_EXPORT QgsQuadtreeChunkLoaderFactory : public QgsChunkLoaderFactory
float mRootError = 0;
//! maximum allowed depth of quad tree
int mMaxLevel = 0;

};

/// @endcond
Expand Down
28 changes: 14 additions & 14 deletions src/3d/chunks/qgschunknode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "qgschunknode.h"

#include "qgschunkedentity.h" // for ChunkLoader destructor
#include "qgschunkedentity.h" // for ChunkLoader destructor
#include "qgschunklist_p.h"
#include "qgschunkloader.h"
#include <Qt3DCore/QEntity>
Expand Down Expand Up @@ -56,7 +56,7 @@ bool QgsChunkNode::allChildChunksResident( QTime currentTime ) const
for ( int i = 0; i < childCount(); ++i )
{
if ( mChildren[i]->mHasData && !mChildren[i]->mEntity )
return false; // no there yet
return false; // no there yet
Q_UNUSED( currentTime ) // seems we do not need this extra time (it just brings extra problems)
//if (children[i]->entityCreatedTime.msecsTo(currentTime) < 100)
// return false; // allow some time for upload of stuff within Qt3D (TODO: better way to check it is ready?)
Expand Down Expand Up @@ -136,7 +136,7 @@ void QgsChunkNode::cancelLoading()
Q_ASSERT( !mEntity );
Q_ASSERT( !mReplacementQueueEntry );

mLoader = nullptr; // not owned by chunk node
mLoader = nullptr; // not owned by chunk node

mState = QgsChunkNode::Skeleton;
}
Expand All @@ -151,7 +151,7 @@ void QgsChunkNode::setLoaded( Qt3DCore::QEntity *newEntity )
mEntity = newEntity;
mEntityCreatedTime = QTime::currentTime();

mLoader = nullptr; // not owned by chunk node
mLoader = nullptr; // not owned by chunk node

mState = QgsChunkNode::Loaded;
mReplacementQueueEntry = new QgsChunkListEntry( this );
Expand Down Expand Up @@ -194,7 +194,7 @@ void QgsChunkNode::cancelQueuedForUpdate()
Q_ASSERT( !mUpdater );

mState = Loaded;
mUpdaterFactory = nullptr; // not owned by the node
mUpdaterFactory = nullptr; // not owned by the node

delete mLoaderQueueEntry;
mLoaderQueueEntry = nullptr;
Expand All @@ -211,7 +211,7 @@ void QgsChunkNode::setUpdating()

mState = Updating;
mUpdater = mUpdaterFactory->createJob( this );
mUpdaterFactory = nullptr; // not owned by the node
mUpdaterFactory = nullptr; // not owned by the node
mLoaderQueueEntry = nullptr;
}

Expand All @@ -221,7 +221,7 @@ void QgsChunkNode::cancelUpdating()
Q_ASSERT( mUpdater );
Q_ASSERT( !mLoaderQueueEntry );

mUpdater = nullptr; // not owned by chunk node
mUpdater = nullptr; // not owned by chunk node

mState = Loaded;
}
Expand All @@ -233,7 +233,7 @@ void QgsChunkNode::setUpdated()
Q_ASSERT( !mLoaderQueueEntry );
Q_ASSERT( mReplacementQueueEntry );

mUpdater = nullptr; // not owned by chunk node
mUpdater = nullptr; // not owned by chunk node

mState = QgsChunkNode::Loaded;
}
Expand All @@ -251,12 +251,12 @@ void QgsChunkNode::updateParentBoundingBoxesRecursively() const
while ( currentNode )
{
QgsChunkNode *const *currentNodeChildren = currentNode->children();
double xMin = std::numeric_limits< double >::max();
double xMax = -std::numeric_limits< double >::max();
double yMin = std::numeric_limits< double >::max();
double yMax = -std::numeric_limits< double >::max();
double zMin = std::numeric_limits< double >::max();
double zMax = -std::numeric_limits< double >::max();
double xMin = std::numeric_limits<double>::max();
double xMax = -std::numeric_limits<double>::max();
double yMin = std::numeric_limits<double>::max();
double yMax = -std::numeric_limits<double>::max();
double zMin = std::numeric_limits<double>::max();
double zMax = -std::numeric_limits<double>::max();

for ( int i = 0; i < currentNode->childCount(); ++i )
{
Expand Down
Loading

0 comments on commit 68a9b38

Please sign in to comment.