QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
21 #ifndef QGSRASTERLAYER_H
22 #define QGSRASTERLAYER_H
24 #include "qgis_core.h"
113 : loadDefaultStyle( loadDefaultStyle )
114 , transformContext( transformContext )
118 bool loadDefaultStyle =
true;
139 bool skipCrsValidation =
false;
156 const QString &baseName = QString(),
157 const QString &providerType =
"gdal",
195 static bool isValidRasterFileName(
const QString &fileNameQString, QString &retError );
198 static bool isValidRasterFileName(
const QString &fileNameQString );
201 static QDateTime lastModified(
const QString &name );
207 Q_DECL_DEPRECATED
void setDataProvider(
const QString &provider )
SIP_DEPRECATED;
293 int bandCount()
const;
298 QString bandName(
int bandNoInt )
const;
314 void reload() override;
318 void draw( QPainter *theQPainter,
325 bool isSpatial()
const override {
return true; }
333 QPixmap paletteAsPixmap(
int bandNumber = 1 );
346 double rasterUnitsPerPixelX()
const;
355 double rasterUnitsPerPixelY()
const;
370 bool generateLookupTableFlag =
true );
389 virtual QString subsetString()
const;
399 virtual bool setSubsetString(
const QString &subset );
405 bool defaultContrastEnhancementSettings(
410 void setDefaultContrastEnhancement();
417 QImage previewAsImage( QSize size,
const QColor &bgColor = Qt::white,
418 QImage::Format format = QImage::Format_ARGB32_Premultiplied );
434 bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage,
const QgsStringMap &props =
QgsStringMap() )
const;
444 bool ignoreExtents()
const;
449 void showStatusMessage(
const QString &message );
464 void subsetStringChanged();
471 bool writeSymbology( QDomNode &, QDomDocument &doc, QString &errorMessage,
473 bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage,
484 void closeDataProvider();
496 bool generateLookupTableFlag,
502 void computeMinMax(
int band,
507 double &min,
double &max );
510 const QString QSTRING_NOT_SET;
511 const QString TRSTRING_NOT_SET;
520 QDateTime mLastModified;
524 LayerType mRasterType;
529 QgsRectangle mLastRectangleUsedByRefreshContrastEnhancementIfNeeded;
531 QDomDocument mOriginalStyleDocument;
532 QDomElement mOriginalStyleElement;
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.
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.
static const QgsContrastEnhancement::ContrastEnhancementAlgorithm MULTIPLE_BAND_SINGLE_BYTE_ENHANCEMENT_ALGORITHM
Default enhancement algorithm for multiple band raster of type Byte.
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.
QString providerType() const
Returns the provider type (provider key) for this layer.
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.
virtual QgsDataProvider * dataProvider()
Returns the layer's data provider, it may be nullptr.
@ MinMax
Real min-max values.
virtual QgsMapLayerTemporalProperties * temporalProperties()
Returns the layer's temporal properties.
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...
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.
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.
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).
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.