Skip to content
Permalink
Browse files
address reviews
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Apr 8, 2021
1 parent c989093 commit f9b71846c9b791e84b6ae7021b1c93e13ebe47d3
@@ -313,7 +313,6 @@ Creates a new instance of the raster data provider.
.. versionadded:: 3.10
%End


virtual bool createMeshData(
const QgsMesh &mesh,
const QString uri,
@@ -127,7 +127,6 @@ Creates new instance of raster data provider
.. versionadded:: 3.10
%End


QList<QPair<QString, QString> > pyramidResamplingMethods( const QString &providerKey );
%Docstring
Returns list of raster pyramid resampling methods
@@ -477,8 +477,6 @@ QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QString &filename,
);
}

#include <QDebug>

QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QByteArray &byteArrayData,
const QgsPointCloudAttributeCollection &attributes,
const QgsPointCloudAttributeCollection &requestedAttributes )
@@ -493,7 +491,7 @@ QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QByteArray &byteArrayDat
}
else
{
qDebug() << "Couldn't open " << filename;
QgsDebugMsg( QStringLiteral( "Couldn't open %1" ).arg( filename ) );
return nullptr;
}
}
@@ -286,6 +286,14 @@ QgsPointCloudBlock *QgsEptPointCloudIndex::nodeData( const IndexedPointCloudNode
}
}

QgsPointCloudBlockHandle *QgsEptPointCloudIndex::asyncNodeData( const IndexedPointCloudNode &n, const QgsPointCloudRequest &request )
{
Q_UNUSED( n );
Q_UNUSED( request );
Q_ASSERT( false );
return nullptr; // unsupported
}

QgsCoordinateReferenceSystem QgsEptPointCloudIndex::crs() const
{
return QgsCoordinateReferenceSystem::fromWkt( mWkt );
@@ -47,13 +47,7 @@ class CORE_EXPORT QgsEptPointCloudIndex: public QgsPointCloudIndex
void load( const QString &fileName ) override;

QgsPointCloudBlock *nodeData( const IndexedPointCloudNode &n, const QgsPointCloudRequest &request ) override;
QgsPointCloudBlockHandle *asyncNodeData( const IndexedPointCloudNode &n, const QgsPointCloudRequest &request ) override
{
Q_UNUSED( n );
Q_UNUSED( request );
Q_ASSERT( false );
return nullptr;
}
QgsPointCloudBlockHandle *asyncNodeData( const IndexedPointCloudNode &n, const QgsPointCloudRequest &request ) override;

QgsCoordinateReferenceSystem crs() const override;
int pointCount() const override;
@@ -155,8 +155,8 @@ class CORE_EXPORT QgsPointCloudIndex: public QObject
//! The access type of the data, local is for local files and remote for remote files (over HTTP)
enum AccessType
{
Local,
Remote
Local, //! Local means the source is a local file on the machine
Remote //! Remote means it's loaded through a protocol like HTTP
};

//! Constructs index
@@ -303,7 +303,7 @@ void QgsPointCloudLayer::setDataSource( const QString &dataSource, const QString
flags |= QgsDataProvider::FlagTrustDataSource;
}

mDataProvider.reset( qobject_cast<QgsPointCloudDataProvider *>( QgsProviderRegistry::instance()->createEptDataProvider( provider, dataSource, mDataSourceType, options, flags ) ) );
mDataProvider.reset( qobject_cast<QgsPointCloudDataProvider *>( QgsProviderRegistry::instance()->createProvider( provider, dataSource, options, flags ) ) );
if ( !mDataProvider )
{
QgsDebugMsg( QStringLiteral( "Unable to get point cloud data provider" ) );
@@ -18,7 +18,6 @@
#include <QElapsedTimer>
#include <QPointer>
#include <QTimer>
#include <QDebug>

#include "qgspointcloudlayerrenderer.h"
#include "qgspointcloudlayer.h"
@@ -240,14 +239,14 @@ bool QgsPointCloudLayerRenderer::render()
}
else
{
qDebug() << "Unable to load node " << n.toString();
QgsDebugMsg( QStringLiteral( "Unable to load node %1" ).arg( n.toString() ) );
}
finishedLoadingBlock[ i ] = true;
checkIfFinished();
} );
QObject::connect( blockHandle, &QgsPointCloudBlockHandle::blockLoadingFailed, [ &, i ]( const QString & errorStr )
{
qDebug() << "Unable to load node " << n.toString() << ", error: " << errorStr;
QgsDebugMsg( QStringLiteral( "Unable to load node %1, error: %2" ).arg( n.toString(), errorStr ) );
finishedLoadingBlock[ i ] = true;
checkIfFinished();
} );
@@ -256,7 +255,7 @@ bool QgsPointCloudLayerRenderer::render()
// Wait for all point cloud nodes to finish loading
loop.exec();

qDebug() << "Downloaded in : " << downloadTimer.elapsed() << "ms";
QgsDebugMsg( QStringLiteral( "Downloaded in : %1ms" ).arg( downloadTimer.elapsed() ) );

// Render all the point cloud blocks sequentially
for ( int i = 0; i < nodes.size(); ++i )
@@ -298,9 +297,6 @@ bool QgsPointCloudLayerRenderer::render()
}

