QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
21 #ifndef QGSRASTERLAYER_H
22 #define QGSRASTERLAYER_H
24 #include "qgis_core.h"
111 : loadDefaultStyle( loadDefaultStyle )
112 , transformContext( transformContext )
116 bool loadDefaultStyle =
true;
137 bool skipCrsValidation =
false;
154 const QString &baseName = QString(),
155 const QString &providerType =
"gdal",
193 static bool isValidRasterFileName(
const QString &fileNameQString, QString &retError );
196 static bool isValidRasterFileName(
const QString &fileNameQString );
199 static QDateTime lastModified(
const QString &name );
205 Q_DECL_DEPRECATED
void setDataProvider(
const QString &provider )
SIP_DEPRECATED;
214 void setDataProvider(
const QString &provider,
const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() );
310 int bandCount()
const;
315 QString bandName(
int bandNoInt )
const;
331 void reload() override;
335 void draw( QPainter *theQPainter,
342 bool isSpatial()
const override {
return true; }
350 QPixmap paletteAsPixmap(
int bandNumber = 1 );
363 double rasterUnitsPerPixelX()
const;
372 double rasterUnitsPerPixelY()
const;
386 bool generateLookupTableFlag =
true );
405 virtual QString subsetString()
const;
415 virtual bool setSubsetString(
const QString &subset );
421 bool defaultContrastEnhancementSettings(
426 void setDefaultContrastEnhancement();
434 QImage previewAsImage( QSize size,
const QColor &bgColor = Qt::white,
435 QImage::Format format = QImage::Format_ARGB32_Premultiplied );
451 bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage,
const QgsStringMap &props =
QgsStringMap() )
const;
461 bool ignoreExtents()
const;
466 void showStatusMessage(
const QString &message );
488 bool writeSymbology( QDomNode &, QDomDocument &doc, QString &errorMessage,
490 bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage,
501 void closeDataProvider();
513 bool generateLookupTableFlag,
519 void computeMinMax(
int band,
524 double &min,
double &max );
527 const QString QSTRING_NOT_SET;
528 const QString TRSTRING_NOT_SET;
537 QDateTime mLastModified;
546 QgsRectangle mLastRectangleUsedByRefreshContrastEnhancementIfNeeded;
548 QDomDocument mOriginalStyleDocument;
549 QDomElement mOriginalStyleElement;
Contains information about the context in which a coordinate transform is executed.
virtual bool writeXml(QDomNode &layer_node, QDomDocument &document, const QgsReadWriteContext &context) const
Called by writeLayerXML(), used by children to write state specific to them to project files.
Setting options for creating vector data providers.
The class is used as a container of context for various read/write operations on other objects.
QgsRasterPipe::ResamplingStage resamplingStage() const
Returns which stage of the pipe should apply resampling.
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
Limits
This enumerator describes the limits used to compute min/max values.
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 allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
virtual QStringList subLayers() const
Returns the sublayers of this layer.
static const double SAMPLE_SIZE
Default sample size (number of pixels) for estimated statistics/histogram calculation.
DrawingStyle
This enumerator describes the different kinds of drawing we can do.
Base class for processing modules.
Contains information about the context of a rendering operation.
An interface for classes which can visit style entity (e.g.
void subsetStringChanged()
Emitted when the layer's subset string has changed.
static const QgsContrastEnhancement::ContrastEnhancementAlgorithm MULTIPLE_BAND_SINGLE_BYTE_ENHANCEMENT_ALGORITHM
Default enhancement algorithm for multiple band raster of type Byte.
This class provides details of the viewable area that a raster will be rendered into.
virtual QString htmlMetadata() const
Obtain a formatted HTML string containing assorted metadata for this layer.
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the layer.
LayerOptions(bool loadDefaultStyle=true, const QgsCoordinateTransformContext &transformContext=QgsCoordinateTransformContext())
Constructor for LayerOptions.
static const QgsContrastEnhancement::ContrastEnhancementAlgorithm SINGLE_BAND_ENHANCEMENT_ALGORITHM
Default enhancement algorithm for single band raster.
static const QgsRasterMinMaxOrigin::Limits MULTIPLE_BAND_MULTI_BYTE_MIN_MAX_LIMITS
Default enhancement limits for multiple band raster of type different from Byte.
A rectangle specified with double values.
Implementation of map layer temporal properties for raster layers.
Base class for utility classes that encapsulate information necessary for rendering of map layers.
QString providerType() const
Returns the provider type (provider key) for this layer.
This class describes the origin of min/max values.
virtual void setSubLayerVisibility(const QString &name, bool visible)
Set the visibility of the given sublayer name.
virtual QString encodedSource(const QString &source, const QgsReadWriteContext &context) const
Called by writeLayerXML(), used by derived classes to encode provider's specific data source to proje...
ContrastEnhancementAlgorithm
This enumerator describes the types of contrast enhancement algorithms that can be used.
@ MinMax
Real min-max values.
Raster renderer pipe that applies colors to a raster.
virtual QgsMapLayerTemporalProperties * temporalProperties()
Returns the layer's temporal properties.
Base class for storage of map layer temporal properties.
Color and saturation filter pipe for rasters.
LayerType
This enumerator describes the type of raster layer.
ColorShadingAlgorithm
This enumerator describes the types of shading that can be used.
virtual QString decodedSource(const QString &source, const QString &dataProvider, const QgsReadWriteContext &context) const
Called by readLayerXML(), used by derived classes to decode provider's specific data source from proj...
Represents a raster layer.
virtual void setTransformContext(const QgsCoordinateTransformContext &transformContext)=0
Sets the coordinate transform context to transformContext.
QgsRasterResampleFilter * resampleFilter() const
Returns the raster's resample filter.
virtual bool readSymbology(const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories)=0
Read the symbology for the current layer from the DOM node supplied.
virtual void setDataSource(const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, bool loadDefaultStyleFlag=false)
Updates the data source of the layer.
Setting options for loading raster layers.
QMap< QString, QString > QgsStringMap
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const =0
Write the style for the layer into the docment provided.
Brightness/contrast and gamma correction filter pipe for rasters.
Perform transforms between map coordinates and device coordinates.
QgsRasterPipe * pipe()
Returns the raster pipe.
static const QgsContrastEnhancement::ContrastEnhancementAlgorithm MULTIPLE_BAND_MULTI_BYTE_ENHANCEMENT_ALGORITHM
Default enhancement algorithm for multiple band raster of type different from Byte.
Base class for all map layer types.
Resample filter pipe for rasters.
static const QgsRasterMinMaxOrigin::Limits SINGLE_BAND_MIN_MAX_LIMITS
Default enhancement limits for single band raster.
virtual bool readXml(const QDomNode &layer_node, QgsReadWriteContext &context)
Called by readLayerXML(), used by children to read state specific to them from project files.
QgsHueSaturationFilter * hueSaturationFilter() const
Returns the raster's hue/saturation filter.
QList< QPair< QString, QColor > > QgsLegendColorList
QgsBrightnessContrastFilter * brightnessFilter() const
Returns the raster's brightness/contrast filter.
static const QgsRasterMinMaxOrigin::Limits MULTIPLE_BAND_SINGLE_BYTE_MIN_MAX_LIMITS
Default enhancement limits for multiple band raster of type Byte.
virtual bool readStyle(const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories)
Read the style for the current layer from the DOM node supplied.
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
LayerType rasterType()
Returns the raster layer type (which is a read only property).
ResamplingStage
Stage at which resampling occurs.
Base class for raster data providers.
virtual QgsDataProvider * dataProvider()
Returns the layer's data provider, it may be nullptr.
virtual bool writeStyle(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const
Write just the symbology information for the layer into the document.
virtual QDateTime timestamp() const
Time stamp of data source in the moment when data/metadata were loaded by provider.
virtual void setLayerOrder(const QStringList &layers)
Reorders the previously selected sublayers of this layer from bottom to top.