QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgspointcloudlayer.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgspointcloudlayer.cpp
3 --------------------
4 begin : October 2020
5 copyright : (C) 2020 by Peter Petrik
6 email : zilolv 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 "qgspointcloudlayer.h"
19#include "moc_qgspointcloudlayer.cpp"
21#include "qgspointcloudindex.h"
24#include "qgsrectangle.h"
26#include "qgsproviderregistry.h"
27#include "qgslogger.h"
30#include "qgsruntimeprofiler.h"
31#include "qgsapplication.h"
32#include "qgspainting.h"
35#include "qgsmaplayerlegend.h"
36#include "qgsxmlutils.h"
37#include "qgsmaplayerfactory.h"
40#include "qgsmessagelog.h"
41#include "qgstaskmanager.h"
42#include "qgsthreadingutils.h"
44#ifdef HAVE_COPC
46#endif
47
48#include <QUrl>
49
51 const QString &baseName,
52 const QString &providerLib,
54 : QgsMapLayer( Qgis::LayerType::PointCloud, baseName, uri )
55 , mElevationProperties( new QgsPointCloudLayerElevationProperties( this ) )
56 , mLayerOptions( options )
57{
58 if ( !uri.isEmpty() && !providerLib.isEmpty() )
59 {
60 const QgsDataProvider::ProviderOptions providerOptions { options.transformContext };
61 Qgis::DataProviderReadFlags providerFlags;
62 if ( options.loadDefaultStyle )
63 {
65 }
66 setDataSource( uri, baseName, providerLib, providerOptions, providerFlags );
67 }
68
71}
72
74{
75 if ( QgsTask *task = QgsApplication::taskManager()->task( mStatsCalculationTask ) )
76 {
77 mStatsCalculationTask = 0;
78 task->cancel();
79 task->waitForFinished();
80 }
81}
82
84{
86
87 QgsPointCloudLayer *layer = new QgsPointCloudLayer( source(), name(), mProviderKey, mLayerOptions );
88 QgsMapLayer::clone( layer );
89
90 if ( mRenderer )
91 layer->setRenderer( mRenderer->clone() );
92
93 layer->mElevationProperties = mElevationProperties->clone();
94 layer->mElevationProperties->setParent( layer );
95
96 layer->mLayerOptions = mLayerOptions;
97 layer->mSync3DRendererTo2DRenderer = mSync3DRendererTo2DRenderer;
98
99 return layer;
100}
101
103{
105
106 if ( !mDataProvider )
107 return QgsRectangle();
108
109 return mDataProvider->extent();
110}
111
113{
115
116 if ( mRenderer->type() != QLatin1String( "extent" ) )
117 loadIndexesForRenderContext( rendererContext );
118
119 return new QgsPointCloudLayerRenderer( this, rendererContext );
120}
121
128
130{
131 // BAD! 2D rendering of point clouds is NOT thread safe
133
134 return mDataProvider.get();
135}
136
138{
140
141 return mDataProvider.get();
142}
143
144bool QgsPointCloudLayer::readXml( const QDomNode &layerNode, QgsReadWriteContext &context )
145{
147
148 // create provider
149 const QDomNode pkeyNode = layerNode.namedItem( QStringLiteral( "provider" ) );
150 mProviderKey = pkeyNode.toElement().text();
151
153 {
154 const QgsDataProvider::ProviderOptions providerOptions { context.transformContext() };
156 // read extent
158 {
159 const QDomNode extentNode = layerNode.namedItem( QStringLiteral( "extent" ) );
160 if ( !extentNode.isNull() )
161 {
162 // get the extent
163 const QgsRectangle mbr = QgsXmlUtils::readRectangle( extentNode.toElement() );
164
165 // store the extent
166 setExtent( mbr );
167 }
168 }
169
171 const QDomNode subset = layerNode.namedItem( QStringLiteral( "subset" ) );
172 const QString subsetText = subset.toElement().text();
173 if ( !subsetText.isEmpty() )
174 setSubsetString( subsetText );
175 }
176
177 if ( !isValid() )
178 {
179 return false;
180 }
181
182 QString errorMsg;
183 if ( !readSymbology( layerNode, errorMsg, context ) )
184 return false;
185
186 readStyleManager( layerNode );
187 return true;
188}
189
190bool QgsPointCloudLayer::writeXml( QDomNode &layerNode, QDomDocument &doc, const QgsReadWriteContext &context ) const
191{
193
194 QDomElement mapLayerNode = layerNode.toElement();
195 mapLayerNode.setAttribute( QStringLiteral( "type" ), QgsMapLayerFactory::typeToString( Qgis::LayerType::PointCloud ) );
196
197 if ( !subsetString().isEmpty() )
198 {
199 QDomElement subset = doc.createElement( QStringLiteral( "subset" ) );
200 const QDomText subsetText = doc.createTextNode( subsetString() );
201 subset.appendChild( subsetText );
202 layerNode.appendChild( subset );
203 }
204 if ( mDataProvider )
205 {
206 QDomElement provider = doc.createElement( QStringLiteral( "provider" ) );
207 const QDomText providerText = doc.createTextNode( providerType() );
208 provider.appendChild( providerText );
209 layerNode.appendChild( provider );
210 }
211
212 writeStyleManager( layerNode, doc );
213
214 QString errorMsg;
215 return writeSymbology( layerNode, doc, errorMsg, context );
216}
217
218bool QgsPointCloudLayer::readSymbology( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
219{
221
222 const QDomElement elem = node.toElement();
223
224 readCommonStyle( elem, context, categories );
225
226 readStyle( node, errorMessage, context, categories );
227
228 if ( categories.testFlag( CustomProperties ) )
229 readCustomProperties( node, QStringLiteral( "variable" ) );
230
231 return true;
232}
233
234bool QgsPointCloudLayer::readStyle( const QDomNode &node, QString &, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
235{
237
238 bool result = true;
239
240 if ( categories.testFlag( Symbology3D ) )
241 {
242 bool ok;
243 bool sync = node.attributes().namedItem( QStringLiteral( "sync3DRendererTo2DRenderer" ) ).nodeValue().toInt( &ok );
244 if ( ok )
246 }
247
248 if ( categories.testFlag( Symbology ) )
249 {
250 QDomElement rendererElement = node.firstChildElement( QStringLiteral( "renderer" ) );
251 if ( !rendererElement.isNull() )
252 {
253 std::unique_ptr< QgsPointCloudRenderer > r( QgsPointCloudRenderer::load( rendererElement, context ) );
254 if ( r )
255 {
256 setRenderer( r.release() );
257 }
258 else
259 {
260 result = false;
261 }
262 }
263 // make sure layer has a renderer - if none exists, fallback to a default renderer
264 if ( !mRenderer )
265 {
267 }
268 }
269
270 if ( categories.testFlag( Symbology ) )
271 {
272 // get and set the blend mode if it exists
273 const QDomNode blendModeNode = node.namedItem( QStringLiteral( "blendMode" ) );
274 if ( !blendModeNode.isNull() )
275 {
276 const QDomElement e = blendModeNode.toElement();
277 setBlendMode( QgsPainting::getCompositionMode( static_cast< Qgis::BlendMode >( e.text().toInt() ) ) );
278 }
279 }
280
281 // get and set the layer transparency and scale visibility if they exists
282 if ( categories.testFlag( Rendering ) )
283 {
284 const QDomNode layerOpacityNode = node.namedItem( QStringLiteral( "layerOpacity" ) );
285 if ( !layerOpacityNode.isNull() )
286 {
287 const QDomElement e = layerOpacityNode.toElement();
288 setOpacity( e.text().toDouble() );
289 }
290
291 const bool hasScaleBasedVisibiliy { node.attributes().namedItem( QStringLiteral( "hasScaleBasedVisibilityFlag" ) ).nodeValue() == '1' };
292 setScaleBasedVisibility( hasScaleBasedVisibiliy );
293 bool ok;
294 const double maxScale { node.attributes().namedItem( QStringLiteral( "maxScale" ) ).nodeValue().toDouble( &ok ) };
295 if ( ok )
296 {
297 setMaximumScale( maxScale );
298 }
299 const double minScale { node.attributes().namedItem( QStringLiteral( "minScale" ) ).nodeValue().toDouble( &ok ) };
300 if ( ok )
301 {
302 setMinimumScale( minScale );
303 }
304 }
305 return result;
306}
307
308bool QgsPointCloudLayer::writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
309 const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
310{
312
313 Q_UNUSED( errorMessage )
314
315 QDomElement elem = node.toElement();
316 writeCommonStyle( elem, doc, context, categories );
317
318 ( void )writeStyle( node, doc, errorMessage, context, categories );
319
320 return true;
321}
322
323bool QgsPointCloudLayer::writeStyle( QDomNode &node, QDomDocument &doc, QString &, const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
324{
326
327 QDomElement mapLayerNode = node.toElement();
328
329 if ( categories.testFlag( Symbology3D ) )
330 {
331 mapLayerNode.setAttribute( QStringLiteral( "sync3DRendererTo2DRenderer" ), mSync3DRendererTo2DRenderer ? 1 : 0 );
332 }
333
334 if ( categories.testFlag( Symbology ) )
335 {
336 if ( mRenderer )
337 {
338 const QDomElement rendererElement = mRenderer->save( doc, context );
339 node.appendChild( rendererElement );
340 }
341 }
342
343 //save customproperties
344 if ( categories.testFlag( CustomProperties ) )
345 {
346 writeCustomProperties( node, doc );
347 }
348
349 if ( categories.testFlag( Symbology ) )
350 {
351 // add the blend mode field
352 QDomElement blendModeElem = doc.createElement( QStringLiteral( "blendMode" ) );
353 const QDomText blendModeText = doc.createTextNode( QString::number( static_cast< int >( QgsPainting::getBlendModeEnum( blendMode() ) ) ) );
354 blendModeElem.appendChild( blendModeText );
355 node.appendChild( blendModeElem );
356 }
357
358 // add the layer opacity and scale visibility
359 if ( categories.testFlag( Rendering ) )
360 {
361 QDomElement layerOpacityElem = doc.createElement( QStringLiteral( "layerOpacity" ) );
362 const QDomText layerOpacityText = doc.createTextNode( QString::number( opacity() ) );
363 layerOpacityElem.appendChild( layerOpacityText );
364 node.appendChild( layerOpacityElem );
365
366 mapLayerNode.setAttribute( QStringLiteral( "hasScaleBasedVisibilityFlag" ), hasScaleBasedVisibility() ? 1 : 0 );
367 mapLayerNode.setAttribute( QStringLiteral( "maxScale" ), maximumScale() );
368 mapLayerNode.setAttribute( QStringLiteral( "minScale" ), minimumScale() );
369 }
370 return true;
371}
372
374{
376
377 if ( mDataProvider )
378 mDataProvider->setTransformContext( transformContext );
380}
381
382void QgsPointCloudLayer::setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider,
384{
386
387 if ( mDataProvider )
388 {
389 disconnect( mDataProvider.get(), &QgsPointCloudDataProvider::dataChanged, this, &QgsPointCloudLayer::dataChanged );
390 disconnect( mDataProvider.get(), &QgsPointCloudDataProvider::indexGenerationStateChanged, this, &QgsPointCloudLayer::onPointCloudIndexGenerationStateChanged );
391 }
392
393 setName( baseName );
394 mProviderKey = provider;
395 mDataSource = dataSource;
396
397 if ( mPreloadedProvider )
398 {
399 mDataProvider.reset( qobject_cast< QgsPointCloudDataProvider * >( mPreloadedProvider.release() ) );
400 }
401 else
402 {
403 std::unique_ptr< QgsScopedRuntimeProfile > profile;
404 if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
405 profile = std::make_unique< QgsScopedRuntimeProfile >( tr( "Create %1 provider" ).arg( provider ), QStringLiteral( "projectload" ) );
406 mDataProvider.reset( qobject_cast<QgsPointCloudDataProvider *>( QgsProviderRegistry::instance()->createProvider( provider, dataSource, options, flags ) ) );
407 }
408
409 if ( !mDataProvider )
410 {
411 QgsDebugError( QStringLiteral( "Unable to get point cloud data provider" ) );
412 setValid( false );
413 return;
414 }
415
416 mDataProvider->setParent( this );
417 QgsDebugMsgLevel( QStringLiteral( "Instantiated the point cloud data provider plugin" ), 2 );
418
419 setValid( mDataProvider->isValid() );
420 if ( !isValid() )
421 {
422 QgsDebugError( QStringLiteral( "Invalid point cloud provider plugin %1" ).arg( QString( mDataSource.toUtf8() ) ) );
423 setError( mDataProvider->error() );
424 return;
425 }
426
427 connect( mDataProvider.get(), &QgsPointCloudDataProvider::indexGenerationStateChanged, this, &QgsPointCloudLayer::onPointCloudIndexGenerationStateChanged );
428 connect( mDataProvider.get(), &QgsPointCloudDataProvider::dataChanged, this, &QgsPointCloudLayer::dataChanged );
429
430 // Load initial extent, crs and renderer
431 setCrs( mDataProvider->crs() );
433 {
434 setExtent3D( mDataProvider->extent3D() );
435 }
436
437 bool loadDefaultStyleFlag = false;
439 {
440 loadDefaultStyleFlag = true;
441 }
442
443 if ( !mLayerOptions.skipIndexGeneration &&
444 mDataProvider &&
446 mDataProvider->pointCount() > 0 )
447 {
448 mDataProvider->generateIndex();
449 }
450
451 if ( !mLayerOptions.skipStatisticsCalculation &&
452 mDataProvider &&
454 mDataProvider->pointCount() > 0 )
455 {
456 calculateStatistics();
457 }
458
459 if ( !mRenderer || loadDefaultStyleFlag )
460 {
461 std::unique_ptr< QgsScopedRuntimeProfile > profile;
462 if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
463 profile = std::make_unique< QgsScopedRuntimeProfile >( tr( "Load layer style" ), QStringLiteral( "projectload" ) );
464
465 bool defaultLoadedFlag = false;
466
467 if ( loadDefaultStyleFlag && isSpatial() && mDataProvider->capabilities() & QgsPointCloudDataProvider::CreateRenderer )
468 {
469 // first try to create a renderer directly from the data provider
470 std::unique_ptr< QgsPointCloudRenderer > defaultRenderer( mDataProvider->createRenderer() );
471 if ( defaultRenderer )
472 {
473 defaultLoadedFlag = true;
474 setRenderer( defaultRenderer.release() );
475 }
476 }
477
478 if ( !defaultLoadedFlag && loadDefaultStyleFlag )
479 {
480 loadDefaultStyle( defaultLoadedFlag );
481 }
482
483 if ( !defaultLoadedFlag )
484 {
485 // all else failed, create default renderer
487 }
488 }
489}
490
491QString QgsPointCloudLayer::encodedSource( const QString &source, const QgsReadWriteContext &context ) const
492{
494
496}
497
498QString QgsPointCloudLayer::decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const
499{
501
503}
504
505void QgsPointCloudLayer::onPointCloudIndexGenerationStateChanged( QgsPointCloudDataProvider::PointCloudIndexGenerationState state )
506{
508
509 switch ( state )
510 {
512 {
513 resetRenderer();
514 break;
515 }
517 {
518 QgsError providerError = mDataProvider->error();
519 if ( !providerError.isEmpty() )
520 {
521 setError( providerError );
522 emit raiseError( providerError.summary() );
523 }
524 break;
525 }
527 break;
528 }
529}
530
531
532QString QgsPointCloudLayer::loadDefaultStyle( bool &resultFlag )
533{
535
536 if ( mDataProvider->capabilities() & QgsPointCloudDataProvider::CreateRenderer )
537 {
538 // first try to create a renderer directly from the data provider
539 std::unique_ptr< QgsPointCloudRenderer > defaultRenderer( mDataProvider->createRenderer() );
540 if ( defaultRenderer )
541 {
542 resultFlag = true;
543 setRenderer( defaultRenderer.release() );
544 return QString();
545 }
546 }
547
548 return QgsMapLayer::loadDefaultStyle( resultFlag );
549}
550
552{
554
555 const QgsLayerMetadataFormatter htmlFormatter( metadata() );
556 QString myMetadata = QStringLiteral( "<html>\n<body>\n" );
557
558 myMetadata += generalHtmlMetadata();
559
560 // Begin Provider section
561 myMetadata += QStringLiteral( "<h1>" ) + tr( "Information from provider" ) + QStringLiteral( "</h1>\n<hr>\n" );
562 myMetadata += QLatin1String( "<table class=\"list-view\">\n" );
563
564 // Extent
565 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Extent" ) + QStringLiteral( "</td><td>" ) + extent().toString() + QStringLiteral( "</td></tr>\n" );
566
567 // feature count
568 QLocale locale = QLocale();
569 locale.setNumberOptions( locale.numberOptions() &= ~QLocale::NumberOption::OmitGroupSeparator );
570 const qint64 pointCount = mDataProvider ? mDataProvider->pointCount() : -1;
571 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
572 + tr( "Point count" ) + QStringLiteral( "</td><td>" )
573 + ( pointCount < 0 ? tr( "unknown" ) : locale.toString( static_cast<qlonglong>( pointCount ) ) )
574 + QStringLiteral( "</td></tr>\n" );
575
576 if ( const QgsPointCloudDataProvider *provider = dataProvider() )
577 {
578 myMetadata += provider->htmlMetadata();
579 }
580
581 myMetadata += QLatin1String( "</table>\n<br><br>" );
582
583 // CRS
584 myMetadata += crsHtmlMetadata();
585
586 // provider metadata section
587 myMetadata += QStringLiteral( "<h1>" ) + tr( "Metadata" ) + QStringLiteral( "</h1>\n<hr>\n" ) + QStringLiteral( "<table class=\"list-view\">\n" );
588 const QVariantMap originalMetadata = mDataProvider ? mDataProvider->originalMetadata() : QVariantMap();
589
590 if ( originalMetadata.value( QStringLiteral( "creation_year" ) ).toInt() > 0 && originalMetadata.contains( QStringLiteral( "creation_doy" ) ) )
591 {
592 QDate creationDate( originalMetadata.value( QStringLiteral( "creation_year" ) ).toInt(), 1, 1 );
593 creationDate = creationDate.addDays( originalMetadata.value( QStringLiteral( "creation_doy" ) ).toInt() );
594
595 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
596 + tr( "Creation date" ) + QStringLiteral( "</td><td>" )
597 + creationDate.toString( Qt::ISODate )
598 + QStringLiteral( "</td></tr>\n" );
599 }
600 if ( originalMetadata.contains( QStringLiteral( "major_version" ) ) && originalMetadata.contains( QStringLiteral( "minor_version" ) ) )
601 {
602 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
603 + tr( "Version" ) + QStringLiteral( "</td><td>" )
604 + QStringLiteral( "%1.%2" ).arg( originalMetadata.value( QStringLiteral( "major_version" ) ).toString(),
605 originalMetadata.value( QStringLiteral( "minor_version" ) ).toString() )
606 + QStringLiteral( "</td></tr>\n" );
607 }
608
609 if ( !originalMetadata.value( QStringLiteral( "dataformat_id" ) ).toString().isEmpty() )
610 {
611 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
612 + tr( "Data format" ) + QStringLiteral( "</td><td>" )
613 + QStringLiteral( "%1 (%2)" ).arg( QgsPointCloudDataProvider::translatedDataFormatIds().value( originalMetadata.value( QStringLiteral( "dataformat_id" ) ).toInt() ),
614 originalMetadata.value( QStringLiteral( "dataformat_id" ) ).toString() ).trimmed()
615 + QStringLiteral( "</td></tr>\n" );
616 }
617
618 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
619 + tr( "Scale X" ) + QStringLiteral( "</td><td>" )
620 + QString::number( originalMetadata.value( QStringLiteral( "scale_x" ) ).toDouble() )
621 + QStringLiteral( "</td></tr>\n" );
622 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
623 + tr( "Scale Y" ) + QStringLiteral( "</td><td>" )
624 + QString::number( originalMetadata.value( QStringLiteral( "scale_y" ) ).toDouble() )
625 + QStringLiteral( "</td></tr>\n" );
626 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
627 + tr( "Scale Z" ) + QStringLiteral( "</td><td>" )
628 + QString::number( originalMetadata.value( QStringLiteral( "scale_z" ) ).toDouble() )
629 + QStringLiteral( "</td></tr>\n" );
630
631 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
632 + tr( "Offset X" ) + QStringLiteral( "</td><td>" )
633 + QString::number( originalMetadata.value( QStringLiteral( "offset_x" ) ).toDouble() )
634 + QStringLiteral( "</td></tr>\n" );
635 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
636 + tr( "Offset Y" ) + QStringLiteral( "</td><td>" )
637 + QString::number( originalMetadata.value( QStringLiteral( "offset_y" ) ).toDouble() )
638 + QStringLiteral( "</td></tr>\n" );
639 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
640 + tr( "Offset Z" ) + QStringLiteral( "</td><td>" )
641 + QString::number( originalMetadata.value( QStringLiteral( "offset_z" ) ).toDouble() )
642 + QStringLiteral( "</td></tr>\n" );
643
644 if ( !originalMetadata.value( QStringLiteral( "project_id" ) ).toString().isEmpty() )
645 {
646 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
647 + tr( "Project ID" ) + QStringLiteral( "</td><td>" )
648 + originalMetadata.value( QStringLiteral( "project_id" ) ).toString()
649 + QStringLiteral( "</td></tr>\n" );
650 }
651
652 if ( !originalMetadata.value( QStringLiteral( "system_id" ) ).toString().isEmpty() )
653 {
654 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
655 + tr( "System ID" ) + QStringLiteral( "</td><td>" )
656 + originalMetadata.value( QStringLiteral( "system_id" ) ).toString()
657 + QStringLiteral( "</td></tr>\n" );
658 }
659
660 if ( !originalMetadata.value( QStringLiteral( "software_id" ) ).toString().isEmpty() )
661 {
662 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
663 + tr( "Software ID" ) + QStringLiteral( "</td><td>" )
664 + originalMetadata.value( QStringLiteral( "software_id" ) ).toString()
665 + QStringLiteral( "</td></tr>\n" );
666 }
667
668 // End Provider section
669 myMetadata += QLatin1String( "</table>\n<br><br>" );
670
671 // identification section
672 myMetadata += QStringLiteral( "<h1>" ) + tr( "Identification" ) + QStringLiteral( "</h1>\n<hr>\n" );
673 myMetadata += htmlFormatter.identificationSectionHtml( );
674 myMetadata += QLatin1String( "<br><br>\n" );
675
676 // extent section
677 myMetadata += QStringLiteral( "<h1>" ) + tr( "Extent" ) + QStringLiteral( "</h1>\n<hr>\n" );
678 myMetadata += htmlFormatter.extentSectionHtml( isSpatial() );
679 myMetadata += QLatin1String( "<br><br>\n" );
680
681 // Start the Access section
682 myMetadata += QStringLiteral( "<h1>" ) + tr( "Access" ) + QStringLiteral( "</h1>\n<hr>\n" );
683 myMetadata += htmlFormatter.accessSectionHtml( );
684 myMetadata += QLatin1String( "<br><br>\n" );
685
686 // Attributes section
687 myMetadata += QStringLiteral( "<h1>" ) + tr( "Attributes" ) + QStringLiteral( "</h1>\n<hr>\n<table class=\"list-view\">\n" );
688
690
691 // count attributes
692 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Count" ) + QStringLiteral( "</td><td>" ) + QString::number( attrs.count() ) + QStringLiteral( "</td></tr>\n" );
693
694 myMetadata += QLatin1String( "</table>\n<br><table width=\"100%\" class=\"tabular-view\">\n" );
695 myMetadata += QLatin1String( "<tr><th>" ) + tr( "Attribute" ) + QLatin1String( "</th><th>" ) + tr( "Type" ) + QLatin1String( "</th></tr>\n" );
696
697 for ( int i = 0; i < attrs.count(); ++i )
698 {
699 const QgsPointCloudAttribute attribute = attrs.at( i );
700 QString rowClass;
701 if ( i % 2 )
702 rowClass = QStringLiteral( "class=\"odd-row\"" );
703 myMetadata += QLatin1String( "<tr " ) + rowClass + QLatin1String( "><td>" ) + attribute.name() + QLatin1String( "</td><td>" ) + attribute.displayType() + QLatin1String( "</td></tr>\n" );
704 }
705
706 //close field list
707 myMetadata += QLatin1String( "</table>\n<br><br>" );
708
709
710 // Start the contacts section
711 myMetadata += QStringLiteral( "<h1>" ) + tr( "Contacts" ) + QStringLiteral( "</h1>\n<hr>\n" );
712 myMetadata += htmlFormatter.contactsSectionHtml( );
713 myMetadata += QLatin1String( "<br><br>\n" );
714
715 // Start the links section
716 myMetadata += QStringLiteral( "<h1>" ) + tr( "Links" ) + QStringLiteral( "</h1>\n<hr>\n" );
717 myMetadata += htmlFormatter.linksSectionHtml( );
718 myMetadata += QLatin1String( "<br><br>\n" );
719
720 // Start the history section
721 myMetadata += QStringLiteral( "<h1>" ) + tr( "History" ) + QStringLiteral( "</h1>\n<hr>\n" );
722 myMetadata += htmlFormatter.historySectionHtml( );
723 myMetadata += QLatin1String( "<br><br>\n" );
724
725 myMetadata += customPropertyHtmlMetadata();
726
727 myMetadata += QLatin1String( "\n</body>\n</html>\n" );
728 return myMetadata;
729}
730
737
739{
741
742 return mDataProvider ? mDataProvider->attributes() : QgsPointCloudAttributeCollection();
743}
744
746{
748
749 return mDataProvider ? mDataProvider->pointCount() : 0;
750}
751
758
760{
762
763 return mRenderer.get();
764}
765
767{
769
770 if ( renderer == mRenderer.get() )
771 return;
772
773 mRenderer.reset( renderer );
774 emit rendererChanged();
776
777 if ( mSync3DRendererTo2DRenderer )
779}
780
781bool QgsPointCloudLayer::setSubsetString( const QString &subset )
782{
784
785 if ( !isValid() || !mDataProvider )
786 {
787 QgsDebugMsgLevel( QStringLiteral( "invoked with invalid layer or null mDataProvider" ), 3 );
788 setCustomProperty( QStringLiteral( "storedSubsetString" ), subset );
789 return false;
790 }
791 else if ( subset == mDataProvider->subsetString() )
792 return true;
793
794 bool res = mDataProvider->setSubsetString( subset );
795 if ( res )
796 {
797 emit subsetStringChanged();
799 }
800 return res;
801}
802
804{
806
807 if ( !isValid() || !mDataProvider )
808 {
809 QgsDebugMsgLevel( QStringLiteral( "invoked with invalid layer or null mDataProvider" ), 3 );
810 return customProperty( QStringLiteral( "storedSubsetString" ) ).toString();
811 }
812 return mDataProvider->subsetString();
813}
814
816{
818
819 bool result = false;
821 if ( r )
822 {
823 result = r->convertFrom2DRenderer( renderer() );
824 setRenderer3D( r );
826 }
827 return result;
828}
829
831{
833
834 return mSync3DRendererTo2DRenderer;
835}
836
838{
840
841 mSync3DRendererTo2DRenderer = sync;
842 if ( sync )
844}
845
846void QgsPointCloudLayer::calculateStatistics()
847{
849
850 if ( !mDataProvider.get() || !mDataProvider->hasValidIndex() )
851 {
852 QgsMessageLog::logMessage( QObject::tr( "Failed to calculate statistics of the point cloud %1" ).arg( this->name() ) );
853 return;
854 }
855 if ( mStatsCalculationTask )
856 {
857 QgsMessageLog::logMessage( QObject::tr( "A statistics calculation task for the point cloud %1 is already in progress" ).arg( this->name() ) );
858 return;
859 }
860
861 QgsPointCloudStatistics indexStats = mDataProvider->metadataStatistics();
862 QList<QString> indexStatsAttributes = indexStats.statisticsMap().keys();
863 QVector<QgsPointCloudAttribute> attributes = mDataProvider->attributes().attributes();
864 // Do not calculate stats for attributes that the index gives us stats for
865 for ( int i = 0; i < attributes.size(); ++i )
866 {
867 if ( indexStatsAttributes.contains( attributes[i].name() ) )
868 {
869 attributes.remove( i );
870 --i;
871 }
872 }
873
874 // Use the layer statistics for now, until we can calculate complete ones
875 mStatistics = indexStats;
876 if ( attributes.empty() && indexStats.sampledPointsCount() > 0 )
877 {
878 // All attributes are covered by the saved stats, skip calculating anything
880 emit statisticsCalculationStateChanged( mStatisticsCalculationState );
881 resetRenderer();
882 return;
883 }
884
885 QgsPointCloudStatsCalculationTask *task = new QgsPointCloudStatsCalculationTask( mDataProvider->index(), attributes, 1000000 );
886 connect( task, &QgsTask::taskCompleted, this, [this, task, indexStats, indexStatsAttributes]()
887 {
888 mStatistics = task->calculationResults();
889
890 // Fetch what we can directly from the index
891 QMap<QString, QgsPointCloudAttributeStatistics> statsMap = mStatistics.statisticsMap();
892 for ( const QString &attribute : indexStatsAttributes )
893 {
894 statsMap[ attribute ] = indexStats.statisticsOf( attribute );
895 }
896 mStatistics = QgsPointCloudStatistics( mStatistics.sampledPointsCount(), statsMap );
897
899 emit statisticsCalculationStateChanged( mStatisticsCalculationState );
900 resetRenderer();
901 mStatsCalculationTask = 0;
902#ifdef HAVE_COPC
903 if ( mDataProvider && mDataProvider->index() && mDataProvider->index()->isValid() && mDataProvider->name() == QLatin1String( "pdal" ) && mStatistics.sampledPointsCount() != 0 )
904 {
905 if ( QgsCopcPointCloudIndex *index = dynamic_cast<QgsCopcPointCloudIndex *>( mDataProvider->index() ) )
906 {
907 index->writeStatistics( mStatistics );
908 }
909 }
910#endif
911 } );
912
913 // In case the statistics calculation fails, QgsTask::taskTerminated will be called
914 connect( task, &QgsTask::taskTerminated, this, [this]()
915 {
916 if ( mStatsCalculationTask )
917 {
918 QgsMessageLog::logMessage( QObject::tr( "Failed to calculate statistics of the point cloud %1" ).arg( this->name() ) );
919 mStatsCalculationTask = 0;
920 }
921 } );
922
923 mStatsCalculationTask = QgsApplication::taskManager()->addTask( task );
924
926 emit statisticsCalculationStateChanged( mStatisticsCalculationState );
927}
928
929void QgsPointCloudLayer::resetRenderer()
930{
932
933 mDataProvider->loadIndex();
935 {
936 calculateStatistics();
937 }
938 if ( !mRenderer || mRenderer->type() == QLatin1String( "extent" ) )
939 {
941 }
943
944 emit rendererChanged();
945}
946
947void QgsPointCloudLayer::loadIndexesForRenderContext( QgsRenderContext &rendererContext ) const
948{
949 if ( mDataProvider->capabilities() & QgsPointCloudDataProvider::ContainSubIndexes )
950 {
951 QgsRectangle renderExtent;
952 try
953 {
954 renderExtent = rendererContext.coordinateTransform().transformBoundingBox( rendererContext.mapExtent(), Qgis::TransformDirection::Reverse );
955 }
956 catch ( QgsCsException & )
957 {
958 QgsDebugError( QStringLiteral( "Transformation of extent failed!" ) );
959 }
960
961 const QVector<QgsPointCloudSubIndex> subIndex = mDataProvider->subIndexes();
962 for ( int i = 0; i < subIndex.size(); ++i )
963 {
964 // no need to load as it's there
965 if ( subIndex.at( i ).index() )
966 continue;
967
968 if ( subIndex.at( i ).extent().intersects( renderExtent ) &&
969 renderExtent.width() < subIndex.at( i ).extent().width() )
970 {
971 mDataProvider->loadSubIndex( i );
972 }
973 }
974 }
975}
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:4657
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
Definition qgis.h:450
@ PointCloud
Point cloud layer. Added in QGIS 3.18.
@ LoadDefaultStyle
Reset the layer's style to the default for the datasource.
@ SkipGetExtent
Skip the extent from provider.
@ Reverse
Reverse/inverse transform (from destination to source)
Base class for point cloud 3D renderers.
virtual bool convertFrom2DRenderer(QgsPointCloudRenderer *renderer)=0
Updates the 3D renderer's symbol to match that of a given QgsPointCloudRenderer.
Abstract base class for objects which generate elevation profiles.
static QgsRuntimeProfiler * profiler()
Returns the application runtime profiler.
static QgsTaskManager * taskManager()
Returns the application's task manager, used for managing application wide background task handling.
Contains information about the context in which a coordinate transform is executed.
QgsRectangle transformBoundingBox(const QgsRectangle &rectangle, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool handle180Crossover=false) const
Transforms a rectangle from the source CRS to the destination CRS.
Custom exception class for Coordinate Reference System related exceptions.
void dataChanged()
Emitted whenever a change is made to the data provider which may have caused changes in the provider'...
A container for error messages.
Definition qgserror.h:81
bool isEmpty() const
Test if any error is set.
Definition qgserror.h:110
QString summary() const
Short error description, usually the first error in chain, the real error.
Definition qgserror.cpp:129
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.
static QgsMapLayerLegend * defaultPointCloudLegend(QgsPointCloudLayer *layer)
Create new legend implementation for a point cloud layer.
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...
QgsAbstract3DRenderer * renderer3D() const
Returns 3D renderer associated with the layer.
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.
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
QString providerType() const
Returns the provider type (provider key) for this layer.
virtual void setExtent3D(const QgsBox3D &box)
Sets the extent.
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
void configChanged()
Emitted whenever the configuration is changed.
void trigger3DUpdate()
Will advise any 3D maps that this layer requires to be updated in the scene.
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.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
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.
QFlags< StyleCategory > StyleCategories
Q_INVOKABLE void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for layer.
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.
void dataChanged()
Data of layer changed.
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.
@ 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
@ Symbology
Symbology.
@ Rendering
Rendering: scale visibility, simplify method, opacity.
@ Symbology3D
3D symbology
@ CustomProperties
Custom properties (by plugins for instance)
void setRenderer3D(QgsAbstract3DRenderer *renderer)
Sets 3D renderer for the layer.
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 void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
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.
Collection of point cloud attributes.
const QgsPointCloudAttribute & at(int index) const
Returns the attribute at the specified index.
int count() const
Returns the number of attributes present in the collection.
Attribute for point cloud data pair of name and size in bytes.
QString displayType() const
Returns the type to use when displaying this field.
QString name() const
Returns name of the attribute.
Base class for providing data for QgsPointCloudLayer.
@ CreateRenderer
Provider can create 2D renderers using backend-specific formatting information. See QgsPointCloudData...
@ ContainSubIndexes
Provider can contain multiple indexes. Virtual point cloud files for example.
static QMap< int, QString > translatedDataFormatIds()
Returns the map of LAS data format ID to translated string value.
void indexGenerationStateChanged(QgsPointCloudDataProvider::PointCloudIndexGenerationState state)
Emitted when point cloud generation state is changed.
PointCloudIndexGenerationState
Point cloud index state.
@ NotIndexed
Provider has no index available.
@ Indexing
Provider try to index the source data.
@ Indexed
The index is ready to be used.
Point cloud layer specific subclass of QgsMapLayerElevationProperties.
QgsPointCloudLayerElevationProperties * clone() const override
Creates a clone of the properties.
Implementation of QgsAbstractProfileGenerator for point cloud layers.
Implementation of threaded rendering for point cloud layers.
Represents a map layer supporting display of point clouds.
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...
QString htmlMetadata() const override
Obtain a formatted HTML string containing assorted metadata for this layer.
void setSync3DRendererTo2DRenderer(bool sync)
Sets whether this layer's 3D renderer should be automatically updated with changes applied to the lay...
QgsMapLayerElevationProperties * elevationProperties() override
Returns the layer's elevation properties.
@ Calculated
The statistics calculation task is done and statistics are available.
@ NotStarted
The statistics calculation task has not been started.
@ Calculating
The statistics calculation task is running.
bool sync3DRendererTo2DRenderer() const
Returns whether this layer's 3D renderer should be automatically updated with changes applied to the ...
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.
QgsRectangle extent() const override
Returns the extent of the layer.
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...
QgsPointCloudRenderer * renderer()
Returns the 2D renderer for the point cloud.
bool convertRenderer3DFromRenderer2D()
Updates the layer's 3D renderer's symbol to match that of the layer's 2D renderer.
qint64 pointCount() const
Returns the total number of points available in the layer.
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.
void raiseError(const QString &msg)
Signals an error related to this point cloud layer.
PointCloudStatisticsCalculationState statisticsCalculationState() const
Returns the status of point cloud statistics calculation.
QgsPointCloudDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
void statisticsCalculationStateChanged(QgsPointCloudLayer::PointCloudStatisticsCalculationState state)
Emitted when statistics calculation state has changed.
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.
bool readXml(const QDomNode &layerNode, QgsReadWriteContext &context) override
Called by readLayerXML(), used by children to read state specific to them from project files.
QString subsetString() const
Returns the string used to define a subset of the layer.
QgsPointCloudLayer(const QString &uri=QString(), const QString &baseName=QString(), const QString &providerLib=QStringLiteral("pointcloud"), const QgsPointCloudLayer::LayerOptions &options=QgsPointCloudLayer::LayerOptions())
Constructor - creates a point cloud layer.
bool setSubsetString(const QString &subset)
Sets the string used to define a subset of the layer.
QgsPointCloudLayer * clone() const override
Returns a new instance equivalent to this one except for the id which is still unique.
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.
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.
void setRenderer(QgsPointCloudRenderer *renderer)
Sets the 2D renderer for the point cloud.
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...
QgsPointCloudAttributeCollection attributes() const
Returns the attributes available from the layer.
void subsetStringChanged()
Emitted when the layer's subset string has changed.
void setTransformContext(const QgsCoordinateTransformContext &transformContext) override
Sets the coordinate transform context to transformContext.
QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext) override
Returns new instance of QgsMapLayerRenderer that will be used for rendering of given context.
QgsAbstractProfileGenerator * createProfileGenerator(const QgsProfileRequest &request) override
Given a profile request, returns a new profile generator ready for generating elevation profiles.
static QgsPointCloudRenderer * defaultRenderer(const QgsPointCloudLayer *layer)
Returns a new default point cloud renderer for a specified layer.
Abstract base class for 2d point cloud renderers.
static QgsPointCloudRenderer * load(QDomElement &element, const QgsReadWriteContext &context)
Creates a renderer from an XML element.
Class used to store statistics of a point cloud dataset.
int sampledPointsCount() const
Returns the number of points used to calculate the statistics.
QMap< QString, QgsPointCloudAttributeStatistics > statisticsMap() const
Returns a map object containing all the statistics.
QgsPointCloudAttributeStatistics statisticsOf(const QString &attribute) const
Returns the calculated statistics of attribute attribute.
Encapsulates properties and constraints relating to fetching elevation profiles from different source...
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.
QgsRectangle mapExtent() const
Returns the original extent of the map being rendered.
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
long addTask(QgsTask *task, int priority=0)
Adds a task to the manager.
Abstract base class for long running background tasks.
void taskCompleted()
Will be emitted by task to indicate its successful completion.
void taskTerminated()
Will be emitted by task if it has terminated for any reason other then completion (e....
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_NON_FATAL
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS
Setting options for creating vector data providers.
Setting options for loading point cloud layers.
bool skipStatisticsCalculation
Set to true if the statistics calculation for this point cloud is disabled.
bool loadDefaultStyle
Set to true if the default layer style should be loaded.
bool skipIndexGeneration
Set to true if point cloud index generation should be skipped.
QgsCoordinateTransformContext transformContext
Coordinate transform context.