31 : mRenderContext( context )
44 mTextureImage = image;
49 mTextureCoordinates[0] = textureX1;
50 mTextureCoordinates[1] = textureY1;
51 mTextureCoordinates[2] = textureX2;
52 mTextureCoordinates[3] = textureY2;
53 mTextureCoordinates[4] = textureX3;
54 mTextureCoordinates[5] = textureY3;
59 textureX1 = mTextureCoordinates[0];
60 textureY1 = mTextureCoordinates[1];
61 textureX2 = mTextureCoordinates[2];
62 textureY2 = mTextureCoordinates[3];
63 textureX3 = mTextureCoordinates[4];
64 textureY3 = mTextureCoordinates[5];
78 if ( element.isNull() )
82 const QString rendererType = element.attribute( QStringLiteral(
"type" ) );
88 std::unique_ptr< QgsTiledSceneRenderer > r( m->
createRenderer( element, context ) );
97 mThread = QThread::currentThread();
101 Q_ASSERT_X( mThread == QThread::currentThread(),
"QgsTiledSceneRenderer::startRender",
"startRender called in a different thread - use a cloned renderer instead" );
109 Q_ASSERT_X( mThread == QThread::currentThread(),
"QgsTiledSceneRenderer::stopRender",
"stopRender called in a different thread - use a cloned renderer instead" );
115 return mMaximumScreenError;
120 mMaximumScreenError = error;
125 return mMaximumScreenErrorUnit;
130 mMaximumScreenErrorUnit = unit;
135 return QList<QgsLayerTreeModelLegendNode *>();
140 return QStringList();
152 mMaximumScreenError = element.attribute( QStringLiteral(
"maximumScreenError" ), QStringLiteral(
"3" ) ).toDouble();
153 mMaximumScreenErrorUnit =
QgsUnitTypes::decodeRenderUnit( element.attribute( QStringLiteral(
"maximumScreenErrorUnit" ), QStringLiteral(
"MM" ) ) );
154 mTileBorderRendering = element.attribute( QStringLiteral(
"tileBorderRendering" ), QStringLiteral(
"0" ) ).toInt();
159 element.setAttribute( QStringLiteral(
"maximumScreenError" ),
qgsDoubleToString( mMaximumScreenError ) );
160 element.setAttribute( QStringLiteral(
"maximumScreenErrorUnit" ),
QgsUnitTypes::encodeUnit( mMaximumScreenErrorUnit ) );
161 element.setAttribute( QStringLiteral(
"tileBorderRendering" ), mTileBorderRendering ? 1 : 0 );
@ RendersLines
Renderer can render line primitives.
@ RendersTriangles
Renderer can render triangle primitives.
RenderUnit
Rendering size units.
QFlags< TiledSceneRendererFlag > TiledSceneRendererFlags
Flags which control how tiled scene 2D renderers behave.
static QgsTiledSceneRendererRegistry * tiledSceneRendererRegistry()
Returns the application's tiled scene renderer registry, used for managing tiled scene layer 2D rende...
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Layer tree node points to a map layer.
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
Encapsulates the render context for a 2D tiled scene rendering operation.
void textureCoordinates(float &textureX1, float &textureY1, float &textureX2, float &textureY2, float &textureX3, float &textureY3) const
Returns the current texture coordinates.
void setTextureImage(const QImage &image)
Sets the current texture image.
QgsFeedback * feedback() const
Returns the feedback object used to cancel rendering.
void setTextureCoordinates(float textureX1, float textureY1, float textureX2, float textureY2, float textureX3, float textureY3)
Sets the current texture coordinates.
QImage textureImage() const
Returns the current texture image.
QgsTiledSceneRenderContext(QgsRenderContext &context, QgsFeedback *feedback=nullptr)
Constructor for QgsTiledSceneRenderContext.
QgsTiledSceneRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
void setTileBorderRenderingEnabled(bool enabled)
Sets whether to render the borders of tiles.
virtual QList< QgsLayerTreeModelLegendNode * > createLegendNodes(QgsLayerTreeLayer *nodeLayer)
Creates a set of legend nodes representing the renderer.
void saveCommonProperties(QDomElement &element, const QgsReadWriteContext &context) const
Saves common renderer properties (such as point size and screen error) to the specified DOM element.
virtual void stopRender(QgsTiledSceneRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
void setMaximumScreenErrorUnit(Qgis::RenderUnit unit)
Sets the unit for the maximum screen error allowed when rendering the tiled scene.
Qgis::RenderUnit maximumScreenErrorUnit() const
Returns the unit for the maximum screen error allowed when rendering the tiled scene.
static QgsTiledSceneRenderer * load(QDomElement &element, const QgsReadWriteContext &context)
Creates a renderer from an XML element.
QgsTiledSceneRenderer()=default
double maximumScreenError() const
Returns the maximum screen error allowed when rendering the tiled scene.
void setMaximumScreenError(double error)
Sets the maximum screen error allowed when rendering the tiled scene.
virtual void startRender(QgsTiledSceneRenderContext &context)
Must be called when a new render cycle is started.
void restoreCommonProperties(const QDomElement &element, const QgsReadWriteContext &context)
Restores common renderer properties (such as screen error) from the specified DOM element.
virtual Qgis::TiledSceneRendererFlags flags() const
Returns flags which control how the renderer behaves.
virtual QStringList legendRuleKeys() const
Returns a list of all rule keys for legend nodes created by the renderer.
void copyCommonProperties(QgsTiledSceneRenderer *destination) const
Copies common tiled scene renderer properties (such as screen error) to the destination renderer.
static Q_INVOKABLE Qgis::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
static Q_INVOKABLE QString encodeUnit(Qgis::DistanceUnit unit)
Encodes a distance unit to a string.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.