QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
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"
20#include "qgspointcloudindex.h"
21#include "qgsrectangle.h"
23#include "qgsproviderregistry.h"
24#include "qgslogger.h"
27#include "qgsruntimeprofiler.h"
28#include "qgsapplication.h"
29#include "qgspainting.h"
32#include "qgsmaplayerlegend.h"
33#include "qgsxmlutils.h"
34#include "qgsmaplayerfactory.h"
37#include "qgsmessagelog.h"
38#include "qgstaskmanager.h"
39#include "qgsthreadingutils.h"
41#ifdef HAVE_COPC
43#endif
44
45#include <QUrl>
46
48 const QString &baseName,
49 const QString &providerLib,
51 : QgsMapLayer( Qgis::LayerType::PointCloud, baseName, uri )
52 , mElevationProperties( new QgsPointCloudLayerElevationProperties( this ) )
53 , mLayerOptions( options )
54{
55 if ( !uri.isEmpty() && !providerLib.isEmpty() )
56 {
57 const QgsDataProvider::ProviderOptions providerOptions { options.transformContext };
58 QgsDataProvider::ReadFlags providerFlags = QgsDataProvider::ReadFlags();
59 if ( options.loadDefaultStyle )
60 {
62 }
63 setDataSource( uri, baseName, providerLib, providerOptions, providerFlags );
64 }
65
68}
69
71{
72 if ( QgsTask *task = QgsApplication::taskManager()->task( mStatsCalculationTask ) )
73 {
74 task->cancel();
75 }
76}
77
79{
81
82 QgsPointCloudLayer *layer = new QgsPointCloudLayer( source(), name(), mProviderKey, mLayerOptions );
83 QgsMapLayer::clone( layer );
84
85 if ( mRenderer )
86 layer->setRenderer( mRenderer->clone() );
87
88 layer->mElevationProperties = mElevationProperties->clone();
89 layer->mElevationProperties->setParent( layer );
90
91 layer->mLayerOptions = mLayerOptions;
92 layer->mSync3DRendererTo2DRenderer = mSync3DRendererTo2DRenderer;
93
94 return layer;
95}
96
98{
100
101 if ( !mDataProvider )
102 return QgsRectangle();
103
104 return mDataProvider->extent();
105}
106
108{
110
111 return new QgsPointCloudLayerRenderer( this, rendererContext );
112}
113
115{
117
118 return new QgsPointCloudLayerProfileGenerator( this, request );
119}
120
122{
123 // BAD! 2D rendering of point clouds is NOT thread safe
125
126 return mDataProvider.get();
127}
128
130{
132
133 return mDataProvider.get();
134}
135
136bool QgsPointCloudLayer::readXml( const QDomNode &layerNode, QgsReadWriteContext &context )
137{
139
140 // create provider
141 const QDomNode pkeyNode = layerNode.namedItem( QStringLiteral( "provider" ) );
142 mProviderKey = pkeyNode.toElement().text();
143
145 {
146 const QgsDataProvider::ProviderOptions providerOptions { context.transformContext() };
147 QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags();
148 // read extent
150 {
151 const QDomNode extentNode = layerNode.namedItem( QStringLiteral( "extent" ) );
152 if ( !extentNode.isNull() )
153 {
154 // get the extent
155 const QgsRectangle mbr = QgsXmlUtils::readRectangle( extentNode.toElement() );
156
157 // store the extent
158 setExtent( mbr );
159
160 // skip get extent
162 }
163 }
165 {
167 }
169 {
171 }
173 const QDomNode subset = layerNode.namedItem( QStringLiteral( "subset" ) );
174 const QString subsetText = subset.toElement().text();
175 if ( !subsetText.isEmpty() )
176 setSubsetString( subsetText );
177 }
178
179 if ( !isValid() )
180 {
181 return false;
182 }
183
184 QString errorMsg;
185 if ( !readSymbology( layerNode, errorMsg, context ) )
186 return false;
187
188 readStyleManager( layerNode );
189 return true;
190}
191
192bool QgsPointCloudLayer::writeXml( QDomNode &layerNode, QDomDocument &doc, const QgsReadWriteContext &context ) const
193{
195
196 QDomElement mapLayerNode = layerNode.toElement();
197 mapLayerNode.setAttribute( QStringLiteral( "type" ), QgsMapLayerFactory::typeToString( Qgis::LayerType::PointCloud ) );
198
199 if ( !subsetString().isEmpty() )
200 {
201 QDomElement subset = doc.createElement( QStringLiteral( "subset" ) );
202 const QDomText subsetText = doc.createTextNode( subsetString() );
203 subset.appendChild( subsetText );
204 layerNode.appendChild( subset );
205 }
206 if ( mDataProvider )
207 {
208 QDomElement provider = doc.createElement( QStringLiteral( "provider" ) );
209 const QDomText providerText = doc.createTextNode( providerType() );
210 provider.appendChild( providerText );
211 layerNode.appendChild( provider );
212 }
213
214 writeStyleManager( layerNode, doc );
215
216 QString errorMsg;
217 return writeSymbology( layerNode, doc, errorMsg, context );
218}
219
220bool QgsPointCloudLayer::readSymbology( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
221{
223
224 const QDomElement elem = node.toElement();
225
226 readCommonStyle( elem, context, categories );
227
228 readStyle( node, errorMessage, context, categories );
229
230 if ( categories.testFlag( CustomProperties ) )
231 readCustomProperties( node, QStringLiteral( "variable" ) );
232
233 return true;
234}
235
236bool QgsPointCloudLayer::readStyle( const QDomNode &node, QString &, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
237{
239
240 bool result = true;
241
242 if ( categories.testFlag( Symbology3D ) )
243 {
244 bool ok;
245 bool sync = node.attributes().namedItem( QStringLiteral( "sync3DRendererTo2DRenderer" ) ).nodeValue().toInt( &ok );
246 if ( ok )
248 }
249
250 if ( categories.testFlag( Symbology ) )
251 {
252 QDomElement rendererElement = node.firstChildElement( QStringLiteral( "renderer" ) );
253 if ( !rendererElement.isNull() )
254 {
255 std::unique_ptr< QgsPointCloudRenderer > r( QgsPointCloudRenderer::load( rendererElement, context ) );
256 if ( r )
257 {
258 setRenderer( r.release() );
259 }
260 else
261 {
262 result = false;
263 }
264 }
265 // make sure layer has a renderer - if none exists, fallback to a default renderer
266 if ( !mRenderer )
267 {
269 }
270 }
271
272 if ( categories.testFlag( Symbology ) )
273 {
274 // get and set the blend mode if it exists
275 const QDomNode blendModeNode = node.namedItem( QStringLiteral( "blendMode" ) );
276 if ( !blendModeNode.isNull() )
277 {
278 const QDomElement e = blendModeNode.toElement();
279 setBlendMode( QgsPainting::getCompositionMode( static_cast< Qgis::BlendMode >( e.text().toInt() ) ) );
280 }
281 }
282
283 // get and set the layer transparency and scale visibility if they exists
284 if ( categories.testFlag( Rendering ) )
285 {
286 const QDomNode layerOpacityNode = node.namedItem( QStringLiteral( "layerOpacity" ) );
287 if ( !layerOpacityNode.isNull() )
288 {
289 const QDomElement e = layerOpacityNode.toElement();
290 setOpacity( e.text().toDouble() );
291 }
292
293 const bool hasScaleBasedVisibiliy { node.attributes().namedItem( QStringLiteral( "hasScaleBasedVisibilityFlag" ) ).nodeValue() == '1' };
294 setScaleBasedVisibility( hasScaleBasedVisibiliy );
295 bool ok;
296 const double maxScale { node.attributes().namedItem( QStringLiteral( "maxScale" ) ).nodeValue().toDouble( &ok ) };
297 if ( ok )
298 {
299 setMaximumScale( maxScale );
300 }
301 const double minScale { node.attributes().namedItem( QStringLiteral( "minScale" ) ).nodeValue().toDouble( &ok ) };
302 if ( ok )
303 {
304 setMinimumScale( minScale );
305 }
306 }
307 return result;
308}
309
310bool QgsPointCloudLayer::writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
311 const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
312{
314
315 Q_UNUSED( errorMessage )
316
317 QDomElement elem = node.toElement();
318 writeCommonStyle( elem, doc, context, categories );
319
320 ( void )writeStyle( node, doc, errorMessage, context, categories );
321
322 return true;
323}
324
325bool QgsPointCloudLayer::writeStyle( QDomNode &node, QDomDocument &doc, QString &, const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
326{
328
329 QDomElement mapLayerNode = node.toElement();
330
331 if ( categories.testFlag( Symbology3D ) )
332 {
333 mapLayerNode.setAttribute( QStringLiteral( "sync3DRendererTo2DRenderer" ), mSync3DRendererTo2DRenderer ? 1 : 0 );
334 }
335
336 if ( categories.testFlag( Symbology ) )
337 {
338 if ( mRenderer )
339 {
340 const QDomElement rendererElement = mRenderer->save( doc, context );
341 node.appendChild( rendererElement );
342 }
343 }
344
345 //save customproperties
346 if ( categories.testFlag( CustomProperties ) )
347 {
348 writeCustomProperties( node, doc );
349 }
350
351 if ( categories.testFlag( Symbology ) )
352 {
353 // add the blend mode field
354 QDomElement blendModeElem = doc.createElement( QStringLiteral( "blendMode" ) );
355 const QDomText blendModeText = doc.createTextNode( QString::number( static_cast< int >( QgsPainting::getBlendModeEnum( blendMode() ) ) ) );
356 blendModeElem.appendChild( blendModeText );
357 node.appendChild( blendModeElem );
358 }
359
360 // add the layer opacity and scale visibility
361 if ( categories.testFlag( Rendering ) )
362 {
363 QDomElement layerOpacityElem = doc.createElement( QStringLiteral( "layerOpacity" ) );
364 const QDomText layerOpacityText = doc.createTextNode( QString::number( opacity() ) );
365 layerOpacityElem.appendChild( layerOpacityText );
366 node.appendChild( layerOpacityElem );
367
368 mapLayerNode.setAttribute( QStringLiteral( "hasScaleBasedVisibilityFlag" ), hasScaleBasedVisibility() ? 1 : 0 );
369 mapLayerNode.setAttribute( QStringLiteral( "maxScale" ), maximumScale() );
370 mapLayerNode.setAttribute( QStringLiteral( "minScale" ), minimumScale() );
371 }
372 return true;
373}
374
376{
378
379 if ( mDataProvider )
380 mDataProvider->setTransformContext( transformContext );
382}
383
384void QgsPointCloudLayer::setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider,
385 const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags )
386{
388
389 if ( mDataProvider )
390 {
391 disconnect( mDataProvider.get(), &QgsPointCloudDataProvider::dataChanged, this, &QgsPointCloudLayer::dataChanged );
392 disconnect( mDataProvider.get(), &QgsPointCloudDataProvider::indexGenerationStateChanged, this, &QgsPointCloudLayer::onPointCloudIndexGenerationStateChanged );
393 }
394
395 setName( baseName );
396 mProviderKey = provider;
397 mDataSource = dataSource;
398
399 mDataProvider.reset( qobject_cast<QgsPointCloudDataProvider *>( QgsProviderRegistry::instance()->createProvider( provider, dataSource, options, flags ) ) );
400 if ( !mDataProvider )
401 {
402 QgsDebugMsg( QStringLiteral( "Unable to get point cloud data provider" ) );
403 setValid( false );
404 return;
405 }
406
407 mDataProvider->setParent( this );
408 QgsDebugMsgLevel( QStringLiteral( "Instantiated the point cloud data provider plugin" ), 2 );
409
410 setValid( mDataProvider->isValid() );
411 if ( !isValid() )
412 {
413 QgsDebugMsg( QStringLiteral( "Invalid point cloud provider plugin %1" ).arg( QString( mDataSource.toUtf8() ) ) );
414 setError( mDataProvider->error() );
415 return;
416 }
417
418 connect( mDataProvider.get(), &QgsPointCloudDataProvider::indexGenerationStateChanged, this, &QgsPointCloudLayer::onPointCloudIndexGenerationStateChanged );
419 connect( mDataProvider.get(), &QgsPointCloudDataProvider::dataChanged, this, &QgsPointCloudLayer::dataChanged );
420
421 // Load initial extent, crs and renderer
422 setCrs( mDataProvider->crs() );
424 {
425 setExtent( mDataProvider->extent() );
426 }
427
428 bool loadDefaultStyleFlag = false;
430 {
431 loadDefaultStyleFlag = true;
432 }
433
434 if ( !mLayerOptions.skipIndexGeneration && mDataProvider && mDataProvider->indexingState() != QgsPointCloudDataProvider::PointCloudIndexGenerationState::Indexed )
435 {
436 mDataProvider->generateIndex();
437 }
438
439 if ( !mLayerOptions.skipStatisticsCalculation && mDataProvider && !mDataProvider->hasStatisticsMetadata() && mDataProvider->indexingState() == QgsPointCloudDataProvider::PointCloudIndexGenerationState::Indexed )
440 {
441 calculateStatistics();
442 }
443
444 // Note: we load the statistics from the data provider regardless of it being an existing metadata (do not check fot hasStatisticsMetadata)
445 // since the X, Y & Z coordinates will be in the header of the dataset
446 if ( mDataProvider && mDataProvider->isValid() && mStatistics.sampledPointsCount() == 0 && mDataProvider->indexingState() == QgsPointCloudDataProvider::Indexed )
447 {
448 mStatistics = mDataProvider->metadataStatistics();
449 }
450
451 if ( !mRenderer || loadDefaultStyleFlag )
452 {
453 std::unique_ptr< QgsScopedRuntimeProfile > profile;
454 if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
455 profile = std::make_unique< QgsScopedRuntimeProfile >( tr( "Load layer style" ), QStringLiteral( "projectload" ) );
456
457 bool defaultLoadedFlag = false;
458
459 if ( loadDefaultStyleFlag && isSpatial() && mDataProvider->capabilities() & QgsPointCloudDataProvider::CreateRenderer )
460 {
461 // first try to create a renderer directly from the data provider
462 std::unique_ptr< QgsPointCloudRenderer > defaultRenderer( mDataProvider->createRenderer() );
463 if ( defaultRenderer )
464 {
465 defaultLoadedFlag = true;
466 setRenderer( defaultRenderer.release() );
467 }
468 }
469
470 if ( !defaultLoadedFlag && loadDefaultStyleFlag )
471 {
472 loadDefaultStyle( defaultLoadedFlag );
473 }
474
475 if ( !defaultLoadedFlag )
476 {
477 // all else failed, create default renderer
479 }
480 }
481}
482
483QString QgsPointCloudLayer::encodedSource( const QString &source, const QgsReadWriteContext &context ) const
484{
486
488}
489
490QString QgsPointCloudLayer::decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const
491{
493
495}
496
497void QgsPointCloudLayer::onPointCloudIndexGenerationStateChanged( QgsPointCloudDataProvider::PointCloudIndexGenerationState state )
498{
500
501 switch ( state )
502 {
504 {
505 resetRenderer();
506 break;
507 }
509 {
510 QgsError providerError = mDataProvider->error();
511 if ( !providerError.isEmpty() )
512 {
513 setError( providerError );
514 emit raiseError( providerError.summary() );
515 }
516 break;
517 }
519 break;
520 }
521}
522
523
524QString QgsPointCloudLayer::loadDefaultStyle( bool &resultFlag )
525{
527
528 if ( mDataProvider->capabilities() & QgsPointCloudDataProvider::CreateRenderer )
529 {
530 // first try to create a renderer directly from the data provider
531 std::unique_ptr< QgsPointCloudRenderer > defaultRenderer( mDataProvider->createRenderer() );
532 if ( defaultRenderer )
533 {
534 resultFlag = true;
535 setRenderer( defaultRenderer.release() );
536 return QString();
537 }
538 }
539
540 return QgsMapLayer::loadDefaultStyle( resultFlag );
541}
542
544{
546
547 const QgsLayerMetadataFormatter htmlFormatter( metadata() );
548 QString myMetadata = QStringLiteral( "<html>\n<body>\n" );
549
550 myMetadata += generalHtmlMetadata();
551
552 // Begin Provider section
553 myMetadata += QStringLiteral( "<h1>" ) + tr( "Information from provider" ) + QStringLiteral( "</h1>\n<hr>\n" );
554 myMetadata += QLatin1String( "<table class=\"list-view\">\n" );
555
556 // Extent
557 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Extent" ) + QStringLiteral( "</td><td>" ) + extent().toString() + QStringLiteral( "</td></tr>\n" );
558
559 // feature count
560 QLocale locale = QLocale();
561 locale.setNumberOptions( locale.numberOptions() &= ~QLocale::NumberOption::OmitGroupSeparator );
562 const qint64 pointCount = mDataProvider ? mDataProvider->pointCount() : -1;
563 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
564 + tr( "Point count" ) + QStringLiteral( "</td><td>" )
565 + ( pointCount < 0 ? tr( "unknown" ) : locale.toString( static_cast<qlonglong>( pointCount ) ) )
566 + QStringLiteral( "</td></tr>\n" );
567 myMetadata += QLatin1String( "</table>\n<br><br>" );
568
569 // CRS
570 myMetadata += crsHtmlMetadata();
571
572 // provider metadata section
573 myMetadata += QStringLiteral( "<h1>" ) + tr( "Metadata" ) + QStringLiteral( "</h1>\n<hr>\n" ) + QStringLiteral( "<table class=\"list-view\">\n" );
574 const QVariantMap originalMetadata = mDataProvider ? mDataProvider->originalMetadata() : QVariantMap();
575
576 if ( originalMetadata.value( QStringLiteral( "creation_year" ) ).toInt() > 0 && originalMetadata.contains( QStringLiteral( "creation_doy" ) ) )
577 {
578 QDate creationDate( originalMetadata.value( QStringLiteral( "creation_year" ) ).toInt(), 1, 1 );
579 creationDate = creationDate.addDays( originalMetadata.value( QStringLiteral( "creation_doy" ) ).toInt() );
580
581 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
582 + tr( "Creation date" ) + QStringLiteral( "</td><td>" )
583 + creationDate.toString( Qt::ISODate )
584 + QStringLiteral( "</td></tr>\n" );
585 }
586 if ( originalMetadata.contains( QStringLiteral( "major_version" ) ) && originalMetadata.contains( QStringLiteral( "minor_version" ) ) )
587 {
588 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
589 + tr( "Version" ) + QStringLiteral( "</td><td>" )
590 + QStringLiteral( "%1.%2" ).arg( originalMetadata.value( QStringLiteral( "major_version" ) ).toString(),
591 originalMetadata.value( QStringLiteral( "minor_version" ) ).toString() )
592 + QStringLiteral( "</td></tr>\n" );
593 }
594
595 if ( !originalMetadata.value( QStringLiteral( "dataformat_id" ) ).toString().isEmpty() )
596 {
597 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
598 + tr( "Data format" ) + QStringLiteral( "</td><td>" )
599 + QStringLiteral( "%1 (%2)" ).arg( QgsPointCloudDataProvider::translatedDataFormatIds().value( originalMetadata.value( QStringLiteral( "dataformat_id" ) ).toInt() ),
600 originalMetadata.value( QStringLiteral( "dataformat_id" ) ).toString() ).trimmed()
601 + QStringLiteral( "</td></tr>\n" );
602 }
603
604 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
605 + tr( "Scale X" ) + QStringLiteral( "</td><td>" )
606 + QString::number( originalMetadata.value( QStringLiteral( "scale_x" ) ).toDouble() )
607 + QStringLiteral( "</td></tr>\n" );
608 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
609 + tr( "Scale Y" ) + QStringLiteral( "</td><td>" )
610 + QString::number( originalMetadata.value( QStringLiteral( "scale_y" ) ).toDouble() )
611 + QStringLiteral( "</td></tr>\n" );
612 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
613 + tr( "Scale Z" ) + QStringLiteral( "</td><td>" )
614 + QString::number( originalMetadata.value( QStringLiteral( "scale_z" ) ).toDouble() )
615 + QStringLiteral( "</td></tr>\n" );
616
617 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
618 + tr( "Offset X" ) + QStringLiteral( "</td><td>" )
619 + QString::number( originalMetadata.value( QStringLiteral( "offset_x" ) ).toDouble() )
620 + QStringLiteral( "</td></tr>\n" );
621 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
622 + tr( "Offset Y" ) + QStringLiteral( "</td><td>" )
623 + QString::number( originalMetadata.value( QStringLiteral( "offset_y" ) ).toDouble() )
624 + QStringLiteral( "</td></tr>\n" );
625 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
626 + tr( "Offset Z" ) + QStringLiteral( "</td><td>" )
627 + QString::number( originalMetadata.value( QStringLiteral( "offset_z" ) ).toDouble() )
628 + QStringLiteral( "</td></tr>\n" );
629
630 if ( !originalMetadata.value( QStringLiteral( "project_id" ) ).toString().isEmpty() )
631 {
632 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
633 + tr( "Project ID" ) + QStringLiteral( "</td><td>" )
634 + originalMetadata.value( QStringLiteral( "project_id" ) ).toString()
635 + QStringLiteral( "</td></tr>\n" );
636 }
637
638 if ( !originalMetadata.value( QStringLiteral( "system_id" ) ).toString().isEmpty() )
639 {
640 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
641 + tr( "System ID" ) + QStringLiteral( "</td><td>" )
642 + originalMetadata.value( QStringLiteral( "system_id" ) ).toString()
643 + QStringLiteral( "</td></tr>\n" );
644 }
645
646 if ( !originalMetadata.value( QStringLiteral( "software_id" ) ).toString().isEmpty() )
647 {
648 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
649 + tr( "Software ID" ) + QStringLiteral( "</td><td>" )
650 + originalMetadata.value( QStringLiteral( "software_id" ) ).toString()
651 + QStringLiteral( "</td></tr>\n" );
652 }
653
654 // End Provider section
655 myMetadata += QLatin1String( "</table>\n<br><br>" );
656
657 // identification section
658 myMetadata += QStringLiteral( "<h1>" ) + tr( "Identification" ) + QStringLiteral( "</h1>\n<hr>\n" );
659 myMetadata += htmlFormatter.identificationSectionHtml( );
660 myMetadata += QLatin1String( "<br><br>\n" );
661
662 // extent section
663 myMetadata += QStringLiteral( "<h1>" ) + tr( "Extent" ) + QStringLiteral( "</h1>\n<hr>\n" );
664 myMetadata += htmlFormatter.extentSectionHtml( isSpatial() );
665 myMetadata += QLatin1String( "<br><br>\n" );
666
667 // Start the Access section
668 myMetadata += QStringLiteral( "<h1>" ) + tr( "Access" ) + QStringLiteral( "</h1>\n<hr>\n" );
669 myMetadata += htmlFormatter.accessSectionHtml( );
670 myMetadata += QLatin1String( "<br><br>\n" );
671
672 // Attributes section
673 myMetadata += QStringLiteral( "<h1>" ) + tr( "Attributes" ) + QStringLiteral( "</h1>\n<hr>\n<table class=\"list-view\">\n" );
674
676
677 // count attributes
678 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Count" ) + QStringLiteral( "</td><td>" ) + QString::number( attrs.count() ) + QStringLiteral( "</td></tr>\n" );
679
680 myMetadata += QLatin1String( "</table>\n<br><table width=\"100%\" class=\"tabular-view\">\n" );
681 myMetadata += QLatin1String( "<tr><th>" ) + tr( "Attribute" ) + QLatin1String( "</th><th>" ) + tr( "Type" ) + QLatin1String( "</th></tr>\n" );
682
683 for ( int i = 0; i < attrs.count(); ++i )
684 {
685 const QgsPointCloudAttribute attribute = attrs.at( i );
686 QString rowClass;
687 if ( i % 2 )
688 rowClass = QStringLiteral( "class=\"odd-row\"" );
689 myMetadata += QLatin1String( "<tr " ) + rowClass + QLatin1String( "><td>" ) + attribute.name() + QLatin1String( "</td><td>" ) + attribute.displayType() + QLatin1String( "</td></tr>\n" );
690 }
691
692 //close field list
693 myMetadata += QLatin1String( "</table>\n<br><br>" );
694
695
696 // Start the contacts section
697 myMetadata += QStringLiteral( "<h1>" ) + tr( "Contacts" ) + QStringLiteral( "</h1>\n<hr>\n" );
698 myMetadata += htmlFormatter.contactsSectionHtml( );
699 myMetadata += QLatin1String( "<br><br>\n" );
700
701 // Start the links section
702 myMetadata += QStringLiteral( "<h1>" ) + tr( "Links" ) + QStringLiteral( "</h1>\n<hr>\n" );
703 myMetadata += htmlFormatter.linksSectionHtml( );
704 myMetadata += QLatin1String( "<br><br>\n" );
705
706 // Start the history section
707 myMetadata += QStringLiteral( "<h1>" ) + tr( "History" ) + QStringLiteral( "</h1>\n<hr>\n" );
708 myMetadata += htmlFormatter.historySectionHtml( );
709 myMetadata += QLatin1String( "<br><br>\n" );
710
711 myMetadata += QLatin1String( "\n</body>\n</html>\n" );
712 return myMetadata;
713}
714
716{
718
719 return mElevationProperties;
720}
721
723{
725
726 return mDataProvider ? mDataProvider->attributes() : QgsPointCloudAttributeCollection();
727}
728
730{
732
733 return mDataProvider ? mDataProvider->pointCount() : 0;
734}
735
737{
739
740 return mRenderer.get();
741}
742
744{
746
747 return mRenderer.get();
748}
749
751{
753
754 if ( renderer == mRenderer.get() )
755 return;
756
757 mRenderer.reset( renderer );
758 emit rendererChanged();
760
761 if ( mSync3DRendererTo2DRenderer )
763}
764
765bool QgsPointCloudLayer::setSubsetString( const QString &subset )
766{
768
769 if ( !isValid() || !mDataProvider )
770 {
771 QgsDebugMsgLevel( QStringLiteral( "invoked with invalid layer or null mDataProvider" ), 3 );
772 setCustomProperty( QStringLiteral( "storedSubsetString" ), subset );
773 return false;
774 }
775 else if ( subset == mDataProvider->subsetString() )
776 return true;
777
778 bool res = mDataProvider->setSubsetString( subset );
779 if ( res )
780 {
781 emit subsetStringChanged();
783 }
784 return res;
785}
786
788{
790
791 if ( !isValid() || !mDataProvider )
792 {
793 QgsDebugMsgLevel( QStringLiteral( "invoked with invalid layer or null mDataProvider" ), 3 );
794 return customProperty( QStringLiteral( "storedSubsetString" ) ).toString();
795 }
796 return mDataProvider->subsetString();
797}
798
800{
802
803 bool result = false;
805 if ( r )
806 {
807 result = r->convertFrom2DRenderer( renderer() );
808 setRenderer3D( r );
810 }
811 return result;
812}
813
815{
817
818 return mSync3DRendererTo2DRenderer;
819}
820
822{
824
825 mSync3DRendererTo2DRenderer = sync;
826 if ( sync )
828}
829
830void QgsPointCloudLayer::calculateStatistics()
831{
833
834 if ( !mDataProvider.get() || !mDataProvider->hasValidIndex() )
835 {
836 QgsMessageLog::logMessage( QObject::tr( "Failed to calculate statistics of the point cloud %1" ).arg( this->name() ) );
837 return;
838 }
839 if ( mStatsCalculationTask )
840 {
841 QgsMessageLog::logMessage( QObject::tr( "A statistics calculation task for the point cloud %1 is already in progress" ).arg( this->name() ) );
842 return;
843 }
844#ifdef HAVE_COPC
845 if ( mDataProvider && mDataProvider->index() && mDataProvider->index()->isValid() )
846 {
847 if ( QgsCopcPointCloudIndex *index = qobject_cast<QgsCopcPointCloudIndex *>( mDataProvider->index() ) )
848 {
849 mStatistics = index->readStatistics();
850 }
851 }
852#endif
853 if ( mStatistics.sampledPointsCount() != 0 )
854 {
856 emit statisticsCalculationStateChanged( mStatisticsCalculationState );
857 resetRenderer();
858 return;
859 }
860
861 QVector<QgsPointCloudAttribute> attributes = mDataProvider->attributes().attributes();
862 // Do not calculate stats for X, Y & Z since the point cloud index contains that
863 for ( int i = 0; i < attributes.size(); ++i )
864 {
865 if ( attributes[i].name() == QLatin1String( "X" ) || attributes[i].name() == QLatin1String( "Y" ) || attributes[i].name() == QLatin1String( "Z" ) )
866 {
867 attributes.remove( i );
868 --i;
869 }
870 }
871
872 QgsPointCloudStatsCalculationTask *task = new QgsPointCloudStatsCalculationTask( mDataProvider->index(), attributes, 1000000 );
873 connect( task, &QgsTask::taskCompleted, this, [this, task]()
874 {
875 mStatistics = task->calculationResults();
876
877 // fetch X, Y & Z stats directly from the index
878 QVector<QString> coordinateAttributes;
879 coordinateAttributes.push_back( QStringLiteral( "X" ) );
880 coordinateAttributes.push_back( QStringLiteral( "Y" ) );
881 coordinateAttributes.push_back( QStringLiteral( "Z" ) );
882
883 QMap<QString, QgsPointCloudAttributeStatistics> statsMap = mStatistics.statisticsMap();
884 QgsPointCloudIndex *index = mDataProvider->index();
885 for ( const QString &attribute : coordinateAttributes )
886 {
888 QVariant min = index->metadataStatistic( attribute, QgsStatisticalSummary::Min );
889 QVariant max = index->metadataStatistic( attribute, QgsStatisticalSummary::Max );
890 if ( !min.isValid() )
891 continue;
892 s.minimum = min.toDouble();
893 s.maximum = max.toDouble();
894 s.count = index->metadataStatistic( attribute, QgsStatisticalSummary::Count ).toInt();
895 s.mean = index->metadataStatistic( attribute, QgsStatisticalSummary::Mean ).toInt();
896 s.stDev = index->metadataStatistic( attribute, QgsStatisticalSummary::StDev ).toInt();
897 QVariantList classes = index->metadataClasses( attribute );
898 for ( const QVariant &c : classes )
899 {
900 s.classCount[ c.toInt() ] = index->metadataClassStatistic( attribute, c, QgsStatisticalSummary::Count ).toInt();
901 }
902 statsMap[ attribute ] = s;
903 }
904 mStatistics = QgsPointCloudStatistics( mStatistics.sampledPointsCount(), statsMap );
905 //
906
908 emit statisticsCalculationStateChanged( mStatisticsCalculationState );
909 resetRenderer();
910 mStatsCalculationTask = 0;
911#ifdef HAVE_COPC
912 if ( mDataProvider && mDataProvider->index() && mDataProvider->index()->isValid() && mDataProvider->name() == QLatin1String( "pdal" ) && mStatistics.sampledPointsCount() != 0 )
913 {
914 if ( QgsCopcPointCloudIndex *index = qobject_cast<QgsCopcPointCloudIndex *>( mDataProvider->index() ) )
915 {
916 index->writeStatistics( mStatistics );
917 }
918 }
919#endif
920 } );
921
922 // In case the statistics calculation fails, QgsTask::taskTerminated will be called
923 connect( task, &QgsTask::taskTerminated, this, [this]()
924 {
925 QgsMessageLog::logMessage( QObject::tr( "Failed to calculate statistics of the point cloud %1" ).arg( this->name() ) );
926 mStatsCalculationTask = 0;
927 } );
928
929 mStatsCalculationTask = QgsApplication::taskManager()->addTask( task );
930
932 emit statisticsCalculationStateChanged( mStatisticsCalculationState );
933}
934
935void QgsPointCloudLayer::resetRenderer()
936{
938
939 mDataProvider->loadIndex();
940 if ( !mLayerOptions.skipStatisticsCalculation && !mDataProvider->hasStatisticsMetadata() && statisticsCalculationState() == QgsPointCloudLayer::PointCloudStatisticsCalculationState::NotStarted )
941 {
942 calculateStatistics();
943 }
944 if ( !mRenderer || mRenderer->type() == QLatin1String( "extent" ) )
945 {
947 }
949
950 emit rendererChanged();
951}
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:55
BlendMode
Blending modes defining the available composition modes that can be used when painting.
Definition: qgis.h:2978
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.
@ FlagLoadDefaultStyle
Reset the layer's style to the default for the datasource.
@ FlagTrustDataSource
Trust datasource config (primary key unicity, geometry type and srid, etc). Improves provider load ti...
@ ForceReadOnly
Open layer in a read-only mode (since QGIS 3.28)
@ SkipGetExtent
Skip the extent from provider.
void dataChanged()
Emitted whenever a change is made to the data provider which may have caused changes in the provider'...
QgsError is container for error messages (report).
Definition: qgserror.h:81
bool isEmpty() const
Test if any error is set.
Definition: qgserror.h:111
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:73
QString name
Definition: qgsmaplayer.h:76
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.
Definition: qgsmaplayer.h:1984
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.
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.
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.
Definition: qgsmaplayer.h:2001
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:78
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.
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)
Definition: qgsmaplayer.h:2039
QgsCoordinateTransformContext transformContext() const
Returns the layer data provider coordinate transform context or a default transform context if the la...
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.
bool isValid
Definition: qgsmaplayer.h:81
QString mDataSource
Data source description string, varies by layer type.
Definition: qgsmaplayer.h:1998
@ FlagReadExtentFromXml
Read extent from xml and skip get extent from provider.
Definition: qgsmaplayer.h:635
@ FlagTrustLayerMetadata
Trust layer metadata. Improves layer load time by skipping expensive checks like primary key unicity,...
Definition: qgsmaplayer.h:634
@ FlagForceReadOnly
Force open as read only.
Definition: qgsmaplayer.h:636
@ FlagDontResolveLayers
Don't resolve layer paths or create data providers for layers.
Definition: qgsmaplayer.h:633
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.
Definition: qgsmaplayer.h:2044
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:82
@ Symbology
Symbology.
Definition: qgsmaplayer.h:162
@ Rendering
Rendering: scale visibility, simplify method, opacity.
Definition: qgsmaplayer.h:171
@ Symbology3D
3D symbology
Definition: qgsmaplayer.h:163
@ CustomProperties
Custom properties (by plugins for instance)
Definition: qgsmaplayer.h:172
void setRenderer3D(QgsAbstract3DRenderer *renderer)
Sets 3D renderer for the layer.
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 BlendMode corresponding to a QPainter::CompositionMode.
Definition: qgspainting.cpp:80
static QPainter::CompositionMode getCompositionMode(Qgis::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
Definition: qgspainting.cpp:20
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...
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.
Represents a indexed point clouds data in octree.
virtual QVariant metadataClassStatistic(const QString &attribute, const QVariant &value, QgsStatisticalSummary::Statistic statistic) const
Returns the statistic statistic of the class value of the attribute attribute.
virtual QVariantList metadataClasses(const QString &attribute) const
Returns the classes of attribute.
virtual QVariant metadataStatistic(const QString &attribute, QgsStatisticalSummary::Statistic statistic) const
Returns the statistic statistic of attribute.
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.
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.
Definition: qgsrectangle.h:42
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.
@ StDev
Standard deviation of values.
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)
Definition: qgsxmlutils.cpp:39
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define QgsDebugMsgLevel(str, level)
Definition: qgslogger.h:39
#define QgsDebugMsg(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.
Class used to store statistics of one attribute of a point cloud dataset.
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.