57 return mIsValid && mIndex.
isValid();
102 if ( mEditedNodeData.contains( n ) )
109 requestAttributes.
extend(
attributes(), filterExpression.referencedAttributes() );
113 QByteArray rawBlockData = mEditedNodeData[n];
115 QgsCopcPointCloudIndex *copcIndex =
static_cast<QgsCopcPointCloudIndex *
>( mIndex.
get() );
117 int pointCount = copcIndex->mHierarchy.value( n );
119 return QgsLazDecoder::decompressCopc( rawBlockData, *copcIndex->mLazInfo.get(),
pointCount, requestAttributes, filterExpression, filterRect );
123 return mIndex.
nodeData( n, request );
138 QHash<QgsPointCloudNodeId, QgsCopcUpdate::UpdatedChunk> updatedChunks;
139 for (
auto it = mEditedNodeData.constBegin(); it != mEditedNodeData.constEnd(); ++it )
147 QFileInfo fileInfo(
mUri );
148 const QString outputFilename = fileInfo.dir().filePath( fileInfo.baseName() + QStringLiteral(
"-update.copc.laz" ) );
156 QgsCopcPointCloudIndex *copcIndex =
static_cast<QgsCopcPointCloudIndex *
>( mIndex.
get() );
159 const QString originalFilename = fileInfo.dir().filePath( fileInfo.baseName() + QStringLiteral(
"-original.copc.laz" ) );
160 if ( !QFile::rename(
mUri, originalFilename ) )
163 *errorMessage = QStringLiteral(
"Rename of the old COPC failed!" );
164 QFile::remove( outputFilename );
168 if ( !QFile::rename( outputFilename,
mUri ) )
171 *errorMessage = QStringLiteral(
"Rename of the new COPC failed!" );
172 QFile::rename( originalFilename,
mUri );
173 QFile::remove( outputFilename );
177 if ( !QFile::remove( originalFilename ) )
180 *errorMessage = QStringLiteral(
"Removal of the old COPC failed!" );
185 mEditedNodeData.clear();
188 copcIndex->load(
mUri );
195 return !mEditedNodeData.isEmpty();
200 return mEditedNodeData.keys();
205 for (
auto it = data.constBegin(); it != data.constEnd(); ++it )
207 mEditedNodeData[it.key()] = it.value();
213 const QList<QgsPointCloudCacheKey> cacheKeys =
sBlockCache.keys();
216 if ( cacheKey.uri() ==
mUri && data.contains( cacheKey.node() ) )
PointCloudAccessType
The access type of the data, local is for local files and remote for remote files (over HTTP).
QgsPointCloudAttributeCollection mAttributes
QgsBox3D mRootBounds
Bounds of the root node's cube (in int32 coordinates)
static QMutex sBlockCacheMutex
QgsVector3D mOffset
Offset of our int32 coordinates compared to CRS coords.
QgsPointCloudAttributeCollection attributes() const
Returns all attributes that are stored in the file.
static QCache< QgsPointCloudCacheKey, QgsPointCloudBlock > sBlockCache
int mSpan
All native attributes stored in the file.
double mZMax
Vertical extent of data.
QgsRectangle mExtent
2D extent of data
QgsVector3D mScale
Scale of our int32 coordinates compared to CRS coords.
This class represents a coordinate reference system (CRS).
static bool writeUpdatedFile(const QString &inputFilename, const QString &outputFilename, const QHash< QgsPointCloudNodeId, UpdatedChunk > &updatedChunks, QString *errorMessage=nullptr)
Convenience function to do the whole process in one go: load a COPC file, then write a new COPC file ...
QString source() const
Returns the source for the layer.
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.
Container class for QgsPointCloudBlock cache keys.
@ ChangeAttributeValues
Provider can modify the values of point attributes.
virtual QgsPointCloudIndex index() const
Returns the point cloud index associated with the provider.
virtual QgsPointCloudDataProvider::Capabilities capabilities() const
Returns flags containing the supported capabilities for the data provider.
bool hasValidIndex() const
Returns whether provider has index which is valid.
QList< QgsPointCloudNodeId > updatedNodes() const
Returns a list of node IDs that have been modified.
bool hasNode(const QgsPointCloudNodeId &n) const override
Returns whether the octree contain given node.
bool isModified() const
Returns true if there are uncommitted changes, false otherwise.
QVariantMap originalMetadata() const override
Returns the original metadata map.
qint64 pointCount() const override
Returns the number of points in the point cloud.
bool commitChanges(QString *errorMessage=nullptr)
Tries to store pending changes to the data provider.
bool setSubsetString(const QString &subset) override
Sets the string used to define a subset of the point cloud.
void load(const QString &fileName) override
Loads the index from the file.
QgsPointCloudBlockRequest * asyncNodeData(const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request) override
Returns a handle responsible for loading a node data block.
QgsPointCloudEditingIndex(QgsPointCloudLayer *layer)
Ctor.
QString subsetString() const override
Returns the string used to define a subset of the point cloud.
bool isValid() const override
Returns whether index is loaded and valid.
std::unique_ptr< QgsPointCloudBlock > nodeData(const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request) override
Returns node data block.
QgsPointCloudNode getNode(const QgsPointCloudNodeId &id) const override
Returns object for a given node.
Qgis::PointCloudAccessType accessType() const override
Returns the access type of the data If the access type is Remote, data will be fetched from an HTTP s...
bool updateNodeData(const QHash< QgsPointCloudNodeId, QByteArray > &data) override
Tries to update the data for the specified nodes.
QgsCoordinateReferenceSystem crs() const override
Returns the coordinate reference system of the point cloud index.
int span() const
Returns the number of points in one direction in a single node.
double zMax() const
Returns z max.
QgsBox3D rootNodeBounds() const
Returns bounding box of root node in CRS coords.
QString subsetString() const
Returns the string used to define a subset of the point cloud.
double zMin() const
Returns z min.
QgsVector3D offset() const
Returns offset of data from CRS.
QgsVector3D scale() const
Returns scale of data relative to CRS.
bool setSubsetString(const QString &subset)
Sets the string used to define a subset of the point cloud.
bool isValid() const
Returns whether index is loaded and valid.
QgsRectangle extent() const
Returns extent of the data.
QgsCoordinateReferenceSystem crs() const
Returns the coordinate reference system of the point cloud index.
qint64 pointCount() const
Returns the number of points in the point cloud.
std::unique_ptr< QgsPointCloudBlock > nodeData(const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request)
Returns node data block.
QgsPointCloudNode getNode(const QgsPointCloudNodeId &id) const
Returns object for a given node.
bool hasNode(const QgsPointCloudNodeId &id) const
Returns whether the octree contain given node.
QgsAbstractPointCloudIndex * get()
Returns pointer to the implementation class.
QVariantMap originalMetadata() const
Returns the original metadata map.
QgsPointCloudAttributeCollection attributes() const
Returns all attributes that are stored in the file.
Qgis::PointCloudAccessType accessType() const
Returns the access type of the data If the access type is Remote, data will be fetched from an HTTP s...
Represents a map layer supporting display of point clouds.
QgsPointCloudDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
Represents a indexed point cloud node's position in octree.
Keeps metadata for indexed point cloud node.
qint64 pointCount() const
Returns number of points contained in node data.
Point cloud data request.
bool ignoreIndexFilterEnabled() const
Returns whether the request will ignore the point cloud index's filter expression,...
QgsPointCloudAttributeCollection attributes() const
Returns attributes.
QgsRectangle filterRect() const
Returns the rectangle from which points will be taken, in point cloud's crs.
A rectangle specified with double values.
Keeps information how points of a single chunk has been modified.