Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
simple static queue for indexing
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Feb 10, 2021
1 parent ed4db04 commit 48acff6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/providers/pdal/qgspdalprovider.cpp
Expand Up @@ -35,6 +35,8 @@
#define PROVIDER_KEY QStringLiteral( "pdal" )
#define PROVIDER_DESCRIPTION QStringLiteral( "PDAL point cloud data provider" )

QQueue<QgsPdalProvider *> QgsPdalProvider::mIndexingQueue;

QgsPdalProvider::QgsPdalProvider(
const QString &uri,
const QgsDataProvider::ProviderOptions &options,
Expand Down Expand Up @@ -93,6 +95,7 @@ void QgsPdalProvider::generateIndex()
if ( anyIndexingTaskExists() )
{
QgsMessageLog::logMessage( tr( "EPT generation task is already running" ), QObject::tr( "Point clouds" ), Qgis::Info );
mIndexingQueue.push_back( this );
return;
}

Expand Down Expand Up @@ -146,6 +149,8 @@ void QgsPdalProvider::onGenerateIndexFinished()
mRunningIndexingTask = nullptr;
emit indexGenerationStateChanged( PointCloudIndexGenerationState::Indexed );
}
if ( !mIndexingQueue.empty() )
mIndexingQueue.takeFirst()->generateIndex();
}

void QgsPdalProvider::onGenerateIndexFailed()
Expand All @@ -157,6 +162,8 @@ void QgsPdalProvider::onGenerateIndexFailed()
mRunningIndexingTask = nullptr;
emit indexGenerationStateChanged( PointCloudIndexGenerationState::NotIndexed );
}
if ( !mIndexingQueue.empty() )
mIndexingQueue.takeFirst()->generateIndex();
}

bool QgsPdalProvider::anyIndexingTaskExists()
Expand Down
1 change: 1 addition & 0 deletions src/providers/pdal/qgspdalprovider.h
Expand Up @@ -66,6 +66,7 @@ class QgsPdalProvider: public QgsPointCloudDataProvider
QVariantMap mOriginalMetadata;
std::unique_ptr<QgsEptPointCloudIndex> mIndex;
QgsPdalEptGenerationTask *mRunningIndexingTask = nullptr;
static QQueue<QgsPdalProvider *> mIndexingQueue;
};

class QgsPdalProviderMetadata : public QgsProviderMetadata
Expand Down

0 comments on commit 48acff6

Please sign in to comment.