Skip to content
Permalink
Browse files

simple static queue for indexing

  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Feb 10, 2021
1 parent ed4db04 commit 48acff695318ce2259cb657b566b1a1487ad3302
Showing with 8 additions and 0 deletions.
  1. +7 −0 src/providers/pdal/qgspdalprovider.cpp
  2. +1 −0 src/providers/pdal/qgspdalprovider.h
@@ -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,
@@ -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;
}

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

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

bool QgsPdalProvider::anyIndexingTaskExists()
@@ -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

0 comments on commit 48acff6

Please sign in to comment.