QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
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 "qgsthreadingutils.h"
20#include "qgsmaplayerfactory.h"
21#include "qgspainting.h"
22#include "qgsproviderregistry.h"
25#include "qgsxmlutils.h"
26#include "qgsruntimeprofiler.h"
27#include "qgsapplication.h"
31
33 const QString &baseName,
34 const QString &provider,
36 : QgsMapLayer( Qgis::LayerType::TiledScene, baseName, uri )
37 , mElevationProperties( new QgsTiledSceneLayerElevationProperties( this ) )
38 , mLayerOptions( options )
39{
40 if ( !uri.isEmpty() && !provider.isEmpty() )
41 {
42 const QgsDataProvider::ProviderOptions providerOptions { options.transformContext };
43 QgsDataProvider::ReadFlags providerFlags = QgsDataProvider::ReadFlags();
44 if ( options.loadDefaultStyle )
45 {
47 }
48 setDataSource( uri, baseName, provider, providerOptions, providerFlags );
49 }
50
51 // TODO: temporary, for removal
52 if ( provider == QLatin1String( "test_tiled_scene_provider" ) )
53 mValid = true;
54
55#if 0
56 setLegend( QgsMapLayerLegend::defaultTiledSceneLegend( this ) );
57#endif
58}
59
61
63{
65
66 QgsTiledSceneLayer *layer = new QgsTiledSceneLayer( source(), name(), mProviderKey, mLayerOptions );
67 QgsMapLayer::clone( layer );
68
69 if ( mRenderer )
70 layer->setRenderer( mRenderer->clone() );
71
72 layer->mElevationProperties = mElevationProperties->clone();
73 layer->mElevationProperties->setParent( layer );
74
75 layer->mLayerOptions = mLayerOptions;
76
77 return layer;
78}
79
81{
83
84 if ( !mDataProvider )
85 return QgsRectangle();
86
87 return mDataProvider->extent();
88}
89
90QString QgsTiledSceneLayer::loadDefaultMetadata( bool &resultFlag )
91{
93
94 resultFlag = false;
95 if ( !mDataProvider || !mDataProvider->isValid() )
96 return QString();
97
98 if ( qgis::down_cast< QgsTiledSceneDataProvider * >( mDataProvider.get() )->capabilities() & Qgis::TiledSceneProviderCapability::ReadLayerMetadata )
99 {
100 setMetadata( mDataProvider->layerMetadata() );
101 }
102 else
103 {
105 }
106 resultFlag = true;
107 return QString();
108}
109
116
123
130
132{
134
135 return mRenderer.get();
136}
137
139{
141
142 if ( renderer == mRenderer.get() )
143 return;
144
145 mRenderer.reset( renderer );
146 emit rendererChanged();
148}
149
156
158{
160
161 return mDataProvider.get();
162}
163
164bool QgsTiledSceneLayer::readXml( const QDomNode &layerNode, QgsReadWriteContext &context )
165{
167
168 // create provider
169 const QDomNode pkeyNode = layerNode.namedItem( QStringLiteral( "provider" ) );
170 mProviderKey = pkeyNode.toElement().text();
171
173 {
174 const QgsDataProvider::ProviderOptions providerOptions { context.transformContext() };
175 QgsDataProvider::ReadFlags flags = providerReadFlags( layerNode, mReadFlags );
176 // read extent
178 {
179 const QDomNode extentNode = layerNode.namedItem( QStringLiteral( "extent" ) );
180 if ( !extentNode.isNull() )
181 {
182 // get the extent
183 const QgsRectangle mbr = QgsXmlUtils::readRectangle( extentNode.toElement() );
184
185 // store the extent
186 setExtent( mbr );
187 }
188 }
189
191 }
192
193 QString errorMsg;
194 if ( !readSymbology( layerNode, errorMsg, context ) )
195 return false;
196
197 readStyleManager( layerNode );
198
199 return isValid();
200}
201
202bool QgsTiledSceneLayer::writeXml( QDomNode &layerNode, QDomDocument &doc, const QgsReadWriteContext &context ) const
203{
205
206 QDomElement mapLayerNode = layerNode.toElement();
207 mapLayerNode.setAttribute( QStringLiteral( "type" ), QgsMapLayerFactory::typeToString( Qgis::LayerType::TiledScene ) );
208
209 {
210 QDomElement provider = doc.createElement( QStringLiteral( "provider" ) );
211 const QDomText providerText = doc.createTextNode( providerType() );
212 provider.appendChild( providerText );
213 layerNode.appendChild( provider );
214 }
215
216 writeStyleManager( layerNode, doc );
217
218 QString errorMsg;
219 return writeSymbology( layerNode, doc, errorMsg, context );
220}
221
222bool QgsTiledSceneLayer::readSymbology( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
223{
225
226 const QDomElement elem = node.toElement();
227
228 readCommonStyle( elem, context, categories );
229
230 readStyle( node, errorMessage, context, categories );
231
232 if ( categories.testFlag( CustomProperties ) )
233 readCustomProperties( node, QStringLiteral( "variable" ) );
234
235 return true;
236}
237
238bool QgsTiledSceneLayer::readStyle( const QDomNode &node, QString &, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
239{
241
242 bool result = true;
243
244 if ( categories.testFlag( Symbology ) )
245 {
246 // get and set the blend mode if it exists
247 const QDomNode blendModeNode = node.namedItem( QStringLiteral( "blendMode" ) );
248 if ( !blendModeNode.isNull() )
249 {
250 const QDomElement e = blendModeNode.toElement();
251 setBlendMode( QgsPainting::getCompositionMode( static_cast< Qgis::BlendMode >( e.text().toInt() ) ) );
252 }
253
254 QDomElement rendererElement = node.firstChildElement( QStringLiteral( "renderer" ) );
255 if ( !rendererElement.isNull() )
256 {
257 std::unique_ptr< QgsTiledSceneRenderer > r( QgsTiledSceneRenderer::load( rendererElement, context ) );
258 if ( r )
259 {
260 setRenderer( r.release() );
261 }
262 else
263 {
264 result = false;
265 }
266 }
267 // make sure layer has a renderer - if none exists, fallback to a default renderer
268 if ( !mRenderer )
269 {
271 }
272 }
273
274 // get and set the layer transparency and scale visibility if they exists
275 if ( categories.testFlag( Rendering ) )
276 {
277 const QDomNode layerOpacityNode = node.namedItem( QStringLiteral( "layerOpacity" ) );
278 if ( !layerOpacityNode.isNull() )
279 {
280 const QDomElement e = layerOpacityNode.toElement();
281 setOpacity( e.text().toDouble() );
282 }
283
284 const bool hasScaleBasedVisibiliy { node.attributes().namedItem( QStringLiteral( "hasScaleBasedVisibilityFlag" ) ).nodeValue() == '1' };
285 setScaleBasedVisibility( hasScaleBasedVisibiliy );
286 bool ok;
287 const double maxScale { node.attributes().namedItem( QStringLiteral( "maxScale" ) ).nodeValue().toDouble( &ok ) };
288 if ( ok )
289 {
290 setMaximumScale( maxScale );
291 }
292 const double minScale { node.attributes().namedItem( QStringLiteral( "minScale" ) ).nodeValue().toDouble( &ok ) };
293 if ( ok )
294 {
295 setMinimumScale( minScale );
296 }
297 }
298 return result;
299}
300
301bool QgsTiledSceneLayer::writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
302 const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
303{
305
306 Q_UNUSED( errorMessage )
307
308 QDomElement elem = node.toElement();
309 writeCommonStyle( elem, doc, context, categories );
310
311 ( void )writeStyle( node, doc, errorMessage, context, categories );
312
313 return true;
314}
315
316bool QgsTiledSceneLayer::writeStyle( QDomNode &node, QDomDocument &doc, QString &, const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
317{
319
320 QDomElement mapLayerNode = node.toElement();
321
322 //save custom properties
323 if ( categories.testFlag( CustomProperties ) )
324 {
325 writeCustomProperties( node, doc );
326 }
327
328 if ( categories.testFlag( Symbology ) )
329 {
330 // add the blend mode field
331 QDomElement blendModeElem = doc.createElement( QStringLiteral( "blendMode" ) );
332 const QDomText blendModeText = doc.createTextNode( QString::number( static_cast< int >( QgsPainting::getBlendModeEnum( blendMode() ) ) ) );
333 blendModeElem.appendChild( blendModeText );
334 node.appendChild( blendModeElem );
335
336 if ( mRenderer )
337 {
338 const QDomElement rendererElement = mRenderer->save( doc, context );
339 node.appendChild( rendererElement );
340 }
341 }
342
343 // add the layer opacity and scale visibility
344 if ( categories.testFlag( Rendering ) )
345 {
346 QDomElement layerOpacityElem = doc.createElement( QStringLiteral( "layerOpacity" ) );
347 const QDomText layerOpacityText = doc.createTextNode( QString::number( opacity() ) );
348 layerOpacityElem.appendChild( layerOpacityText );
349 node.appendChild( layerOpacityElem );
350
351 mapLayerNode.setAttribute( QStringLiteral( "hasScaleBasedVisibilityFlag" ), hasScaleBasedVisibility() ? 1 : 0 );
352 mapLayerNode.setAttribute( QStringLiteral( "maxScale" ), maximumScale() );
353 mapLayerNode.setAttribute( QStringLiteral( "minScale" ), minimumScale() );
354 }
355 return true;
356}
357
359{
361
362 if ( mDataProvider )
363 mDataProvider->setTransformContext( transformContext );
365}
366
367void QgsTiledSceneLayer::setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider,
368 const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags )
369{
371
372 setName( baseName );
373 mProviderKey = provider;
374 mDataSource = dataSource;
375
376 if ( mPreloadedProvider )
377 {
378 mDataProvider.reset( qobject_cast< QgsTiledSceneDataProvider * >( mPreloadedProvider.release() ) );
379 }
380 else
381 {
382 std::unique_ptr< QgsScopedRuntimeProfile > profile;
383 if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
384 profile = std::make_unique< QgsScopedRuntimeProfile >( tr( "Create %1 provider" ).arg( provider ), QStringLiteral( "projectload" ) );
385 mDataProvider.reset( qobject_cast<QgsTiledSceneDataProvider *>( QgsProviderRegistry::instance()->createProvider( provider, dataSource, options, flags ) ) );
386 }
387
388 if ( !mDataProvider )
389 {
390 QgsDebugError( QStringLiteral( "Unable to get tiled scene data provider" ) );
391 setValid( false );
392 return;
393 }
394
395 mDataProvider->setParent( this );
396 QgsDebugMsgLevel( QStringLiteral( "Instantiated the tiled scene data provider plugin" ), 2 );
397
398 setValid( mDataProvider->isValid() );
399 if ( !isValid() )
400 {
401 QgsDebugError( QStringLiteral( "Invalid tiled scene provider plugin %1" ).arg( QString( mDataSource.toUtf8() ) ) );
402 setError( mDataProvider->error() );
403 return;
404 }
405
406 // Load initial extent, crs and renderer
407 setCrs( mDataProvider->crs() );
409 {
410 setExtent( mDataProvider->extent() );
411 }
412
413 bool loadDefaultStyleFlag = false;
415 {
416 loadDefaultStyleFlag = true;
417 }
418
419 if ( !mRenderer || loadDefaultStyleFlag )
420 {
421 std::unique_ptr< QgsScopedRuntimeProfile > profile;
422 if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
423 profile = std::make_unique< QgsScopedRuntimeProfile >( tr( "Load layer style" ), QStringLiteral( "projectload" ) );
424
425 bool defaultLoadedFlag = false;
426
427 if ( !defaultLoadedFlag && loadDefaultStyleFlag )
428 {
429 loadDefaultStyle( defaultLoadedFlag );
430 }
431
432 if ( !defaultLoadedFlag )
433 {
434 // all else failed, create default renderer
436 }
437 }
438}
439
440QString QgsTiledSceneLayer::encodedSource( const QString &source, const QgsReadWriteContext &context ) const
441{
443
445}
446
447QString QgsTiledSceneLayer::decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const
448{
450
452}
453
454QString QgsTiledSceneLayer::loadDefaultStyle( bool &resultFlag )
455{
457
458 return QgsMapLayer::loadDefaultStyle( resultFlag );
459}
460
462{
464
465 const QgsLayerMetadataFormatter htmlFormatter( metadata() );
466 QString myMetadata = QStringLiteral( "<html>\n<body>\n" );
467
468 myMetadata += generalHtmlMetadata();
469
470 // Begin Provider section
471 myMetadata += QStringLiteral( "<h1>" ) + tr( "Information from provider" ) + QStringLiteral( "</h1>\n<hr>\n" );
472 myMetadata += QLatin1String( "<table class=\"list-view\">\n" );
473
474 if ( mDataProvider )
475 myMetadata += mDataProvider->htmlMetadata();
476
477 // Extent
478 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Extent" ) + QStringLiteral( "</td><td>" ) + extent().toString() + QStringLiteral( "</td></tr>\n" );
479
480 myMetadata += QLatin1String( "</table>\n<br><br>" );
481
482 // CRS
483 myMetadata += crsHtmlMetadata();
484
485 // identification section
486 myMetadata += QStringLiteral( "<h1>" ) + tr( "Identification" ) + QStringLiteral( "</h1>\n<hr>\n" );
487 myMetadata += htmlFormatter.identificationSectionHtml( );
488 myMetadata += QLatin1String( "<br><br>\n" );
489
490 // extent section
491 myMetadata += QStringLiteral( "<h1>" ) + tr( "Extent" ) + QStringLiteral( "</h1>\n<hr>\n" );
492 myMetadata += htmlFormatter.extentSectionHtml( isSpatial() );
493 myMetadata += QLatin1String( "<br><br>\n" );
494
495 // Start the Access section
496 myMetadata += QStringLiteral( "<h1>" ) + tr( "Access" ) + QStringLiteral( "</h1>\n<hr>\n" );
497 myMetadata += htmlFormatter.accessSectionHtml( );
498 myMetadata += QLatin1String( "<br><br>\n" );
499
500 // Start the contacts section
501 myMetadata += QStringLiteral( "<h1>" ) + tr( "Contacts" ) + QStringLiteral( "</h1>\n<hr>\n" );
502 myMetadata += htmlFormatter.contactsSectionHtml( );
503 myMetadata += QLatin1String( "<br><br>\n" );
504
505 // Start the links section
506 myMetadata += QStringLiteral( "<h1>" ) + tr( "Links" ) + QStringLiteral( "</h1>\n<hr>\n" );
507 myMetadata += htmlFormatter.linksSectionHtml( );
508 myMetadata += QLatin1String( "<br><br>\n" );
509
510 // Start the history section
511 myMetadata += QStringLiteral( "<h1>" ) + tr( "History" ) + QStringLiteral( "</h1>\n<hr>\n" );
512 myMetadata += htmlFormatter.historySectionHtml( );
513 myMetadata += QLatin1String( "<br><br>\n" );
514
515 myMetadata += QLatin1String( "\n</body>\n</html>\n" );
516 return myMetadata;
517}
518
519bool QgsTiledSceneLayer::isReadOnly() const
520{
521 return true;
522}
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:3413
@ ReadLayerMetadata
Provider can read layer metadata from data store. See QgsDataProvider::layerMetadata()
@ TiledScene
Tiled scene layer. Added in QGIS 3.34.
static QgsRuntimeProfiler * profiler()
Returns the application runtime profiler.
Contains information about the context in which a coordinate transform is executed.
@ FlagLoadDefaultStyle
Reset the layer's style to the default for the datasource.
@ SkipGetExtent
Skip the extent from provider.
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:74
QString name
Definition qgsmaplayer.h:77
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.
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...
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:79
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.
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.
void setDataSource(const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag=false)
Updates the data source of the layer.
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:83
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 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 QgsDataProvider::ReadFlags providerReadFlags(const QDomNode &layerNode, QgsMapLayer::ReadFlags layerReadFlags)
Returns provider read flag deduced from layer read flags layerReadFlags and a dom node layerNode that...
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.
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.