QGIS API Documentation 3.27.0-Master (0a97e3138f)
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"
35#include "qgsmaplayerutils.h"
39#include "qgsmessagelog.h"
40#include "qgstaskmanager.h"
42#ifdef HAVE_COPC
44#endif
45
46#include <QUrl>
47
49 const QString &baseName,
50 const QString &providerLib,
53 , mElevationProperties( new QgsPointCloudLayerElevationProperties( this ) )
54 , mLayerOptions( options )
55{
56 if ( !uri.isEmpty() && !providerLib.isEmpty() )
57 {
58 const QgsDataProvider::ProviderOptions providerOptions { options.transformContext };
59 QgsDataProvider::ReadFlags providerFlags = QgsDataProvider::ReadFlags();
60 if ( options.loadDefaultStyle )
61 {
63 }
64 setDataSource( uri, baseName, providerLib, providerOptions, providerFlags );
65 }
66
69}
70
72{
73 if ( QgsTask *task = QgsApplication::taskManager()->task( mStatsCalculationTask ) )
74 {
75 task->cancel();
76 }
77}
78
80{
81 QgsPointCloudLayer *layer = new QgsPointCloudLayer( source(), name(), mProviderKey, mLayerOptions );
82 QgsMapLayer::clone( layer );
83
84 if ( mRenderer )
85 layer->setRenderer( mRenderer->clone() );
86
87 layer->mElevationProperties = mElevationProperties->clone();
88 layer->mElevationProperties->setParent( layer );
89
90 layer->mLayerOptions = mLayerOptions;
91 layer->mSync3DRendererTo2DRenderer = mSync3DRendererTo2DRenderer;
92
93 return layer;
94}
95
97{
98 if ( !mDataProvider )
99 return QgsRectangle();
100
101 return mDataProvider->extent();
102}
103
105{
106 return new QgsPointCloudLayerRenderer( this, rendererContext );
107}
108
110{
111 return new QgsPointCloudLayerProfileGenerator( this, request );
112}
113
115{
116 return mDataProvider.get();
117}
118
120{
121 return mDataProvider.get();
122}
123
124bool QgsPointCloudLayer::readXml( const QDomNode &layerNode, QgsReadWriteContext &context )
125{
126 // create provider
127 const QDomNode pkeyNode = layerNode.namedItem( QStringLiteral( "provider" ) );
128 mProviderKey = pkeyNode.toElement().text();
129
131 {
132 const QgsDataProvider::ProviderOptions providerOptions { context.transformContext() };
133 QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags();
134 // read extent
136 {
137 const QDomNode extentNode = layerNode.namedItem( QStringLiteral( "extent" ) );
138 if ( !extentNode.isNull() )
139 {
140 // get the extent
141 const QgsRectangle mbr = QgsXmlUtils::readRectangle( extentNode.toElement() );
142
143 // store the extent
144 setExtent( mbr );
145
146 // skip get extent
148 }
149 }
151 {
153 }
155 const QDomNode subset = layerNode.namedItem( QStringLiteral( "subset" ) );
156 const QString subsetText = subset.toElement().text();
157 if ( !subsetText.isEmpty() )
158 setSubsetString( subsetText );
159 }
160
161 if ( !isValid() )
162 {
163 return false;
164 }
165
166 QString errorMsg;
167 if ( !readSymbology( layerNode, errorMsg, context ) )
168 return false;
169
170 readStyleManager( layerNode );
171 return true;
172}
173
174bool QgsPointCloudLayer::writeXml( QDomNode &layerNode, QDomDocument &doc, const QgsReadWriteContext &context ) const
175{
176 QDomElement mapLayerNode = layerNode.toElement();
177 mapLayerNode.setAttribute( QStringLiteral( "type" ), QgsMapLayerFactory::typeToString( QgsMapLayerType::PointCloudLayer ) );
178
179 if ( !subsetString().isEmpty() )
180 {
181 QDomElement subset = doc.createElement( QStringLiteral( "subset" ) );
182 const QDomText subsetText = doc.createTextNode( subsetString() );
183 subset.appendChild( subsetText );
184 layerNode.appendChild( subset );
185 }
186 if ( mDataProvider )
187 {
188 QDomElement provider = doc.createElement( QStringLiteral( "provider" ) );
189 const QDomText providerText = doc.createTextNode( providerType() );
190 provider.appendChild( providerText );
191 layerNode.appendChild( provider );
192 }
193
194 writeStyleManager( layerNode, doc );
195
196 QString errorMsg;
197 return writeSymbology( layerNode, doc, errorMsg, context );
198}
199
200bool QgsPointCloudLayer::readSymbology( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
201{
202 const QDomElement elem = node.toElement();
203
204 readCommonStyle( elem, context, categories );
205
206 readStyle( node, errorMessage, context, categories );
207
208 if ( categories.testFlag( CustomProperties ) )
209 readCustomProperties( node, QStringLiteral( "variable" ) );
210
211 return true;
212}
213
214bool QgsPointCloudLayer::readStyle( const QDomNode &node, QString &, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
215{
216 bool result = true;
217
218 if ( categories.testFlag( Symbology3D ) )
219 {
220 bool ok;
221 bool sync = node.attributes().namedItem( QStringLiteral( "sync3DRendererTo2DRenderer" ) ).nodeValue().toInt( &ok );
222 if ( ok )
224 }
225
226 if ( categories.testFlag( Symbology ) )
227 {
228 QDomElement rendererElement = node.firstChildElement( QStringLiteral( "renderer" ) );
229 if ( !rendererElement.isNull() )
230 {
231 std::unique_ptr< QgsPointCloudRenderer > r( QgsPointCloudRenderer::load( rendererElement, context ) );
232 if ( r )
233 {
234 setRenderer( r.release() );
235 }
236 else
237 {
238 result = false;
239 }
240 }
241 // make sure layer has a renderer - if none exists, fallback to a default renderer
242 if ( !mRenderer )
243 {
245 }
246 }
247
248 if ( categories.testFlag( Symbology ) )
249 {
250 // get and set the blend mode if it exists
251 const QDomNode blendModeNode = node.namedItem( QStringLiteral( "blendMode" ) );
252 if ( !blendModeNode.isNull() )
253 {
254 const QDomElement e = blendModeNode.toElement();
255 setBlendMode( QgsPainting::getCompositionMode( static_cast< QgsPainting::BlendMode >( e.text().toInt() ) ) );
256 }
257 }
258
259 // get and set the layer transparency and scale visibility if they exists
260 if ( categories.testFlag( Rendering ) )
261 {
262 const QDomNode layerOpacityNode = node.namedItem( QStringLiteral( "layerOpacity" ) );
263 if ( !layerOpacityNode.isNull() )
264 {
265 const QDomElement e = layerOpacityNode.toElement();
266 setOpacity( e.text().toDouble() );
267 }
268
269 const bool hasScaleBasedVisibiliy { node.attributes().namedItem( QStringLiteral( "hasScaleBasedVisibilityFlag" ) ).nodeValue() == '1' };
270 setScaleBasedVisibility( hasScaleBasedVisibiliy );
271 bool ok;
272 const double maxScale { node.attributes().namedItem( QStringLiteral( "maxScale" ) ).nodeValue().toDouble( &ok ) };
273 if ( ok )
274 {
275 setMaximumScale( maxScale );
276 }
277 const double minScale { node.attributes().namedItem( QStringLiteral( "minScale" ) ).nodeValue().toDouble( &ok ) };
278 if ( ok )
279 {
280 setMinimumScale( minScale );
281 }
282 }
283 return result;
284}
285
286bool QgsPointCloudLayer::writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
287 const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
288{
289 Q_UNUSED( errorMessage )
290
291 QDomElement elem = node.toElement();
292 writeCommonStyle( elem, doc, context, categories );
293
294 ( void )writeStyle( node, doc, errorMessage, context, categories );
295
296 return true;
297}
298
299bool QgsPointCloudLayer::writeStyle( QDomNode &node, QDomDocument &doc, QString &, const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
300{
301 QDomElement mapLayerNode = node.toElement();
302
303 if ( categories.testFlag( Symbology3D ) )
304 {
305 mapLayerNode.setAttribute( QStringLiteral( "sync3DRendererTo2DRenderer" ), mSync3DRendererTo2DRenderer ? 1 : 0 );
306 }
307
308 if ( categories.testFlag( Symbology ) )
309 {
310 if ( mRenderer )
311 {
312 const QDomElement rendererElement = mRenderer->save( doc, context );
313 node.appendChild( rendererElement );
314 }
315 }
316
317 //save customproperties
318 if ( categories.testFlag( CustomProperties ) )
319 {
320 writeCustomProperties( node, doc );
321 }
322
323 if ( categories.testFlag( Symbology ) )
324 {
325 // add the blend mode field
326 QDomElement blendModeElem = doc.createElement( QStringLiteral( "blendMode" ) );
327 const QDomText blendModeText = doc.createTextNode( QString::number( QgsPainting::getBlendModeEnum( blendMode() ) ) );
328 blendModeElem.appendChild( blendModeText );
329 node.appendChild( blendModeElem );
330 }
331
332 // add the layer opacity and scale visibility
333 if ( categories.testFlag( Rendering ) )
334 {
335 QDomElement layerOpacityElem = doc.createElement( QStringLiteral( "layerOpacity" ) );
336 const QDomText layerOpacityText = doc.createTextNode( QString::number( opacity() ) );
337 layerOpacityElem.appendChild( layerOpacityText );
338 node.appendChild( layerOpacityElem );
339
340 mapLayerNode.setAttribute( QStringLiteral( "hasScaleBasedVisibilityFlag" ), hasScaleBasedVisibility() ? 1 : 0 );
341 mapLayerNode.setAttribute( QStringLiteral( "maxScale" ), maximumScale() );
342 mapLayerNode.setAttribute( QStringLiteral( "minScale" ), minimumScale() );
343 }
344 return true;
345}
346
348{
349 if ( mDataProvider )
350 mDataProvider->setTransformContext( transformContext );
352}
353
354void QgsPointCloudLayer::setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider,
355 const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags )
356{
357 if ( mDataProvider )
358 {
359 disconnect( mDataProvider.get(), &QgsPointCloudDataProvider::dataChanged, this, &QgsPointCloudLayer::dataChanged );
360 disconnect( mDataProvider.get(), &QgsPointCloudDataProvider::indexGenerationStateChanged, this, &QgsPointCloudLayer::onPointCloudIndexGenerationStateChanged );
361 }
362
363 setName( baseName );
364 mProviderKey = provider;
365 mDataSource = dataSource;
366
367 mDataProvider.reset( qobject_cast<QgsPointCloudDataProvider *>( QgsProviderRegistry::instance()->createProvider( provider, dataSource, options, flags ) ) );
368 if ( !mDataProvider )
369 {
370 QgsDebugMsg( QStringLiteral( "Unable to get point cloud data provider" ) );
371 setValid( false );
372 return;
373 }
374
375 mDataProvider->setParent( this );
376 QgsDebugMsgLevel( QStringLiteral( "Instantiated the point cloud data provider plugin" ), 2 );
377
378 setValid( mDataProvider->isValid() );
379 if ( !isValid() )
380 {
381 QgsDebugMsg( QStringLiteral( "Invalid point cloud provider plugin %1" ).arg( QString( mDataSource.toUtf8() ) ) );
382 setError( mDataProvider->error() );
383 return;
384 }
385
386 connect( mDataProvider.get(), &QgsPointCloudDataProvider::indexGenerationStateChanged, this, &QgsPointCloudLayer::onPointCloudIndexGenerationStateChanged );
387 connect( mDataProvider.get(), &QgsPointCloudDataProvider::dataChanged, this, &QgsPointCloudLayer::dataChanged );
388
389 // Load initial extent, crs and renderer
390 setCrs( mDataProvider->crs() );
392 {
393 setExtent( mDataProvider->extent() );
394 }
395
396 bool loadDefaultStyleFlag = false;
398 {
399 loadDefaultStyleFlag = true;
400 }
401
402 if ( !mLayerOptions.skipIndexGeneration && mDataProvider && mDataProvider->indexingState() != QgsPointCloudDataProvider::PointCloudIndexGenerationState::Indexed )
403 {
404 mDataProvider->generateIndex();
405 }
406
407 if ( !mLayerOptions.skipStatisticsCalculation && mDataProvider && !mDataProvider->hasStatisticsMetadata() && mDataProvider->indexingState() == QgsPointCloudDataProvider::PointCloudIndexGenerationState::Indexed )
408 {
409 calculateStatistics();
410 }
411
412 // Note: we load the statistics from the data provider regardless of it being an existing metadata (do not check fot hasStatisticsMetadata)
413 // since the X, Y & Z coordinates will be in the header of the dataset
414 if ( mDataProvider && mDataProvider->isValid() && mStatistics.sampledPointsCount() == 0 && mDataProvider->indexingState() == QgsPointCloudDataProvider::Indexed )
415 {
416 mStatistics = mDataProvider->metadataStatistics();
417 }
418
419 if ( !mRenderer || loadDefaultStyleFlag )
420 {
421 std::unique_ptr< QgsScopedRuntimeProfile > profile;
422 if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
423 profile = std::make_unique< QgsScopedRuntimeProfile >( tr( "Load layer style" ), QStringLiteral( "projectload" ) );
424
425 bool defaultLoadedFlag = false;
426
427 if ( loadDefaultStyleFlag && isSpatial() && mDataProvider->capabilities() & QgsPointCloudDataProvider::CreateRenderer )
428 {
429 // first try to create a renderer directly from the data provider
430 std::unique_ptr< QgsPointCloudRenderer > defaultRenderer( mDataProvider->createRenderer() );
431 if ( defaultRenderer )
432 {
433 defaultLoadedFlag = true;
434 setRenderer( defaultRenderer.release() );
435 }
436 }
437
438 if ( !defaultLoadedFlag && loadDefaultStyleFlag )
439 {
440 loadDefaultStyle( defaultLoadedFlag );
441 }
442
443 if ( !defaultLoadedFlag )
444 {
445 // all else failed, create default renderer
447 }
448 }
449}
450
451QString QgsPointCloudLayer::encodedSource( const QString &source, const QgsReadWriteContext &context ) const
452{
453 QVariantMap parts = QgsProviderRegistry::instance()->decodeUri( providerType(), source );
454 if ( parts.contains( QStringLiteral( "path" ) ) )
455 {
456 parts.insert( QStringLiteral( "path" ), context.pathResolver().writePath( parts.value( QStringLiteral( "path" ) ).toString() ) );
458 }
459 else
460 {
461 return source;
462 }
463}
464
465QString QgsPointCloudLayer::decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const
466{
468 if ( parts.contains( QStringLiteral( "path" ) ) )
469 {
470 parts.insert( QStringLiteral( "path" ), context.pathResolver().readPath( parts.value( QStringLiteral( "path" ) ).toString() ) );
472 }
473 else
474 {
475 return source;
476 }
477}
478
479void QgsPointCloudLayer::onPointCloudIndexGenerationStateChanged( QgsPointCloudDataProvider::PointCloudIndexGenerationState state )
480{
481 switch ( state )
482 {
484 {
485 resetRenderer();
486 break;
487 }
489 {
490 QgsError providerError = mDataProvider->error();
491 if ( !providerError.isEmpty() )
492 {
493 setError( providerError );
494 emit raiseError( providerError.summary() );
495 }
496 break;
497 }
499 break;
500 }
501}
502
503
504QString QgsPointCloudLayer::loadDefaultStyle( bool &resultFlag )
505{
506 if ( mDataProvider->capabilities() & QgsPointCloudDataProvider::CreateRenderer )
507 {
508 // first try to create a renderer directly from the data provider
509 std::unique_ptr< QgsPointCloudRenderer > defaultRenderer( mDataProvider->createRenderer() );
510 if ( defaultRenderer )
511 {
512 resultFlag = true;
513 setRenderer( defaultRenderer.release() );
514 return QString();
515 }
516 }
517
518 return QgsMapLayer::loadDefaultStyle( resultFlag );
519}
520
522{
523 const QgsLayerMetadataFormatter htmlFormatter( metadata() );
524 QString myMetadata = QStringLiteral( "<html>\n<body>\n" );
525
526 myMetadata += generalHtmlMetadata();
527
528 // Begin Provider section
529 myMetadata += QStringLiteral( "<h1>" ) + tr( "Information from provider" ) + QStringLiteral( "</h1>\n<hr>\n" );
530 myMetadata += QLatin1String( "<table class=\"list-view\">\n" );
531
532 // Extent
533 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Extent" ) + QStringLiteral( "</td><td>" ) + extent().toString() + QStringLiteral( "</td></tr>\n" );
534
535 // feature count
536 QLocale locale = QLocale();
537 locale.setNumberOptions( locale.numberOptions() &= ~QLocale::NumberOption::OmitGroupSeparator );
538 const qint64 pointCount = mDataProvider ? mDataProvider->pointCount() : -1;
539 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
540 + tr( "Point count" ) + QStringLiteral( "</td><td>" )
541 + ( pointCount < 0 ? tr( "unknown" ) : locale.toString( static_cast<qlonglong>( pointCount ) ) )
542 + QStringLiteral( "</td></tr>\n" );
543 myMetadata += QLatin1String( "</table>\n<br><br>" );
544
545 // CRS
546 myMetadata += crsHtmlMetadata();
547
548 // provider metadata section
549 myMetadata += QStringLiteral( "<h1>" ) + tr( "Metadata" ) + QStringLiteral( "</h1>\n<hr>\n" ) + QStringLiteral( "<table class=\"list-view\">\n" );
550 const QVariantMap originalMetadata = mDataProvider ? mDataProvider->originalMetadata() : QVariantMap();
551
552 if ( originalMetadata.value( QStringLiteral( "creation_year" ) ).toInt() > 0 && originalMetadata.contains( QStringLiteral( "creation_doy" ) ) )
553 {
554 QDate creationDate( originalMetadata.value( QStringLiteral( "creation_year" ) ).toInt(), 1, 1 );
555 creationDate = creationDate.addDays( originalMetadata.value( QStringLiteral( "creation_doy" ) ).toInt() );
556
557 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
558 + tr( "Creation date" ) + QStringLiteral( "</td><td>" )
559 + creationDate.toString( Qt::ISODate )
560 + QStringLiteral( "</td></tr>\n" );
561 }
562 if ( originalMetadata.contains( QStringLiteral( "major_version" ) ) && originalMetadata.contains( QStringLiteral( "minor_version" ) ) )
563 {
564 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
565 + tr( "Version" ) + QStringLiteral( "</td><td>" )
566 + QStringLiteral( "%1.%2" ).arg( originalMetadata.value( QStringLiteral( "major_version" ) ).toString(),
567 originalMetadata.value( QStringLiteral( "minor_version" ) ).toString() )
568 + QStringLiteral( "</td></tr>\n" );
569 }
570
571 if ( !originalMetadata.value( QStringLiteral( "dataformat_id" ) ).toString().isEmpty() )
572 {
573 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
574 + tr( "Data format" ) + QStringLiteral( "</td><td>" )
575 + QStringLiteral( "%1 (%2)" ).arg( QgsPointCloudDataProvider::translatedDataFormatIds().value( originalMetadata.value( QStringLiteral( "dataformat_id" ) ).toInt() ),
576 originalMetadata.value( QStringLiteral( "dataformat_id" ) ).toString() ).trimmed()
577 + QStringLiteral( "</td></tr>\n" );
578 }
579
580 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
581 + tr( "Scale X" ) + QStringLiteral( "</td><td>" )
582 + QString::number( originalMetadata.value( QStringLiteral( "scale_x" ) ).toDouble() )
583 + QStringLiteral( "</td></tr>\n" );
584 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
585 + tr( "Scale Y" ) + QStringLiteral( "</td><td>" )
586 + QString::number( originalMetadata.value( QStringLiteral( "scale_y" ) ).toDouble() )
587 + QStringLiteral( "</td></tr>\n" );
588 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
589 + tr( "Scale Z" ) + QStringLiteral( "</td><td>" )
590 + QString::number( originalMetadata.value( QStringLiteral( "scale_z" ) ).toDouble() )
591 + QStringLiteral( "</td></tr>\n" );
592
593 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
594 + tr( "Offset X" ) + QStringLiteral( "</td><td>" )
595 + QString::number( originalMetadata.value( QStringLiteral( "offset_x" ) ).toDouble() )
596 + QStringLiteral( "</td></tr>\n" );
597 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
598 + tr( "Offset Y" ) + QStringLiteral( "</td><td>" )
599 + QString::number( originalMetadata.value( QStringLiteral( "offset_y" ) ).toDouble() )
600 + QStringLiteral( "</td></tr>\n" );
601 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
602 + tr( "Offset Z" ) + QStringLiteral( "</td><td>" )
603 + QString::number( originalMetadata.value( QStringLiteral( "offset_z" ) ).toDouble() )
604 + QStringLiteral( "</td></tr>\n" );
605
606 if ( !originalMetadata.value( QStringLiteral( "project_id" ) ).toString().isEmpty() )
607 {
608 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
609 + tr( "Project ID" ) + QStringLiteral( "</td><td>" )
610 + originalMetadata.value( QStringLiteral( "project_id" ) ).toString()
611 + QStringLiteral( "</td></tr>\n" );
612 }
613
614 if ( !originalMetadata.value( QStringLiteral( "system_id" ) ).toString().isEmpty() )
615 {
616 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
617 + tr( "System ID" ) + QStringLiteral( "</td><td>" )
618 + originalMetadata.value( QStringLiteral( "system_id" ) ).toString()
619 + QStringLiteral( "</td></tr>\n" );
620 }
621
622 if ( !originalMetadata.value( QStringLiteral( "software_id" ) ).toString().isEmpty() )
623 {
624 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
625 + tr( "Software ID" ) + QStringLiteral( "</td><td>" )
626 + originalMetadata.value( QStringLiteral( "software_id" ) ).toString()
627 + QStringLiteral( "</td></tr>\n" );
628 }
629
630 // End Provider section
631 myMetadata += QLatin1String( "</table>\n<br><br>" );
632
633 // identification section
634 myMetadata += QStringLiteral( "<h1>" ) + tr( "Identification" ) + QStringLiteral( "</h1>\n<hr>\n" );
635 myMetadata += htmlFormatter.identificationSectionHtml( );
636 myMetadata += QLatin1String( "<br><br>\n" );
637
638 // extent section
639 myMetadata += QStringLiteral( "<h1>" ) + tr( "Extent" ) + QStringLiteral( "</h1>\n<hr>\n" );
640 myMetadata += htmlFormatter.extentSectionHtml( isSpatial() );
641 myMetadata += QLatin1String( "<br><br>\n" );
642
643 // Start the Access section
644 myMetadata += QStringLiteral( "<h1>" ) + tr( "Access" ) + QStringLiteral( "</h1>\n<hr>\n" );
645 myMetadata += htmlFormatter.accessSectionHtml( );
646 myMetadata += QLatin1String( "<br><br>\n" );
647
648 // Attributes section
649 myMetadata += QStringLiteral( "<h1>" ) + tr( "Attributes" ) + QStringLiteral( "</h1>\n<hr>\n<table class=\"list-view\">\n" );
650
652
653 // count attributes
654 myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Count" ) + QStringLiteral( "</td><td>" ) + QString::number( attrs.count() ) + QStringLiteral( "</td></tr>\n" );
655
656 myMetadata += QLatin1String( "</table>\n<br><table width=\"100%\" class=\"tabular-view\">\n" );
657 myMetadata += QLatin1String( "<tr><th>" ) + tr( "Attribute" ) + QLatin1String( "</th><th>" ) + tr( "Type" ) + QLatin1String( "</th></tr>\n" );
658
659 for ( int i = 0; i < attrs.count(); ++i )
660 {
661 const QgsPointCloudAttribute attribute = attrs.at( i );
662 QString rowClass;
663 if ( i % 2 )
664 rowClass = QStringLiteral( "class=\"odd-row\"" );
665 myMetadata += QLatin1String( "<tr " ) + rowClass + QLatin1String( "><td>" ) + attribute.name() + QLatin1String( "</td><td>" ) + attribute.displayType() + QLatin1String( "</td></tr>\n" );
666 }
667
668 //close field list
669 myMetadata += QLatin1String( "</table>\n<br><br>" );
670
671
672 // Start the contacts section
673 myMetadata += QStringLiteral( "<h1>" ) + tr( "Contacts" ) + QStringLiteral( "</h1>\n<hr>\n" );
674 myMetadata += htmlFormatter.contactsSectionHtml( );
675 myMetadata += QLatin1String( "<br><br>\n" );
676
677 // Start the links section
678 myMetadata += QStringLiteral( "<h1>" ) + tr( "Links" ) + QStringLiteral( "</h1>\n<hr>\n" );
679 myMetadata += htmlFormatter.linksSectionHtml( );
680 myMetadata += QLatin1String( "<br><br>\n" );
681
682 // Start the history section
683 myMetadata += QStringLiteral( "<h1>" ) + tr( "History" ) + QStringLiteral( "</h1>\n<hr>\n" );
684 myMetadata += htmlFormatter.historySectionHtml( );
685 myMetadata += QLatin1String( "<br><br>\n" );
686
687 myMetadata += QLatin1String( "\n</body>\n</html>\n" );
688 return myMetadata;
689}
690
692{
693 return mElevationProperties;
694}
695
697{
698 return mDataProvider ? mDataProvider->attributes() : QgsPointCloudAttributeCollection();
699}
700
702{
703 return mDataProvider ? mDataProvider->pointCount() : 0;
704}
705
707{
708 return mRenderer.get();
709}
710
712{
713 return mRenderer.get();
714}
715
717{
718 if ( renderer == mRenderer.get() )
719 return;
720
721 mRenderer.reset( renderer );
722 emit rendererChanged();
724
725 if ( mSync3DRendererTo2DRenderer )
727}
728
729bool QgsPointCloudLayer::setSubsetString( const QString &subset )
730{
731 if ( !isValid() || !mDataProvider )
732 {
733 QgsDebugMsgLevel( QStringLiteral( "invoked with invalid layer or null mDataProvider" ), 3 );
734 setCustomProperty( QStringLiteral( "storedSubsetString" ), subset );
735 return false;
736 }
737 else if ( subset == mDataProvider->subsetString() )
738 return true;
739
740 bool res = mDataProvider->setSubsetString( subset );
741 if ( res )
742 {
743 emit subsetStringChanged();
745 }
746 return res;
747}
748
750{
751 if ( !isValid() || !mDataProvider )
752 {
753 QgsDebugMsgLevel( QStringLiteral( "invoked with invalid layer or null mDataProvider" ), 3 );
754 return customProperty( QStringLiteral( "storedSubsetString" ) ).toString();
755 }
756 return mDataProvider->subsetString();
757}
758
760{
761 bool result = false;
763 if ( r )
764 {
765 result = r->convertFrom2DRenderer( renderer() );
766 setRenderer3D( r );
768 }
769 return result;
770}
771
773{
774 return mSync3DRendererTo2DRenderer;
775}
776
778{
779 mSync3DRendererTo2DRenderer = sync;
780 if ( sync )
782}
783
784void QgsPointCloudLayer::calculateStatistics()
785{
786 if ( !mDataProvider.get() || !mDataProvider->hasValidIndex() )
787 {
788 QgsMessageLog::logMessage( QObject::tr( "Failed to calculate statistics of the point cloud %1" ).arg( this->name() ) );
789 return;
790 }
791 if ( mStatsCalculationTask )
792 {
793 QgsMessageLog::logMessage( QObject::tr( "A statistics calculation task for the point cloud %1 is already in progress" ).arg( this->name() ) );
794 return;
795 }
796#ifdef HAVE_COPC
797 if ( mDataProvider && mDataProvider->index() && mDataProvider->index()->isValid() )
798 {
799 if ( QgsCopcPointCloudIndex *index = qobject_cast<QgsCopcPointCloudIndex *>( mDataProvider->index() ) )
800 {
801 mStatistics = index->readStatistics();
802 }
803 }
804#endif
805 if ( mStatistics.sampledPointsCount() != 0 )
806 {
808 emit statisticsCalculationStateChanged( mStatisticsCalculationState );
809 resetRenderer();
810 return;
811 }
812
813 QVector<QgsPointCloudAttribute> attributes = mDataProvider->attributes().attributes();
814 // Do not calculate stats for X, Y & Z since the point cloud index contains that
815 for ( int i = 0; i < attributes.size(); ++i )
816 {
817 if ( attributes[i].name() == QLatin1String( "X" ) || attributes[i].name() == QLatin1String( "Y" ) || attributes[i].name() == QLatin1String( "Z" ) )
818 {
819 attributes.remove( i );
820 --i;
821 }
822 }
823
824 QgsPointCloudStatsCalculationTask *task = new QgsPointCloudStatsCalculationTask( mDataProvider->index(), attributes, 1000000 );
825 connect( task, &QgsTask::taskCompleted, this, [this, task]()
826 {
827 mStatistics = task->calculationResults();
828
829 // fetch X, Y & Z stats directly from the index
830 QVector<QString> coordinateAttributes;
831 coordinateAttributes.push_back( QStringLiteral( "X" ) );
832 coordinateAttributes.push_back( QStringLiteral( "Y" ) );
833 coordinateAttributes.push_back( QStringLiteral( "Z" ) );
834
835 QMap<QString, QgsPointCloudAttributeStatistics> statsMap = mStatistics.statisticsMap();
836 QgsPointCloudIndex *index = mDataProvider->index();
837 for ( const QString &attribute : coordinateAttributes )
838 {
840 QVariant min = index->metadataStatistic( attribute, QgsStatisticalSummary::Min );
841 QVariant max = index->metadataStatistic( attribute, QgsStatisticalSummary::Max );
842 if ( !min.isValid() )
843 continue;
844 s.minimum = min.toDouble();
845 s.maximum = max.toDouble();
846 s.count = index->metadataStatistic( attribute, QgsStatisticalSummary::Count ).toInt();
847 s.mean = index->metadataStatistic( attribute, QgsStatisticalSummary::Mean ).toInt();
848 s.stDev = index->metadataStatistic( attribute, QgsStatisticalSummary::StDev ).toInt();
849 QVariantList classes = index->metadataClasses( attribute );
850 for ( const QVariant &c : classes )
851 {
852 s.classCount[ c.toInt() ] = index->metadataClassStatistic( attribute, c, QgsStatisticalSummary::Count ).toInt();
853 }
854 statsMap[ attribute ] = s;
855 }
856 mStatistics = QgsPointCloudStatistics( mStatistics.sampledPointsCount(), statsMap );
857 //
858
860 emit statisticsCalculationStateChanged( mStatisticsCalculationState );
861 resetRenderer();
862 mStatsCalculationTask = 0;
863#ifdef HAVE_COPC
864 if ( mDataProvider && mDataProvider->index() && mDataProvider->index()->isValid() && mDataProvider->name() == QLatin1String( "pdal" ) && mStatistics.sampledPointsCount() != 0 )
865 {
866 if ( QgsCopcPointCloudIndex *index = qobject_cast<QgsCopcPointCloudIndex *>( mDataProvider->index() ) )
867 {
868 index->writeStatistics( mStatistics );
869 }
870 }
871#endif
872 } );
873
874 // In case the statistics calculation fails, QgsTask::taskTerminated will be called
875 connect( task, &QgsTask::taskTerminated, this, [this]()
876 {
877 QgsMessageLog::logMessage( QObject::tr( "Failed to calculate statistics of the point cloud %1" ).arg( this->name() ) );
878 mStatsCalculationTask = 0;
879 } );
880
881 mStatsCalculationTask = QgsApplication::taskManager()->addTask( task );
882
884 emit statisticsCalculationStateChanged( mStatisticsCalculationState );
885}
886
887void QgsPointCloudLayer::resetRenderer()
888{
889 mDataProvider->loadIndex();
890 if ( !mLayerOptions.skipStatisticsCalculation && !mDataProvider->hasStatisticsMetadata() && statisticsCalculationState() == QgsPointCloudLayer::PointCloudStatisticsCalculationState::NotStarted )
891 {
892 calculateStatistics();
893 }
894 if ( !mRenderer || mRenderer->type() == QLatin1String( "extent" ) )
895 {
897 }
899
900 emit rendererChanged();
901}
902
903
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...
@ 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.
QString linksSectionHtml() const
Formats the "Links" section according to a metadata object.
QString extentSectionHtml(const bool showSpatialExtent=true) const
Formats the "Extents" section according to a metadata object (extent and temporal).
QString contactsSectionHtml() const
Formats the "Contacts" section according to a metadata object.
QString identificationSectionHtml() const
Formats the "Identification" section according to a metadata object.
QString historySectionHtml() const
Formats the "History" section according to a metadata object.
QString accessSectionHtml() const
Formats the "Access" section according to a metadata object.
Base class for storage of map layer elevation properties.
static QString typeToString(QgsMapLayerType 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:1927
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:1944
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:1982
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:1941
@ FlagReadExtentFromXml
Read extent from xml and skip get extent from provider.
Definition: qgsmaplayer.h:642
@ FlagTrustLayerMetadata
Trust layer metadata. Improves layer load time by skipping expensive checks like primary key unicity,...
Definition: qgsmaplayer.h:641
@ FlagDontResolveLayers
Don't resolve layer paths or create data providers for layers.
Definition: qgsmaplayer.h:640
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:1987
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:161
@ Rendering
Rendering: scale visibility, simplify method, opacity.
Definition: qgsmaplayer.h:170
@ Symbology3D
3D symbology
Definition: qgsmaplayer.h:162
@ CustomProperties
Custom properties (by plugins for instance)
Definition: qgsmaplayer.h:171
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 QgsPainting::BlendMode getBlendModeEnum(QPainter::CompositionMode blendMode)
Returns a BlendMode corresponding to a QPainter::CompositionMode.
Definition: qgspainting.cpp:80
static QPainter::CompositionMode getCompositionMode(QgsPainting::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
Definition: qgspainting.cpp:20
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer.
Definition: qgspainting.h:37
QString writePath(const QString &filename) const
Prepare a filename to save it to the project file.
QString readPath(const QString &filename) const
Turn filename read from the project file to an absolute path.
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...
QVariantMap decodeUri(const QString &providerKey, const QString &uri)
Breaks a provider data source URI into its component paths (e.g.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
QString encodeUri(const QString &providerKey, const QVariantMap &parts)
Reassembles a provider data source URI from its component paths (e.g.
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.
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.
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
QgsMapLayerType
Types of layers that can be added to a map.
Definition: qgis.h:47
@ PointCloudLayer
Point cloud layer. Added in QGIS 3.18.
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
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.