#ifdef QGISDEBUG
qDebug() << QStringLiteral( "totals: %1 nodes | %2 points | %3ms" ).arg( nodesDrawn )
.arg( context.pointsRendered() )
.arg( t.elapsed() );
QgsDebugMsgLevel( QStringLiteral( "totals: %1 nodes | %2 points | %3ms" ).arg( nodesDrawn )
.arg( context.pointsRendered() )
.arg( t.elapsed() ), 2 );
@@ -316,7 +316,8 @@ QgsPointCloudBlock *QgsRemoteEptPointCloudIndex::nodeData( const IndexedPointClo
{
return nullptr; // unsupported
}
std::unique_ptr<QgsFileDownloader> downloader( new QgsFileDownloader( fileUrl, fileName ) );

QgsFileDownloader downloader( fileUrl, fileName );

int timeout = 10000;
QTimer timer;
@@ -325,20 +326,20 @@ QgsPointCloudBlock *QgsRemoteEptPointCloudIndex::nodeData( const IndexedPointClo

QUrl downloadedUrl;
QStringList errorMessages;
connect( downloader.get(), &QgsFileDownloader::downloadCompleted, [&]( const QUrl & url )
connect( &downloader, &QgsFileDownloader::downloadCompleted, [&]( const QUrl & url )
{
downloadedUrl = url;
loop.quit();
} );
connect( downloader.get(), &QgsFileDownloader::downloadCanceled, &loop, &QEventLoop::quit );
connect( downloader.get(), &QgsFileDownloader::downloadError, [&]( QStringList errorMessagesList )
connect( &downloader, &QgsFileDownloader::downloadCanceled, &loop, &QEventLoop::quit );
connect( &downloader, &QgsFileDownloader::downloadError, [&]( QStringList errorMessagesList )
{
errorMessages = errorMessagesList;
loop.exit();
} );

connect( &timer, &QTimer::timeout, &loop, &QEventLoop::quit );
downloader->startDownload();
downloader.startDownload();
timer.start( timeout );
loop.exec();

@@ -136,11 +136,6 @@ QgsEptProvider *QgsEptProviderMetadata::createProvider( const QString &uri, cons
return new QgsEptProvider( uri, options, "", flags );
}

QgsEptProvider *QgsEptProviderMetadata::createEptDataProvider( const QString &uri, const QString &dataSourceType, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags )
{
return new QgsEptProvider( uri, options, dataSourceType, flags );
}

QList<QgsDataItemProvider *> QgsEptProviderMetadata::dataItemProviders() const
{
QList< QgsDataItemProvider * > providers;
@@ -70,7 +70,6 @@ class QgsEptProviderMetadata : public QgsProviderMetadata
QgsEptProviderMetadata();
QgsProviderMetadata::ProviderMetadataCapabilities capabilities() const override;
QgsEptProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) override;
QgsEptProvider *createEptDataProvider( const QString &uri, const QString &dataSourceType, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) override;
QList< QgsDataItemProvider * > dataItemProviders() const override;
int priorityForUri( const QString &uri ) const override;
QList< QgsMapLayerType > validLayerTypesForUri( const QString &uri ) const override;
@@ -181,15 +181,6 @@ QgsRasterDataProvider *QgsProviderMetadata::createRasterDataProvider(
return nullptr;
}

QgsEptProvider *QgsProviderMetadata::createEptDataProvider(
const QString &,
const QString &,
const QgsDataProvider::ProviderOptions &,
QgsDataProvider::ReadFlags )
{
return nullptr;
}

bool QgsProviderMetadata::createMeshData(
const QgsMesh &,
const QString,
@@ -386,12 +386,6 @@ class CORE_EXPORT QgsProviderMetadata : public QObject
const QgsCoordinateReferenceSystem &crs,
const QStringList &createOptions = QStringList() ) SIP_FACTORY;

/**
* Creates a new instance of EPT point cloud data provider
* \since QGIS 3.20
*/
SIP_SKIP virtual QgsEptProvider *createEptDataProvider( const QString &uri, const QString &dataSourceType, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) SIP_FACTORY;

/**
* Creates mesh data source, that is the mesh frame stored in file, memory or with other way (depending of the provider)
* \since QGIS 3.16
@@ -570,15 +570,6 @@ QgsRasterDataProvider *QgsProviderRegistry::createRasterDataProvider( const QStr
return nullptr;
}

QgsEptProvider *QgsProviderRegistry::createEptDataProvider( const QString &providerKey, const QString &uri, const QString &dataSourceType, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags )
{
QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
if ( meta )
return meta->createEptDataProvider( uri, dataSourceType, options, flags );

return nullptr;
}

QList<QPair<QString, QString> > QgsProviderRegistry::pyramidResamplingMethods( const QString &providerKey )
{
QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
@@ -179,12 +179,6 @@ class CORE_EXPORT QgsProviderRegistry
const QgsCoordinateReferenceSystem &crs,
const QStringList &createOptions = QStringList() ) SIP_FACTORY;

/**
* Creates new instance of EPT point cloud data provider
* \since QGIS 3.10
*/
SIP_SKIP QgsEptProvider *createEptDataProvider( const QString &providerKey, const QString &uri, const QString &dataSourceType, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) SIP_FACTORY;

/**
* Returns list of raster pyramid resampling methods
*

0 comments on commit f9b7184

Please sign in to comment.