24#include <QJsonDocument> 
   38#include "qgspointcloudexpression.h" 
   43QgsRemoteCopcPointCloudIndex::QgsRemoteCopcPointCloudIndex() = 
default;
 
   45QgsRemoteCopcPointCloudIndex::~QgsRemoteCopcPointCloudIndex() = 
default;
 
   47std::unique_ptr<QgsPointCloudIndex> QgsRemoteCopcPointCloudIndex::clone()
 const 
   49  QgsRemoteCopcPointCloudIndex *clone = 
new QgsRemoteCopcPointCloudIndex;
 
   50  QMutexLocker locker( &mHierarchyMutex );
 
   51  copyCommonProperties( clone );
 
   52  return std::unique_ptr<QgsPointCloudIndex>( clone );
 
   55void QgsRemoteCopcPointCloudIndex::load( 
const QString &uri )
 
   60  mIsValid = mLazInfo->isValid();
 
   63    mIsValid = loadSchema( *mLazInfo.get() );
 
   71    mError = tr( 
"Unable to recognize %1 as a LAZ file: \"%2\"" ).arg( uri, mLazInfo->error() );
 
   79    return std::unique_ptr<QgsPointCloudBlock>( cached );
 
   82  std::unique_ptr<QgsPointCloudBlockRequest> blockRequest( asyncNodeData( n, request ) );
 
   90  std::unique_ptr<QgsPointCloudBlock> block = blockRequest->takeBlock();
 
   94    QgsDebugError( QStringLiteral( 
"Error downloading node %1 data, error : %2 " ).arg( n.
toString(), blockRequest->errorStr() ) );
 
   97  storeNodeDataToCache( block.get(), n, request );
 
  106           scale(), offset(), mFilterExpression, request.
filterRect() );
 
  109  if ( !fetchNodeHierarchy( n ) )
 
  111  QMutexLocker locker( &mHierarchyMutex );
 
  116  QgsPointCloudExpression filterExpression = mFilterExpression;
 
  118  requestAttributes.
extend( attributes(), filterExpression.referencedAttributes() );
 
  119  auto [ blockOffset, blockSize ] = mHierarchyNodePos.value( n );
 
  120  int pointCount = mHierarchy.value( n );
 
  123         scale(), offset(), filterExpression, request.
filterRect(),
 
  124         blockOffset, blockSize, pointCount, *mLazInfo.get() );
 
  127bool QgsRemoteCopcPointCloudIndex::isValid()
 const 
  132void QgsRemoteCopcPointCloudIndex::fetchHierarchyPage( uint64_t offset, uint64_t byteSize )
 const 
  134  Q_ASSERT( byteSize > 0 );
 
  136  QNetworkRequest nr = QNetworkRequest( QUrl( mUri ) );
 
  138  nr.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache );
 
  139  nr.setAttribute( QNetworkRequest::CacheSaveControlAttribute, 
true );
 
  140  QByteArray queryRange = QStringLiteral( 
"bytes=%1-%2" ).arg( offset ).arg( offset + byteSize - 1 ).toLocal8Bit();
 
  141  nr.setRawHeader( 
"Range", queryRange );
 
  149  if ( reply->error() != QNetworkReply::NoError )
 
  151    QgsDebugError( QStringLiteral( 
"Request failed: " ) + mUri );
 
  155  QByteArray data = reply->data();
 
  157  populateHierarchy( data.constData(), byteSize );
 
  160void QgsRemoteCopcPointCloudIndex::copyCommonProperties( QgsRemoteCopcPointCloudIndex *destination )
 const 
  162  QgsCopcPointCloudIndex::copyCommonProperties( destination );
 
  165  destination->mHierarchyNodes = mHierarchyNodes;
 
Represents a indexed point cloud node in octree.
QString toString() const
Encode node to string.
static QgsTileDownloadManager * tileDownloadManager()
Returns the application's tile download manager, used for download of map tiles when rendering.
Class for handling a QgsPointCloudBlockRequest using existing cached QgsPointCloudBlock.
Base class for handling loading QgsPointCloudBlock asynchronously from a remote COPC dataset.
Class for extracting information contained in LAZ file such as the public header block and variable l...
static QgsLazInfo fromUrl(QUrl &url)
Static function to create a QgsLazInfo class from a file over network.
Collection of point cloud attributes.
void extend(const QgsPointCloudAttributeCollection &otherCollection, const QSet< QString > &matchingNames)
Adds specific missing attributes from another QgsPointCloudAttributeCollection.
Base class for handling loading QgsPointCloudBlock asynchronously.
void finished()
Emitted when the request processing has finished.
Base class for storing raw data from point cloud nodes.
Point cloud data request.
QgsPointCloudAttributeCollection attributes() const
Returns attributes.
QgsRectangle filterRect() const
Returns the rectangle from which points will be taken, in point cloud's crs.
void finished()
Emitted when the reply has finished (either with a success or with a failure)
#define QgsDebugError(str)
#define QgsSetRequestInitiatorClass(request, _class)