QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgstiledscenelayer.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgstiledscenelayer.cpp
3 --------------------
4 begin : June 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "qgstiledscenelayer.h"
19#include "moc_qgstiledscenelayer.cpp"
20#include "qgsthreadingutils.h"
21#include "qgsmaplayerfactory.h"
22#include "qgspainting.h"
23#include "qgsproviderregistry.h"
26#include "qgsxmlutils.h"
27#include "qgsruntimeprofiler.h"
28#include "qgsapplication.h"
32
34 const QString &baseName,
35 const QString &provider,
37 : QgsMapLayer( Qgis::LayerType::TiledScene, baseName, uri )
38 , mElevationProperties( new QgsTiledSceneLayerElevationProperties( this ) )
39 , mLayerOptions( options )
40{
41 if ( !uri.isEmpty() && !provider.isEmpty() )
42 {
43 const QgsDataProvider::ProviderOptions providerOptions { options.transformContext };
44 Qgis::DataProviderReadFlags providerFlags;
45 if ( options.loadDefaultStyle )
46 {
48 }
49 setDataSource( uri, baseName, provider, providerOptions, providerFlags );
50 }
51
52 // TODO: temporary, for removal
53 if ( provider == QLatin1String( "test_tiled_scene_provider" ) )
54 mValid = true;
55
56#if 0
57 setLegend( QgsMapLayerLegend::defaultTiledSceneLegend( this ) );
58#endif
59}
60
62
64{
66
67 QgsTiledSceneLayer *layer = new QgsTiledSceneLayer( source(), name(), mProviderKey, mLayerOptions );
68 QgsMapLayer::clone( layer );
69
70 if ( mRenderer )
71 layer->setRenderer( mRenderer->clone() );
72
73 layer->mElevationProperties = mElevationProperties->clone();
74 layer->mElevationProperties->setParent( layer );
75
76 layer->mLayerOptions = mLayerOptions;
77
78 return layer;
79}
80
82{
84
85 if ( !mDataProvider )
86 return QgsRectangle();
87
88 return mDataProvider->extent();
89}
90
91QString QgsTiledSceneLayer::loadDefaultMetadata( bool &resultFlag )
92{
94
95 resultFlag = false;
96 if ( !mDataProvider || !mDataProvider->isValid() )
97 return QString();
98
99 if ( qgis::down_cast< QgsTiledSceneDataProvider * >( mDataProvider.get() )->capabilities() & Qgis::TiledSceneProviderCapability::ReadLayerMetadata )
100 {
101 setMetadata( mDataProvider->layerMetadata() );
102 }
103 else
104 {
106 }
107 resultFlag = true;
108 return QString();
109}
110
117
124
131
133{
135
136 return mRenderer.get();
137}
138
140{
142
143 if ( renderer == mRenderer.get() )
144 return;
145
146 mRenderer.reset( renderer );
147 emit rendererChanged();
149}
150
157
159{
161
162 return mDataProvider.get();
163}
164
165bool QgsTiledSceneLayer::readXml( const QDomNode &layerNode, QgsReadWriteContext &context )
166{
168
169 // create provider
170 const QDomNode pkeyNode = layerNode.namedItem( QStringLiteral( "provider" ) );
171 mProviderKey = pkeyNode.toElement().text();
172
174 {
175 const QgsDataProvider::ProviderOptions providerOptions { context.transformContext() };
177 // read extent
179 {
180 const QDomNode extentNode = layerNode.namedItem( QStringLiteral( "extent" ) );
181 if ( !extentNode.isNull() )
182 {
183 // get the extent
184 const QgsRectangle mbr = QgsXmlUtils::readRectangle( extentNode.toElement() );
185
186 // store the extent
187 setExtent( mbr );
188 }
189 }
190
192 }
193
194 QString errorMsg;
195 if ( !readSymbology( layerNode, errorMsg, context ) )
196 return false;
197
198 readStyleManager( layerNode );
199
200 return isValid();
201}
202
203bool QgsTiledSceneLayer::writeXml( QDomNode &layerNode, QDomDocument &doc, const QgsReadWriteContext &context ) const
204{
206
207 QDomElement mapLayerNode = layerNode.toElement();
208 mapLayerNode.setAttribute( QStringLiteral( "type" ), QgsMapLayerFactory::typeToString( Qgis::LayerType::TiledScene ) );
209
210 {
211 QDomElement provider = doc.createElement( QStringLiteral( "provider" ) );
212 const QDomText providerText = doc.createTextNode( providerType() );
213 provider.appendChild( providerText );
214 layerNode.appendChild( provider );
215 }
216
217 writeStyleManager( layerNode, doc );
218
219 QString errorMsg;
220 return writeSymbology( layerNode, doc, errorMsg, context );
221}
222
223bool QgsTiledSceneLayer::readSymbology( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
224{
226
227 const QDomElement elem = node.toElement();
228
229 readCommonStyle( elem, context, categories );
230
231 readStyle( node, errorMessage, context, categories );
232
233 if ( categories.testFlag( CustomProperties ) )
234 readCustomProperties( node, QStringLiteral( "variable" ) );
235
236 return true;
237}
238
239bool QgsTiledSceneLayer::readStyle( const QDomNode &node, QString &, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
240{
242
243 bool result = true;
244
245 if ( categories.testFlag( Symbology ) )
246 {
247 // get and set the blend mode if it exists
248 const QDomNode blendModeNode = node.namedItem( QStringLiteral( "blendMode" ) );
249 if ( !blendModeNode.isNull() )
250 {
251 const QDomElement e = blendModeNode.toElement();
252 setBlendMode( QgsPainting::getCompositionMode( static_cast< Qgis::BlendMode >( e.text().toInt() ) ) );
253 }
254
255 QDomElement rendererElement = node.firstChildElement( QStringLiteral( "renderer" ) );
256 if ( !rendererElement.isNull() )
257 {
258 std::unique_ptr< QgsTiledSceneRenderer > r( QgsTiledSceneRenderer::load( rendererElement, context ) );
259 if ( r )
260 {
261 setRenderer( r.release() );
262 }
263 else
264 {
265 result = false;
266 }
267 }
268 // make sure layer has a renderer - if none exists, fallback to a default renderer
269 if ( !mRenderer )
270 {
272 }
273 }
274
275 // get and set the layer transparency and scale visibility if they exists
276 if ( categories.testFlag( Rendering ) )
277 {
278 const QDomNode layerOpacityNode = node.namedItem( QStringLiteral( "layerOpacity" ) );
279 if ( !layerOpacityNode.isNull() )
280 {
281 const QDomElement e = layerOpacityNode.toElement();
282 setOpacity( e.text().toDouble() );
283 }
284
285 const bool hasScaleBasedVisibiliy { node.attributes().namedItem( QStringLiteral( "hasScaleBasedVisibilityFlag" ) ).nodeValue() == '1' };
286 setScaleBasedVisibility( hasScaleBasedVisibiliy );
287 bool ok;
288 const double maxScale { node.attributes().namedItem( QStringLiteral( "maxScale" ) ).nodeValue().toDouble( &ok ) };
289 if ( ok )
290 {
291 setMaximumScale( maxScale );
292 }
293 const double minScale { node.attributes().namedItem( QStringLiteral( "minScale" ) ).nodeValue().toDouble( &ok ) };
294 if ( ok )
295 {
296 setMinimumScale( minScale );
297 }
298 }
299 return result;
300}
301
302bool QgsTiledSceneLayer::writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
303 const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
304{
306
307 Q_UNUSED( errorMessage )
308
309 QDomElement elem = node.toElement();
310 writeCommonStyle( elem, doc, context, categories );
311
312 ( void )writeStyle( node, doc, errorMessage, context, categories );
313
314 return true;
315}
316
317bool QgsTiledSceneLayer::writeStyle( QDomNode &node, QDomDocument &doc, QString &, const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
318{
320
321 QDomElement mapLayerNode = node.toElement();
322
323 //save custom properties
324 if ( categories.testFlag( CustomProperties ) )
325 {
326 writeCustomProperties( node, doc );
327 }
328
329 if ( categories.testFlag( Symbology ) )
330 {
331 // add the blend mode field
332 QDomElement blendModeElem = doc.createElement( QStringLiteral( "blendMode" ) );
333 const QDomText blendModeText = doc.createTextNode( QString::number( static_cast< int >( QgsPainting::getBlendModeEnum( blendMode() ) ) ) );
334 blendModeElem.appendChild( blendModeText );
335 node.appendChild( blendModeElem );
336
337 if ( mRenderer )
338 {
339 const QDomElement rendererElement = mRenderer->save( doc, context );
340 node.appendChild( rendererElement );
341 }
342 }
343
344 // add the layer opacity and scale visibility
345 if ( categories.testFlag( Rendering ) )
346 {
347 QDomElement layerOpacityElem = doc.createElement( QStringLiteral( "layerOpacity" ) );
348 const QDomText layerOpacityText = doc.createTextNode( QString::number( opacity() ) );
349 layerOpacityElem.appendChild( layerOpacityText );
350 node.appendChild( layerOpacityElem );
351
352 mapLayerNode.setAttribute( QStringLiteral( "hasScaleBasedVisibilityFlag" ), hasScaleBasedVisibility() ? 1 : 0 );
353 mapLayerNode.setAttribute( QStringLiteral( "maxScale" ), maximumScale() );
354 mapLayerNode.setAttribute( QStringLiteral( "minScale" ), minimumScale() );
355 }
356 return true;
357}
358
360{
362
363 if ( mDataProvider )
364 mDataProvider->setTransformContext( transformContext );
366}
367
368void QgsTiledSceneLayer::setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider,
370{
372
373 setName( baseName );
374 mProviderKey = provider;
375 mDataSource = dataSource;
376
377 if ( mPreloadedProvider )
378 {
379 mDataProvider.reset( qobject_cast< QgsTiledSceneDataProvider * >( mPreloadedProvider.release() ) );
380 }
381 else
382 {
383 std::unique_ptr< QgsScopedRuntimeProfile > profile;
384 if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
385 profile = std::make_unique< QgsScopedRuntimeProfile >( tr( "Create %1 provider" ).arg( provider ), QStringLiteral( "projectload" ) );
386 mDataProvider.reset( qobject_cast<QgsTiledSceneDataProvider *>( QgsProviderRegistry::instance()->createProvider( provider, dataSource, options, flags ) ) );
387 }
388
389 if ( !mDataProvider )
390 {
391 QgsDebugError( QStringLiteral( "Unable to get tiled scene data provider" ) );
392 setValid( false );
393 return;
394 }
395
396 mDataProvider->setParent( this );
397 QgsDebugMsgLevel( QStringLiteral( "Instantiated the tiled scene data provider plugin" ), 2 );
398
399 setValid( mDataProvider->isValid() );
400 if ( !isValid() )
401 {
402 QgsDebugError( QStringLiteral( "Invalid tiled scene provider plugin %1" ).arg( QString( mDataSource.toUtf8() ) ) );
403 setError( mDataProvider->error() );
404 return;
405 }
406
407 // Load initial extent, crs and renderer
408 setCrs( mDataProvider->crs() );
410 {
411 setExtent( mDataProvider->extent() );
412 }
413
414 bool loadDefaultStyleFlag = false;
416 {
417 loadDefaultStyleFlag = true;
418 }
419
420 if ( !mRenderer || loadDefaultStyleFlag )
421 {
422 std::unique_ptr< QgsScopedRuntimeProfile > profile;
423 if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
424 profile = std::make_unique< QgsScopedRuntimeProfile >( tr( "Load layer style" ), QStringLiteral( "projectload" ) );
425
426 bool defaultLoadedFlag = false;
427
428 if ( !defaultLoadedFlag && loadDefaultStyleFlag )
429 {
430 loadDefaultStyle( defaultLoadedFlag );
431 }
432
433 if ( !defaultLoadedFlag )
434 {
435 // all else failed, create default renderer
437 }
438 }
439}
440
441QString QgsTiledSceneLayer::encodedSource( const QString &source, const QgsReadWriteContext &context ) const
442{
444
446}
447
448QString QgsTiledSceneLayer::decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const
449{
451
453}
454
455QString QgsTiledSceneLayer::loadDefaultStyle( bool &resultFlag )
456{
458
459 return QgsMapLayer::loadDefaultStyle( resultFlag );
460}
461
463{
465
466 const QgsLayerMetadataFormatter htmlFormatter( metadata() );
467 QString myMetadata = QStringLiteral( "<html>\n<body>\n" );
468
469 myMetadata += generalHtmlMetadata();
470
471 // Begin Provider section
472 myMetadata += QStringLiteral( "<h1>" ) + tr( "Information from provider" ) + QStringLiteral( "</h1>\n<hr>\n" );
473 myMetadata += QLatin1String( "<table class=\"list-view\">\n" );
474
475 if ( mDataProvider )
476 myMetadata += mDataProvider->htmlMetadata();
477
478 // Extent
479 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Extent" ) + QStringLiteral( "</td><td>" ) + extent().toString() + QStringLiteral( "</td></tr>\n" );
480
481 myMetadata += QLatin1String( "</table>\n<br><br>" );
482
483 // CRS
484 myMetadata += crsHtmlMetadata();
485
486 // identification section
487 myMetadata += QStringLiteral( "<h1>" ) + tr( "Identification" ) + QStringLiteral( "</h1>\n<hr>\n" );
488 myMetadata += htmlFormatter.identificationSectionHtml( );
489 myMetadata += QLatin1String( "<br><br>\n" );
490
491 // extent section
492 myMetadata += QStringLiteral( "<h1>" ) + tr( "Extent" ) + QStringLiteral( "</h1>\n<hr>\n" );
493 myMetadata += htmlFormatter.extentSectionHtml( isSpatial() );
494 myMetadata += QLatin1String( "<br><br>\n" );
495
496 // Start the Access section
497 myMetadata += QStringLiteral( "<h1>" ) + tr( "Access" ) + QStringLiteral( "</h1>\n<hr>\n" );
498 myMetadata += htmlFormatter.accessSectionHtml( );
499 myMetadata += QLatin1String( "<br><br>\n" );
500
501 // Start the contacts section
502 myMetadata += QStringLiteral( "<h1>" ) + tr( "Contacts" ) + QStringLiteral( "</h1>\n<hr>\n" );
503 myMetadata += htmlFormatter.contactsSectionHtml( );
504 myMetadata += QLatin1String( "<br><br>\n" );
505
506 // Start the links section
507 myMetadata += QStringLiteral( "<h1>" ) + tr( "Links" ) + QStringLiteral( "</h1>\n<hr>\n" );
508 myMetadata += htmlFormatter.linksSectionHtml( );
509 myMetadata += QLatin1String( "<br><br>\n" );
510
511 // Start the history section
512 myMetadata += QStringLiteral( "<h1>" ) + tr( "History" ) + QStringLiteral( "</h1>\n<hr>\n" );
513 myMetadata += htmlFormatter.historySectionHtml( );
514 myMetadata += QLatin1String( "<br><br>\n" );
515
516 myMetadata += customPropertyHtmlMetadata();
517
518 myMetadata += QLatin1String( "\n</body>\n</html>\n" );
519 return myMetadata;
520}
521
522bool QgsTiledSceneLayer::isReadOnly() const
523{
524 return true;
525}
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
BlendMode
Blending modes defining the available composition modes that can be used when painting.
Definition qgis.h:4639
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
Definition qgis.h:450
@ ReadLayerMetadata
Provider can read layer metadata from data store. See QgsDataProvider::layerMetadata()
@ TiledScene
Tiled scene layer. Added in QGIS 3.34.
@ LoadDefaultStyle
Reset the layer's style to the default for the datasource.
@ SkipGetExtent
Skip the extent from provider.
static QgsRuntimeProfiler * profiler()
Returns the application runtime profiler.
Contains information about the context in which a coordinate transform is executed.
Class for metadata formatter.
Base class for storage of map layer elevation properties.
static QString typeToString(Qgis::LayerType type)
Converts a map layer type to a string value.
Base class for utility classes that encapsulate information necessary for rendering of map layers.
Base class for all map layer types.
Definition qgsmaplayer.h:76
QString name
Definition qgsmaplayer.h:80
void readStyleManager(const QDomNode &layerNode)
Read style manager's configuration (if any). To be called by subclasses.
virtual bool isSpatial() const
Returns true if the layer is considered a spatial layer, ie it has some form of geometry associated w...
void setError(const QgsError &error)
Sets error message.
void writeStyleManager(QDomNode &layerNode, QDomDocument &doc) const
Write style manager's configuration (if exists). To be called by subclasses.
QString source() const
Returns the source for the layer.
QString providerType() const
Returns the provider type (provider key) for this layer.
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
static Qgis::DataProviderReadFlags providerReadFlags(const QDomNode &layerNode, QgsMapLayer::ReadFlags layerReadFlags)
Returns provider read flag deduced from layer read flags layerReadFlags and a dom node layerNode that...
QgsMapLayer::LayerFlags flags() const
Returns the flags for this layer.
void writeCustomProperties(QDomNode &layerNode, QDomDocument &doc) const
Write custom properties to project file.
virtual QString loadDefaultStyle(bool &resultFlag)
Retrieve the default style for this layer if one exists (either as a .qml file on disk or as a record...
void setDataSource(const QString &dataSource, const QString &baseName=QString(), const QString &provider=QString(), bool loadDefaultStyleFlag=false)
Updates the data source of the layer.
QString mLayerName
Name of the layer - used for display.
QString crsHtmlMetadata() const
Returns a HTML fragment containing the layer's CRS metadata, for use in the htmlMetadata() method.
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
QgsLayerMetadata metadata
Definition qgsmaplayer.h:82
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
virtual void setOpacity(double opacity)
Sets the opacity for the layer, where opacity is a value between 0 (totally transparent) and 1....
void readCustomProperties(const QDomNode &layerNode, const QString &keyStartsWith=QString())
Read custom properties from project file.
virtual void setMetadata(const QgsLayerMetadata &metadata)
Sets the layer's metadata store.
QFlags< StyleCategory > StyleCategories
QString mProviderKey
Data provider key (name of the data provider)
QgsCoordinateTransformContext transformContext() const
Returns the layer data provider coordinate transform context or a default transform context if the la...
std::unique_ptr< QgsDataProvider > mPreloadedProvider
Optionally used when loading a project, it is released when the layer is effectively created.
void rendererChanged()
Signal emitted when renderer is changed.
void setScaleBasedVisibility(bool enabled)
Sets whether scale based visibility is enabled for the layer.
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
void emitStyleChanged()
Triggers an emission of the styleChanged() signal.
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
void setName(const QString &name)
Set the display name of the layer.
virtual void setExtent(const QgsRectangle &rect)
Sets the extent.
QString mDataSource
Data source description string, varies by layer type.
virtual QString loadDefaultMetadata(bool &resultFlag)
Retrieve the default metadata for this layer if one exists (either as a .qmd file on disk or as a rec...
@ FlagReadExtentFromXml
Read extent from xml and skip get extent from provider.
@ FlagDontResolveLayers
Don't resolve layer paths or create data providers for layers.
void setValid(bool valid)
Sets whether layer is valid or not.
void readCommonStyle(const QDomElement &layerElement, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories)
Read style data common to all layer types.
QgsMapLayer::ReadFlags mReadFlags
Read flags. It's up to the subclass to respect these when restoring state from XML.
double minimumScale() const
Returns the minimum map scale (i.e.
void setLegend(QgsMapLayerLegend *legend)
Assign a legend controller to the map layer.
double opacity
Definition qgsmaplayer.h:88
bool mValid
Indicates if the layer is valid and can be drawn.
@ Symbology
Symbology.
@ Rendering
Rendering: scale visibility, simplify method, opacity.
@ CustomProperties
Custom properties (by plugins for instance)
QString customPropertyHtmlMetadata() const
Returns an HTML fragment containing custom property information, for use in the htmlMetadata() method...
QString generalHtmlMetadata() const
Returns an HTML fragment containing general metadata information, for use in the htmlMetadata() metho...
void writeCommonStyle(QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const
Write style data common to all layer types.
double maximumScale() const
Returns the maximum map scale (i.e.
void invalidateWgs84Extent()
Invalidates the WGS84 extent.
void setCrs(const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
Sets layer's spatial reference system.
static Qgis::BlendMode getBlendModeEnum(QPainter::CompositionMode blendMode)
Returns a Qgis::BlendMode corresponding to a QPainter::CompositionMode.
static QPainter::CompositionMode getCompositionMode(Qgis::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a Qgis::BlendMode.
QString absoluteToRelativeUri(const QString &providerKey, const QString &uri, const QgsReadWriteContext &context) const
Converts absolute path(s) to relative path(s) in the given provider-specific URI.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
QString relativeToAbsoluteUri(const QString &providerKey, const QString &uri, const QgsReadWriteContext &context) const
Converts relative path(s) to absolute path(s) in the given provider-specific URI.
The class is used as a container of context for various read/write operations on other objects.
QgsCoordinateTransformContext transformContext() const
Returns data provider coordinate transform context.
A rectangle specified with double values.
Q_INVOKABLE QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
Contains information about the context of a rendering operation.
Base class for data providers for QgsTiledSceneLayer.
Tiled scene layer specific subclass of QgsMapLayerElevationProperties.
QgsTiledSceneLayerElevationProperties * clone() const override
Creates a clone of the properties.
Implementation of threaded 2D rendering for tiled scene layers.
Represents a map layer supporting display of tiled scene objects.
QgsTiledSceneLayer * clone() const override
Returns a new instance equivalent to this one except for the id which is still unique.
void setTransformContext(const QgsCoordinateTransformContext &transformContext) override
Sets the coordinate transform context to transformContext.
bool readStyle(const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) FINAL
Read the style for the current layer from the DOM node supplied.
QgsTiledSceneLayer(const QString &uri=QString(), const QString &baseName=QString(), const QString &provider=QString(), const QgsTiledSceneLayer::LayerOptions &options=QgsTiledSceneLayer::LayerOptions())
Constructor for QgsTiledSceneLayer.
QString htmlMetadata() const override
Obtain a formatted HTML string containing assorted metadata for this layer.
bool writeStyle(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const FINAL
Write just the symbology information for the layer into the document.
bool readSymbology(const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) override
Read the symbology for the current layer from the DOM node supplied.
QString loadDefaultStyle(bool &resultFlag) FINAL
Retrieve the default style for this layer if one exists (either as a .qml file on disk or as a record...
QgsRectangle extent() const override
Returns the extent of the layer.
QString decodedSource(const QString &source, const QString &dataProvider, const QgsReadWriteContext &context) const override
Called by readLayerXML(), used by derived classes to decode provider's specific data source from proj...
void setRenderer(QgsTiledSceneRenderer *renderer)
Sets the 2D renderer for the tiled scene.
QgsMapLayerElevationProperties * elevationProperties() override
Returns the layer's elevation properties.
QString loadDefaultMetadata(bool &resultFlag) override
Retrieve the default metadata for this layer if one exists (either as a .qmd file on disk or as a rec...
QgsTiledSceneDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const override
Write the style for the layer into the document provided.
QString encodedSource(const QString &source, const QgsReadWriteContext &context) const override
Called by writeLayerXML(), used by derived classes to encode provider's specific data source to proje...
~QgsTiledSceneLayer() override
QgsTiledSceneRenderer * renderer()
Returns the 2D renderer for the tiled scene.
bool writeXml(QDomNode &layerNode, QDomDocument &doc, const QgsReadWriteContext &context) const override
Called by writeLayerXML(), used by children to write state specific to them to project files.
bool readXml(const QDomNode &layerNode, QgsReadWriteContext &context) override
Called by readLayerXML(), used by children to read state specific to them from project files.
QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext) override
Returns new instance of QgsMapLayerRenderer that will be used for rendering of given context.
static QgsTiledSceneRenderer * defaultRenderer(const QgsTiledSceneLayer *layer)
Returns a new default tiled scene renderer for a specified layer.
Abstract base class for 2d tiled scene renderers.
static QgsTiledSceneRenderer * load(QDomElement &element, const QgsReadWriteContext &context)
Creates a renderer from an XML element.
static QgsRectangle readRectangle(const QDomElement &element)
#define QgsDebugMsgLevel(str, level)
Definition qgslogger.h:39
#define QgsDebugError(str)
Definition qgslogger.h:38
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS
Setting options for creating vector data providers.
Setting options for loading tiled scene layers.
bool loadDefaultStyle
Set to true if the default layer style should be loaded.
QgsCoordinateTransformContext transformContext
Coordinate transform context.