49 const QString &baseName,
50 const QString &providerLib,
54 , mLayerOptions( options )
56 if ( !uri.isEmpty() && !providerLib.isEmpty() )
59 QgsDataProvider::ReadFlags providerFlags = QgsDataProvider::ReadFlags();
64 setDataSource( uri, baseName, providerLib, providerOptions, providerFlags );
87 layer->mElevationProperties = mElevationProperties->
clone();
88 layer->mElevationProperties->setParent( layer );
90 layer->mLayerOptions = mLayerOptions;
91 layer->mSync3DRendererTo2DRenderer = mSync3DRendererTo2DRenderer;
101 return mDataProvider->extent();
116 return mDataProvider.get();
121 return mDataProvider.get();
127 const QDomNode pkeyNode = layerNode.namedItem( QStringLiteral(
"provider" ) );
133 QgsDataProvider::ReadFlags
flags = QgsDataProvider::ReadFlags();
137 const QDomNode extentNode = layerNode.namedItem( QStringLiteral(
"extent" ) );
138 if ( !extentNode.isNull() )
155 const QDomNode subset = layerNode.namedItem( QStringLiteral(
"subset" ) );
156 const QString subsetText = subset.toElement().text();
157 if ( !subsetText.isEmpty() )
176 QDomElement mapLayerNode = layerNode.toElement();
181 QDomElement subset = doc.createElement( QStringLiteral(
"subset" ) );
182 const QDomText subsetText = doc.createTextNode(
subsetString() );
183 subset.appendChild( subsetText );
184 layerNode.appendChild( subset );
188 QDomElement provider = doc.createElement( QStringLiteral(
"provider" ) );
189 const QDomText providerText = doc.createTextNode(
providerType() );
190 provider.appendChild( providerText );
191 layerNode.appendChild( provider );
202 const QDomElement elem = node.toElement();
206 readStyle( node, errorMessage, context, categories );
221 bool sync = node.attributes().namedItem( QStringLiteral(
"sync3DRendererTo2DRenderer" ) ).nodeValue().toInt( &ok );
228 QDomElement rendererElement = node.firstChildElement( QStringLiteral(
"renderer" ) );
229 if ( !rendererElement.isNull() )
251 const QDomNode blendModeNode = node.namedItem( QStringLiteral(
"blendMode" ) );
252 if ( !blendModeNode.isNull() )
254 const QDomElement e = blendModeNode.toElement();
262 const QDomNode layerOpacityNode = node.namedItem( QStringLiteral(
"layerOpacity" ) );
263 if ( !layerOpacityNode.isNull() )
265 const QDomElement e = layerOpacityNode.toElement();
269 const bool hasScaleBasedVisibiliy { node.attributes().namedItem( QStringLiteral(
"hasScaleBasedVisibilityFlag" ) ).nodeValue() ==
'1' };
272 const double maxScale { node.attributes().namedItem( QStringLiteral(
"maxScale" ) ).nodeValue().toDouble( &ok ) };
277 const double minScale { node.attributes().namedItem( QStringLiteral(
"minScale" ) ).nodeValue().toDouble( &ok ) };
289 Q_UNUSED( errorMessage )
291 QDomElement elem = node.toElement();
294 ( void )
writeStyle( node, doc, errorMessage, context, categories );
301 QDomElement mapLayerNode = node.toElement();
305 mapLayerNode.setAttribute( QStringLiteral(
"sync3DRendererTo2DRenderer" ), mSync3DRendererTo2DRenderer ? 1 : 0 );
312 const QDomElement rendererElement = mRenderer->save( doc, context );
313 node.appendChild( rendererElement );
326 QDomElement blendModeElem = doc.createElement( QStringLiteral(
"blendMode" ) );
328 blendModeElem.appendChild( blendModeText );
329 node.appendChild( blendModeElem );
335 QDomElement layerOpacityElem = doc.createElement( QStringLiteral(
"layerOpacity" ) );
336 const QDomText layerOpacityText = doc.createTextNode( QString::number(
opacity() ) );
337 layerOpacityElem.appendChild( layerOpacityText );
338 node.appendChild( layerOpacityElem );
340 mapLayerNode.setAttribute( QStringLiteral(
"hasScaleBasedVisibilityFlag" ),
hasScaleBasedVisibility() ? 1 : 0 );
341 mapLayerNode.setAttribute( QStringLiteral(
"maxScale" ),
maximumScale() );
342 mapLayerNode.setAttribute( QStringLiteral(
"minScale" ),
minimumScale() );
354void QgsPointCloudLayer::setDataSourcePrivate(
const QString &dataSource,
const QString &baseName,
const QString &provider,
368 if ( !mDataProvider )
370 QgsDebugMsg( QStringLiteral(
"Unable to get point cloud data provider" ) );
375 mDataProvider->setParent(
this );
376 QgsDebugMsgLevel( QStringLiteral(
"Instantiated the point cloud data provider plugin" ), 2 );
378 setValid( mDataProvider->isValid() );
381 QgsDebugMsg( QStringLiteral(
"Invalid point cloud provider plugin %1" ).arg( QString(
mDataSource.toUtf8() ) ) );
390 setCrs( mDataProvider->crs() );
396 bool loadDefaultStyleFlag =
false;
399 loadDefaultStyleFlag =
true;
402 if ( !mLayerOptions.
skipIndexGeneration && mDataProvider && mDataProvider->indexingState() != QgsPointCloudDataProvider::PointCloudIndexGenerationState::Indexed )
404 mDataProvider->generateIndex();
407 if ( !mLayerOptions.
skipStatisticsCalculation && mDataProvider && !mDataProvider->hasStatisticsMetadata() && mDataProvider->indexingState() == QgsPointCloudDataProvider::PointCloudIndexGenerationState::Indexed )
409 calculateStatistics();
416 mStatistics = mDataProvider->metadataStatistics();
419 if ( !mRenderer || loadDefaultStyleFlag )
421 std::unique_ptr< QgsScopedRuntimeProfile > profile;
423 profile = std::make_unique< QgsScopedRuntimeProfile >( tr(
"Load layer style" ), QStringLiteral(
"projectload" ) );
425 bool defaultLoadedFlag =
false;
430 std::unique_ptr< QgsPointCloudRenderer > defaultRenderer( mDataProvider->createRenderer() );
431 if ( defaultRenderer )
433 defaultLoadedFlag =
true;
438 if ( !defaultLoadedFlag && loadDefaultStyleFlag )
443 if ( !defaultLoadedFlag )
454 if ( parts.contains( QStringLiteral(
"path" ) ) )
456 parts.insert( QStringLiteral(
"path" ), context.
pathResolver().
writePath( parts.value( QStringLiteral(
"path" ) ).toString() ) );
468 if ( parts.contains( QStringLiteral(
"path" ) ) )
470 parts.insert( QStringLiteral(
"path" ), context.
pathResolver().
readPath( parts.value( QStringLiteral(
"path" ) ).toString() ) );
490 QgsError providerError = mDataProvider->error();
491 if ( !providerError.
isEmpty() )
509 std::unique_ptr< QgsPointCloudRenderer > defaultRenderer( mDataProvider->createRenderer() );
510 if ( defaultRenderer )
524 QString myMetadata = QStringLiteral(
"<html>\n<body>\n" );
529 myMetadata += QStringLiteral(
"<h1>" ) + tr(
"Information from provider" ) + QStringLiteral(
"</h1>\n<hr>\n" );
530 myMetadata += QLatin1String(
"<table class=\"list-view\">\n" );
533 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Extent" ) + QStringLiteral(
"</td><td>" ) +
extent().
toString() + QStringLiteral(
"</td></tr>\n" );
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>" );
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();
552 if ( originalMetadata.value( QStringLiteral(
"creation_year" ) ).toInt() > 0 && originalMetadata.contains( QStringLiteral(
"creation_doy" ) ) )
554 QDate creationDate( originalMetadata.value( QStringLiteral(
"creation_year" ) ).toInt(), 1, 1 );
555 creationDate = creationDate.addDays( originalMetadata.value( QStringLiteral(
"creation_doy" ) ).toInt() );
557 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" )
558 + tr(
"Creation date" ) + QStringLiteral(
"</td><td>" )
559 + creationDate.toString( Qt::ISODate )
560 + QStringLiteral(
"</td></tr>\n" );
562 if ( originalMetadata.contains( QStringLiteral(
"major_version" ) ) && originalMetadata.contains( QStringLiteral(
"minor_version" ) ) )
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" );
571 if ( !originalMetadata.value( QStringLiteral(
"dataformat_id" ) ).toString().isEmpty() )
573 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" )
574 + tr(
"Data format" ) + QStringLiteral(
"</td><td>" )
576 originalMetadata.value( QStringLiteral(
"dataformat_id" ) ).toString() ).trimmed()
577 + QStringLiteral(
"</td></tr>\n" );
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" );
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" );
606 if ( !originalMetadata.value( QStringLiteral(
"project_id" ) ).toString().isEmpty() )
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" );
614 if ( !originalMetadata.value( QStringLiteral(
"system_id" ) ).toString().isEmpty() )
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" );
622 if ( !originalMetadata.value( QStringLiteral(
"software_id" ) ).toString().isEmpty() )
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" );
631 myMetadata += QLatin1String(
"</table>\n<br><br>" );
634 myMetadata += QStringLiteral(
"<h1>" ) + tr(
"Identification" ) + QStringLiteral(
"</h1>\n<hr>\n" );
636 myMetadata += QLatin1String(
"<br><br>\n" );
639 myMetadata += QStringLiteral(
"<h1>" ) + tr(
"Extent" ) + QStringLiteral(
"</h1>\n<hr>\n" );
641 myMetadata += QLatin1String(
"<br><br>\n" );
644 myMetadata += QStringLiteral(
"<h1>" ) + tr(
"Access" ) + QStringLiteral(
"</h1>\n<hr>\n" );
646 myMetadata += QLatin1String(
"<br><br>\n" );
649 myMetadata += QStringLiteral(
"<h1>" ) + tr(
"Attributes" ) + QStringLiteral(
"</h1>\n<hr>\n<table class=\"list-view\">\n" );
654 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Count" ) + QStringLiteral(
"</td><td>" ) + QString::number( attrs.
count() ) + QStringLiteral(
"</td></tr>\n" );
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" );
659 for (
int i = 0; i < attrs.
count(); ++i )
664 rowClass = QStringLiteral(
"class=\"odd-row\"" );
665 myMetadata += QLatin1String(
"<tr " ) + rowClass + QLatin1String(
"><td>" ) + attribute.
name() + QLatin1String(
"</td><td>" ) + attribute.
displayType() + QLatin1String(
"</td></tr>\n" );
669 myMetadata += QLatin1String(
"</table>\n<br><br>" );
673 myMetadata += QStringLiteral(
"<h1>" ) + tr(
"Contacts" ) + QStringLiteral(
"</h1>\n<hr>\n" );
675 myMetadata += QLatin1String(
"<br><br>\n" );
678 myMetadata += QStringLiteral(
"<h1>" ) + tr(
"Links" ) + QStringLiteral(
"</h1>\n<hr>\n" );
680 myMetadata += QLatin1String(
"<br><br>\n" );
683 myMetadata += QStringLiteral(
"<h1>" ) + tr(
"History" ) + QStringLiteral(
"</h1>\n<hr>\n" );
685 myMetadata += QLatin1String(
"<br><br>\n" );
687 myMetadata += QLatin1String(
"\n</body>\n</html>\n" );
693 return mElevationProperties;
703 return mDataProvider ? mDataProvider->pointCount() : 0;
708 return mRenderer.get();
713 return mRenderer.get();
725 if ( mSync3DRendererTo2DRenderer )
731 if ( !
isValid() || !mDataProvider )
733 QgsDebugMsgLevel( QStringLiteral(
"invoked with invalid layer or null mDataProvider" ), 3 );
737 else if ( subset == mDataProvider->subsetString() )
740 bool res = mDataProvider->setSubsetString( subset );
751 if ( !
isValid() || !mDataProvider )
753 QgsDebugMsgLevel( QStringLiteral(
"invoked with invalid layer or null mDataProvider" ), 3 );
754 return customProperty( QStringLiteral(
"storedSubsetString" ) ).toString();
756 return mDataProvider->subsetString();
774 return mSync3DRendererTo2DRenderer;
779 mSync3DRendererTo2DRenderer = sync;
784void QgsPointCloudLayer::calculateStatistics()
786 if ( !mDataProvider.get() || !mDataProvider->hasValidIndex() )
791 if ( mStatsCalculationTask )
793 QgsMessageLog::logMessage( QObject::tr(
"A statistics calculation task for the point cloud %1 is already in progress" ).arg( this->
name() ) );
797 if ( mDataProvider && mDataProvider->index() && mDataProvider->index()->isValid() )
799 if ( QgsCopcPointCloudIndex *index = qobject_cast<QgsCopcPointCloudIndex *>( mDataProvider->index() ) )
801 mStatistics = index->readStatistics();
813 QVector<QgsPointCloudAttribute>
attributes = mDataProvider->attributes().attributes();
824 QgsPointCloudStatsCalculationTask *task =
new QgsPointCloudStatsCalculationTask( mDataProvider->index(),
attributes, 1000000 );
827 mStatistics = task->calculationResults();
830 QVector<QString> coordinateAttributes;
831 coordinateAttributes.push_back( QStringLiteral(
"X" ) );
832 coordinateAttributes.push_back( QStringLiteral(
"Y" ) );
833 coordinateAttributes.push_back( QStringLiteral(
"Z" ) );
835 QMap<QString, QgsPointCloudAttributeStatistics> statsMap = mStatistics.
statisticsMap();
837 for (
const QString &attribute : coordinateAttributes )
842 if ( !min.isValid() )
850 for (
const QVariant &
c : classes )
854 statsMap[ attribute ] = s;
862 mStatsCalculationTask = 0;
864 if ( mDataProvider && mDataProvider->index() && mDataProvider->index()->isValid() && mDataProvider->name() == QLatin1String(
"pdal" ) && mStatistics.
sampledPointsCount() != 0 )
866 if ( QgsCopcPointCloudIndex *index = qobject_cast<QgsCopcPointCloudIndex *>( mDataProvider->index() ) )
868 index->writeStatistics( mStatistics );
878 mStatsCalculationTask = 0;
887void QgsPointCloudLayer::resetRenderer()
889 mDataProvider->loadIndex();
892 calculateStatistics();
894 if ( !mRenderer || mRenderer->type() == QLatin1String(
"extent" ) )
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).
bool isEmpty() const
Test if any error is set.
QString summary() const
Short error description, usually the first error in chain, the real error.
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.
void readStyleManager(const QDomNode &layerNode)
Read style manager's configuration (if any). To be called by subclasses.
virtual bool isSpatial() const
Returns true if the layer is considered a spatial layer, ie it has some form of geometry associated w...
QgsAbstract3DRenderer * renderer3D() const
Returns 3D renderer associated with the layer.
void setError(const QgsError &error)
Sets error message.
void writeStyleManager(QDomNode &layerNode, QDomDocument &doc) const
Write style manager's configuration (if exists). To be called by subclasses.
QString source() const
Returns the source for the layer.
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
QString providerType() const
Returns the provider type (provider key) for this layer.
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.
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
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)
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.
QString mDataSource
Data source description string, varies by layer type.
@ FlagReadExtentFromXml
Read extent from xml and skip get extent from provider.
@ FlagTrustLayerMetadata
Trust layer metadata. Improves layer load time by skipping expensive checks like primary key unicity,...
@ FlagDontResolveLayers
Don't resolve layer paths or create data providers for layers.
void setValid(bool valid)
Sets whether layer is valid or not.
void readCommonStyle(const QDomElement &layerElement, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories)
Read style data common to all layer types.
QgsMapLayer::ReadFlags mReadFlags
Read flags. It's up to the subclass to respect these when restoring state from XML.
void setDataSource(const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag=false)
Updates the data source of the layer.
double minimumScale() const
Returns the minimum map scale (i.e.
void setLegend(QgsMapLayerLegend *legend)
Assign a legend controller to the map layer.
@ Rendering
Rendering: scale visibility, simplify method, opacity.
@ Symbology3D
3D symbology
@ CustomProperties
Custom properties (by plugins for instance)
void setRenderer3D(QgsAbstract3DRenderer *renderer)
Sets 3D renderer for the layer.
QString 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.
static QPainter::CompositionMode getCompositionMode(QgsPainting::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer.
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.
~QgsPointCloudLayer() override
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.
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)
QgsMapLayerType
Types of layers that can be added to a map.
@ 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)
Setting options for creating vector data providers.
Class used to store statistics of one attribute of a point cloud dataset.
QMap< int, int > classCount
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.