QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
31 QObject::tr(
"Extent Only" ),
34 QObject::tr(
"Attribute by Ramp" ),
40 QObject::tr(
"Classification" ),
46 qDeleteAll( mRenderers );
51 if ( !metadata || mRenderers.contains( metadata->
name() ) )
54 mRenderers[metadata->
name()] = metadata;
55 mRenderersOrder << metadata->
name();
61 if ( !mRenderers.contains( rendererName ) )
64 delete mRenderers[rendererName];
65 mRenderers.remove( rendererName );
66 mRenderersOrder.removeAll( rendererName );
72 return mRenderers.value( rendererName );
77 QStringList renderers;
78 for (
const QString &renderer : mRenderersOrder )
82 renderers << renderer;
95 if ( ( provider->
name() == QLatin1String(
"pdal" ) ) && ( !provider->
hasValidIndex() ) )
110 if ( attributes.
indexOf( QLatin1String(
"Red" ) ) >= 0 && attributes.
indexOf( QLatin1String(
"Green" ) ) >= 0 && attributes.
indexOf( QLatin1String(
"Blue" ) ) >= 0 )
112 std::unique_ptr< QgsPointCloudRgbRenderer > renderer = std::make_unique< QgsPointCloudRgbRenderer >();
115 const double redMax = stats.
maximum( QStringLiteral(
"Red" ) );
116 const double greenMax = stats.
maximum( QStringLiteral(
"Red" ) );
117 const double blueMax = stats.
maximum( QStringLiteral(
"Red" ) );
118 if ( !std::isnan( redMax ) && !std::isnan( greenMax ) && !std::isnan( blueMax ) )
120 const int maxValue = std::max( blueMax, std::max( redMax, greenMax ) );
132 const int rangeGuess = maxValue > 255 ? 65535 : 255;
134 if ( rangeGuess > 255 )
159 return renderer.release();
163 if ( attributes.
indexOf( QLatin1String(
"Classification" ) ) >= 0 )
166 QList<int> classes = stats.
classesOf( QStringLiteral(
"Classification" ) );
168 classes.removeAll( 0 );
169 classes.removeAll( 1 );
170 if ( !classes.empty() )
173 std::unique_ptr< QgsPointCloudClassifiedRenderer > renderer = std::make_unique< QgsPointCloudClassifiedRenderer >( QLatin1String(
"Classification" ), categories );
174 return renderer.release();
179 std::unique_ptr< QgsPointCloudAttributeByRampRenderer > renderer = std::make_unique< QgsPointCloudAttributeByRampRenderer >();
180 renderer->setAttribute( QStringLiteral(
"Z" ) );
183 const double zMin = stats.
minimum( QStringLiteral(
"Z" ) );
184 const double zMax = stats.
maximum( QStringLiteral(
"Z" ) );
185 if ( !std::isnan( zMin ) && !std::isnan( zMax ) )
187 renderer->setMinimum( zMin );
188 renderer->setMaximum( zMax );
194 renderer->setColorRampShader( shader );
196 return renderer.release();
205 const QList<int> layerClasses = stats.
classesOf( QStringLiteral(
"Classification" ) );
209 for (
const int &layerClass : layerClasses )
static QgsPointCloudRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Creates an RGB renderer from an XML element.
static QgsPointCloudCategoryList defaultCategories()
Returns the default list of categories.
QColor fetchRandomStyleColor() const
Returns a random color for use with a new symbol style (e.g.
void setContrastEnhancementAlgorithm(ContrastEnhancementAlgorithm algorithm, bool generateTable=true)
Sets the contrast enhancement algorithm.
@ Calculating
The statistics calculation task is running.
const QgsPointCloudStatistics statistics() const
Returns the object containing statistics.
Represents a map layer supporting display of point clouds.
void setMinimumValue(double value, bool generateTable=true)
Sets the minimum value for the contrast enhancement range.
static QgsPointCloudRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Creates an RGB renderer from an XML element.
QList< QgsPointCloudCategory > QgsPointCloudCategoryList
A renderer for 2d visualisation of point clouds which shows the dataset's extents using a fill symbol...
void classifyColorRamp(int classes=0, int band=-1, const QgsRectangle &extent=QgsRectangle(), QgsRasterInterface *input=nullptr)
Classify color ramp shader.
static QgsColorSchemeRegistry * colorSchemeRegistry()
Returns the application's color scheme registry, used for managing color schemes.
Represents an individual category (class) from a QgsPointCloudClassifiedRenderer.
Class used to store statistics of a point cloud dataset.
QgsPointCloudRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
A rectangle specified with double values.
double maximum(const QString &attribute) const
Returns the maximum value for the attribute attribute If no matching statistic is available then NaN ...
virtual QgsPointCloudAttributeCollection attributes() const =0
Returns the attributes available from this data provider.
bool removeRenderer(const QString &rendererName)
Removes a renderer from registry.
static QgsPointCloudRenderer * defaultRenderer(const QgsPointCloudLayer *layer)
Returns a new default point cloud renderer for a specified layer.
QgsPointCloudRendererRegistry()
QgsPointCloudDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
QList< int > classesOf(const QString &attribute) const
Returns a list of existing classes which are present for the specified attribute.
@ StretchToMinimumMaximum
Linear histogram.
bool hasValidIndex() const
Returns whether provider has index which is valid.
Collection of point cloud attributes.
virtual void setMaximumValue(double value)
Sets the maximum value for the raster shader.
@ UnknownDataType
Unknown or unspecified type.
static QgsPointCloudRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Creates an RGB renderer from an XML element.
An RGB renderer for 2d visualisation of point clouds using embedded red, green and blue attributes.
QStringList renderersList() const
Returns a list of available renderers.
static QgsPointCloudCategoryList classificationAttributeCategories(const QgsPointCloudLayer *layer)
Returns a list of categories using the available Classification classes of a specified layer,...
@ UInt16
Sixteen bit unsigned integer (quint16)
Base class for providing data for QgsPointCloudLayer.
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
int indexOf(const QString &name) const
Returns the index of the attribute with the specified name.
static QgsPointCloudRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Creates an extent renderer from an XML element.
double minimum(const QString &attribute) const
Returns the minimum value for the attribute attribute If no matching statistic is available then NaN ...
Abstract base class for 2d point cloud renderers.
virtual QString name() const =0
Returns a provider name.
PointCloudStatisticsCalculationState statisticsCalculationState() const
Returns the status of point cloud statistics calculation.
static QMap< int, QString > translatedLasClassificationCodes()
Returns the map of LAS classification code to translated string value, corresponding to the ASPRS Sta...
bool addRenderer(QgsPointCloudRendererAbstractMetadata *metadata)
Adds a renderer to the registry.
void setMaximumValue(double value, bool generateTable=true)
Sets the maximum value for the contrast enhancement range.
~QgsPointCloudRendererRegistry()
virtual void setMinimumValue(double value)
Sets the minimum value for the raster shader.