30 : mRenderContext( context )
31 , mFeedback( feedback )
43 mTextureImage = image;
48 mTextureCoordinates[0] = textureX1;
49 mTextureCoordinates[1] = textureY1;
50 mTextureCoordinates[2] = textureX2;
51 mTextureCoordinates[3] = textureY2;
52 mTextureCoordinates[4] = textureX3;
53 mTextureCoordinates[5] = textureY3;
58 textureX1 = mTextureCoordinates[0];
59 textureY1 = mTextureCoordinates[1];
60 textureX2 = mTextureCoordinates[2];
61 textureY2 = mTextureCoordinates[3];
62 textureX3 = mTextureCoordinates[4];
63 textureY3 = mTextureCoordinates[5];
77 if ( element.isNull() )
81 const QString rendererType = element.attribute( QStringLiteral(
"type" ) );
87 std::unique_ptr< QgsTiledSceneRenderer > r( m->
createRenderer( element, context ) );
96 mThread = QThread::currentThread();
100 Q_ASSERT_X( mThread == QThread::currentThread(),
"QgsTiledSceneRenderer::startRender",
"startRender called in a different thread - use a cloned renderer instead" );
108 Q_ASSERT_X( mThread == QThread::currentThread(),
"QgsTiledSceneRenderer::stopRender",
"stopRender called in a different thread - use a cloned renderer instead" );
114 return mMaximumScreenError;
119 mMaximumScreenError = error;
124 return mMaximumScreenErrorUnit;
129 mMaximumScreenErrorUnit = unit;
134 return QList<QgsLayerTreeModelLegendNode *>();
139 return QStringList();
151 mMaximumScreenError = element.attribute( QStringLiteral(
"maximumScreenError" ), QStringLiteral(
"3" ) ).toDouble();
152 mMaximumScreenErrorUnit =
QgsUnitTypes::decodeRenderUnit( element.attribute( QStringLiteral(
"maximumScreenErrorUnit" ), QStringLiteral(
"MM" ) ) );
153 mTileBorderRendering = element.attribute( QStringLiteral(
"tileBorderRendering" ), QStringLiteral(
"0" ) ).toInt();
158 element.setAttribute( QStringLiteral(
"maximumScreenError" ),
qgsDoubleToString( mMaximumScreenError ) );
159 element.setAttribute( QStringLiteral(
"maximumScreenErrorUnit" ),
QgsUnitTypes::encodeUnit( mMaximumScreenErrorUnit ) );
160 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.
The class is used as a container of context for various read/write operations on other 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.
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.
Abstract base class for 2d tiled scene renderers.
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.
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.