32 , mSymbol( std::move(
symbol ) )
53 mFilteredOutCategories = categories;
58 QSet<int> filteredOut;
60 filteredOut.insert( category.value() );
72 return mFeedback->isCanceled();
80void QgsPointCloud3DRenderContext::updateExtent()
93 catch (
const QgsCsException & )
96 QgsDebugError( QStringLiteral(
"Transformation of extent failed!" ) );
97 mLayerExtent = QgsRectangle();
131 return qobject_cast<QgsPointCloudLayer *>( mLayerRef.layer );
136 return QStringLiteral(
"pointcloud" );
163 Qt3DCore::QEntity *entity =
nullptr;
184 QDomDocument doc = elem.ownerDocument();
186 elem.setAttribute( QStringLiteral(
"layer" ), mLayerRef.layerId );
188 elem.setAttribute( QStringLiteral(
"show-bounding-boxes" ),
showBoundingBoxes() ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
189 elem.setAttribute( QStringLiteral(
"point-budget" ), mPointBudget );
190 elem.setAttribute( QStringLiteral(
"zoom-out-behavior" ),
qgsEnumValueToKey( mZoomOutBehavior ) );
192 QDomElement elemSymbol = doc.createElement( QStringLiteral(
"symbol" ) );
195 elemSymbol.setAttribute( QStringLiteral(
"type" ), mSymbol->symbolType() );
196 mSymbol->writeXml( elemSymbol, context );
198 elem.appendChild( elemSymbol );
203 mLayerRef =
QgsMapLayerRef( elem.attribute( QStringLiteral(
"layer" ) ) );
205 const QDomElement elemSymbol = elem.firstChildElement( QStringLiteral(
"symbol" ) );
207 const QString symbolType = elemSymbol.attribute( QStringLiteral(
"type" ) );
208 mShowBoundingBoxes = elem.attribute( QStringLiteral(
"show-bounding-boxes" ), QStringLiteral(
"0" ) ).toInt();
209 mMaximumScreenError = elem.attribute( QStringLiteral(
"max-screen-error" ), QStringLiteral(
"3.0" ) ).toDouble();
210 mPointBudget = elem.attribute( QStringLiteral(
"point-budget" ), QStringLiteral(
"5000000" ) ).toInt();
213 if ( symbolType == QLatin1String(
"single-color" ) )
214 mSymbol = std::make_unique<QgsSingleColorPointCloud3DSymbol>();
215 else if ( symbolType == QLatin1String(
"color-ramp" ) )
216 mSymbol = std::make_unique<QgsColorRampPointCloud3DSymbol>();
217 else if ( symbolType == QLatin1String(
"rgb" ) )
218 mSymbol = std::make_unique<QgsRgbPointCloud3DSymbol>();
219 else if ( symbolType == QLatin1String(
"classification" ) )
220 mSymbol = std::make_unique<QgsClassificationPointCloud3DSymbol>();
225 mSymbol->readXml( elemSymbol, context );
230 mLayerRef.setLayer( project.
mapLayer( mLayerRef.layerId ) );
235 return mMaximumScreenError;
240 mMaximumScreenError = error;
245 return mShowBoundingBoxes;
255 mPointBudget = budget;
@ RenderExtents
Render only point cloud extents when zoomed out.
@ Reverse
Reverse/inverse transform (from destination to source).
QgsCoordinateReferenceSystem crs() const
Returns coordinate reference system used in the 3D scene.
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which stores various information regarding which datum tran...
Qgs3DRenderContext()=default
QgsRectangle extent() const
Returns the 3D scene's 2D extent in the 3D scene's CRS.
static std::unique_ptr< QgsPointCloudLayer3DRenderer > convert2DPointCloudRendererTo3D(QgsPointCloudRenderer *renderer)
Creates a QgsPointCloudLayer3DRenderer matching the symbol settings of a given QgsPointCloudRenderer.
Base class for all renderers that participate in 3D views.
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
virtual QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
double zScale() const
Returns the z scale, which is a scaling factor which should be applied to z values from the layer.
double zOffset() const
Returns the z offset, which is a fixed offset amount which should be added to z values from the layer...
QgsCoordinateReferenceSystem crs3D
QSet< int > getFilteredOutValues() const
Returns a set containing the filtered out values.
QgsPointCloud3DSymbol * symbol() const
Returns the symbol used for rendering the point cloud.
double zValueScale() const
Returns any constant scaling factor which must be applied to z values taken from the point cloud inde...
void setFilteredOutCategories(const QgsPointCloudCategoryList &categories)
Sets the list of categories of the classification that won't be rendered.
QgsPointCloudAttributeCollection attributes() const
Returns the attributes associated with the rendered block.
void setSymbol(QgsPointCloud3DSymbol *symbol)
Sets the symbol used for rendering the point cloud Takes ownership over the passed symbol.
bool isCanceled() const
Returns true if the rendering is canceled.
void setCoordinateTransform(const QgsCoordinateTransform &coordinateTransform)
Sets the coordinate transform used to transform points from layer CRS to the map CRS.
QgsCoordinateTransform coordinateTransform() const
Returns the coordinate transform used to transform points from layer CRS to the map CRS.
void cancelRendering() const
Cancels rendering.
double zValueFixedOffset() const
Returns any constant offset which must be applied to z values taken from the point cloud index.
QgsPointCloud3DRenderContext(const Qgs3DRenderContext &context, const QgsCoordinateTransform &coordinateTransform, std::unique_ptr< QgsPointCloud3DSymbol > symbol, double zValueScale, double zValueFixedOffset)
Constructor for QgsPointCloud3DRenderContext.
void setAttributes(const QgsPointCloudAttributeCollection &attributes)
Sets the attributes associated with the rendered block.
3D symbol that draws point cloud geometries as 3D objects.
void copyBaseSettings(QgsAbstract3DSymbol *destination) const override
A collection of point cloud attributes.
Represents an individual category (class) from a QgsPointCloudClassifiedRenderer.
virtual QVector< QgsPointCloudSubIndex > subIndexes()
Returns a list of sub indexes available if the provider supports multiple indexes,...
3D renderer that renders all points from a point cloud layer.
void resolveReferences(const QgsProject &project) override
Resolves references to other objects - second phase of loading - after readXml().
void setLayer(QgsPointCloudLayer *layer)
Sets point cloud layer associated with the renderer.
double maximumScreenError() const
Returns the maximum screen error allowed when rendering the point cloud.
void setPointRenderingBudget(int budget)
Sets the maximum number of points to be rendered in the scene.
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const override
Writes renderer's properties to given XML element.
const QgsPointCloud3DSymbol * symbol() const
Returns 3D symbol associated with the renderer.
QString type() const override
Returns unique identifier of the renderer class (used to identify subclass).
bool showBoundingBoxes() const
Returns whether bounding boxes will be visible when rendering the point cloud.
QgsPointCloudLayer3DRenderer()
Takes ownership of the symbol object.
QgsPointCloudLayer3DRenderer * clone() const override
Returns a cloned instance.
QgsPointCloudLayer * layer() const
Returns point cloud layer associated with the renderer.
void setSymbol(QgsPointCloud3DSymbol *symbol)
Sets the 3D symbol associated with the renderer.
void setMaximumScreenError(double error)
Sets the maximum screen error allowed when rendering the point cloud.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context) override
Reads renderer's properties from given XML element.
bool convertFrom2DRenderer(QgsPointCloudRenderer *renderer) override
Updates the 3D renderer's symbol to match that of a given QgsPointCloudRenderer.
void setShowBoundingBoxes(bool showBoundingBoxes)
Sets whether bounding boxes will be visible when rendering the point cloud.
Qt3DCore::QEntity * createEntity(Qgs3DMapSettings *map) const override
Returns a 3D entity that will be used to show renderer's data in 3D scene.
void setZoomOutBehavior(const Qgis::PointCloudZoomOutRenderBehavior behavior)
Sets the renderer behavior when zoomed out.
Point cloud layer specific subclass of QgsMapLayerElevationProperties.
Represents a map layer supporting display of point clouds.
QgsMapLayerElevationProperties * elevationProperties() override
Returns the layer's elevation properties.
QgsPointCloudIndex index() const
Returns the point cloud index associated with the layer.
QgsPointCloudDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
Abstract base class for 2d point cloud renderers.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Q_INVOKABLE QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
A container for the context for various read/write operations on objects.
A rectangle specified with double values.
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
#define QgsDebugError(str)
_LayerRef< QgsMapLayer > QgsMapLayerRef
QList< QgsPointCloudCategory > QgsPointCloudCategoryList