29 QObject::tr(
"Extent Only" ),
32 QObject::tr(
"Attribute by Ramp" ),
38 QObject::tr(
"Classification" ),
44 qDeleteAll( mRenderers );
49 if ( !metadata || mRenderers.contains( metadata->
name() ) )
52 mRenderers[metadata->
name()] = metadata;
53 mRenderersOrder << metadata->
name();
59 if ( !mRenderers.contains( rendererName ) )
62 delete mRenderers[rendererName];
63 mRenderers.remove( rendererName );
64 mRenderersOrder.removeAll( rendererName );
70 return mRenderers.value( rendererName );
75 QStringList renderers;
76 for (
const QString &renderer : mRenderersOrder )
80 renderers << renderer;
90 if ( ( provider->
name() == QLatin1String(
"pdal" ) ) && ( !provider->
hasValidIndex() ) )
99 if ( attributes.
indexOf( QLatin1String(
"Red" ) ) >= 0 && attributes.
indexOf( QLatin1String(
"Green" ) ) >= 0 && attributes.
indexOf( QLatin1String(
"Blue" ) ) >= 0 )
101 std::unique_ptr< QgsPointCloudRgbRenderer > renderer = std::make_unique< QgsPointCloudRgbRenderer >();
107 if ( redMax.isValid() && greenMax.isValid() && blueMax.isValid() )
109 const int maxValue = std::max( blueMax.toInt(), std::max( redMax.toInt(), greenMax.toInt() ) );
121 const int rangeGuess = maxValue > 255 ? 65535 : 255;
123 if ( rangeGuess > 255 )
138 return renderer.release();
142 if ( attributes.
indexOf( QLatin1String(
"Classification" ) ) >= 0 )
145 QVariantList classes = provider->
metadataClasses( QStringLiteral(
"Classification" ) );
147 classes.removeAll( 0 );
148 classes.removeAll( 1 );
149 if ( !classes.empty() )
151 std::unique_ptr< QgsPointCloudClassifiedRenderer > renderer = std::make_unique< QgsPointCloudClassifiedRenderer >();
152 renderer->setAttribute( QStringLiteral(
"Classification" ) );
153 return renderer.release();
158 std::unique_ptr< QgsPointCloudAttributeByRampRenderer > renderer = std::make_unique< QgsPointCloudAttributeByRampRenderer >();
159 renderer->setAttribute( QStringLiteral(
"Z" ) );
164 if ( zMin.isValid() && zMax.isValid() )
166 renderer->setMinimum( zMin.toDouble() );
167 renderer->setMaximum( zMax.toDouble() );
173 renderer->setColorRampShader( shader );
175 return renderer.release();
@ UnknownDataType
Unknown or unspecified type.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
void classifyColorRamp(int classes=0, int band=-1, const QgsRectangle &extent=QgsRectangle(), QgsRasterInterface *input=nullptr)
Classify color ramp shader.
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
@ StretchToMinimumMaximum
Linear histogram.
void setMinimumValue(double value, bool generateTable=true)
Sets the minimum value for the contrast enhancement range.
void setContrastEnhancementAlgorithm(ContrastEnhancementAlgorithm algorithm, bool generateTable=true)
Sets the contrast enhancement algorithm.
void setMaximumValue(double value, bool generateTable=true)
Sets the maximum value for the contrast enhancement range.
virtual QString name() const =0
Returns a provider name.
An RGB renderer for 2d visualisation of point clouds using embedded red, green and blue attributes.
static QgsPointCloudRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Creates an RGB renderer from an XML element.
Collection of point cloud attributes.
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 RGB renderer from an XML element.
Base class for providing data for QgsPointCloudLayer.
virtual QgsPointCloudAttributeCollection attributes() const =0
Returns the attributes available from this data provider.
virtual QVariant metadataStatistic(const QString &attribute, QgsStatisticalSummary::Statistic statistic) const
Returns a statistic for the specified attribute, taken only from the metadata of the point cloud data...
bool hasValidIndex() const
Returns whether provider has index which is valid.
virtual QVariantList metadataClasses(const QString &attribute) const
Returns a list of existing classes which are present for the specified attribute, taken only from the...
A renderer for 2d visualisation of point clouds which shows the dataset's extents using a fill symbol...
static QgsPointCloudRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Creates an extent renderer from an XML element.
QgsPointCloudRendererRegistry()
static QgsPointCloudRenderer * defaultRenderer(const QgsPointCloudDataProvider *provider)
Returns a new default point cloud renderer for a layer with the specified provider.
QgsPointCloudRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
bool addRenderer(QgsPointCloudRendererAbstractMetadata *metadata)
Adds a renderer to the registry.
~QgsPointCloudRendererRegistry()
bool removeRenderer(const QString &rendererName)
Removes a renderer from registry.
QStringList renderersList() const
Returns a list of available renderers.
Abstract base class for 2d point cloud renderers.
static QgsPointCloudRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Creates an RGB renderer from an XML element.
virtual void setMaximumValue(double value)
Sets the maximum value for the raster shader.
virtual void setMinimumValue(double value)
Sets the minimum value for the raster shader.
A rectangle specified with double values.