mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-10-31 00:06:02 -04:00 
			
		
		
		
	Allows raster nodata pixels to be colored in a specific (non-transparent) color. Designed to match the "Display background value" option from ArcMap. Sponsored by SLYR Fixes #26087
		
			
				
	
	
		
			193 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			193 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| /************************************************************************
 | |
|  * This file has been generated automatically from                      *
 | |
|  *                                                                      *
 | |
|  * src/core/raster/qgsrasterrenderer.h                                  *
 | |
|  *                                                                      *
 | |
|  * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 | |
|  ************************************************************************/
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| class QgsRasterRenderer : QgsRasterInterface
 | |
| {
 | |
| %Docstring
 | |
| Raster renderer pipe that applies colors to a raster.
 | |
| %End
 | |
| 
 | |
| %TypeHeaderCode
 | |
| #include "qgsrasterrenderer.h"
 | |
| %End
 | |
|   public:
 | |
| 
 | |
|     static const QRgb NODATA_COLOR;
 | |
| 
 | |
|     QgsRasterRenderer( QgsRasterInterface *input = 0, const QString &type = QString() );
 | |
| %Docstring
 | |
| Constructor for QgsRasterRenderer.
 | |
| %End
 | |
|     ~QgsRasterRenderer();
 | |
| 
 | |
| 
 | |
|     virtual QgsRasterRenderer *clone() const = 0 /Factory/;
 | |
| 
 | |
| %Docstring
 | |
| QgsRasterRenderer cannot be copied. Use clone() instead.
 | |
| %End
 | |
| 
 | |
|     virtual int bandCount() const;
 | |
| 
 | |
| 
 | |
|     virtual Qgis::DataType dataType( int bandNo ) const;
 | |
| 
 | |
| 
 | |
|     virtual QString type() const;
 | |
| 
 | |
|     virtual bool setInput( QgsRasterInterface *input );
 | |
| 
 | |
| 
 | |
|      virtual QgsRasterBlock *block( int bandNo,
 | |
|                            const QgsRectangle &extent,
 | |
|                            int width,
 | |
|                            int height,
 | |
|                            QgsRasterBlockFeedback *feedback = 0 ) = 0 /Factory/;
 | |
| 
 | |
|     bool usesTransparency() const;
 | |
| 
 | |
|     void setOpacity( double opacity );
 | |
| %Docstring
 | |
| Sets the ``opacity`` for the renderer, where ``opacity`` is a value between 0 (totally transparent)
 | |
| and 1.0 (fully opaque).
 | |
| 
 | |
| .. seealso:: :py:func:`opacity`
 | |
| %End
 | |
| 
 | |
|     double opacity() const;
 | |
| %Docstring
 | |
| Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent)
 | |
| and 1.0 (fully opaque).
 | |
| 
 | |
| .. seealso:: :py:func:`setOpacity`
 | |
| %End
 | |
| 
 | |
|     QColor nodataColor() const;
 | |
| %Docstring
 | |
| Returns the color to use for shading nodata pixels.
 | |
| 
 | |
| If the returned value is an invalid color then the default transparent rendering of
 | |
| nodata values will be used.
 | |
| 
 | |
| .. seealso:: :py:func:`renderColorForNodataPixel`
 | |
| 
 | |
| .. seealso:: :py:func:`setNodataColor`
 | |
| 
 | |
| .. versionadded:: 3.12
 | |
| %End
 | |
| 
 | |
|     void setNodataColor( const QColor &color );
 | |
| %Docstring
 | |
| Sets the ``color`` to use for shading nodata pixels.
 | |
| 
 | |
| If ``color`` is an invalid color then the default transparent rendering of
 | |
| nodata values will be used.
 | |
| 
 | |
| .. seealso:: :py:func:`nodataColor`
 | |
| 
 | |
| .. versionadded:: 3.12
 | |
| %End
 | |
| 
 | |
|     void setRasterTransparency( QgsRasterTransparency *t /Transfer/ );
 | |
|     const QgsRasterTransparency *rasterTransparency() const;
 | |
| 
 | |
|     void setAlphaBand( int band );
 | |
|     int alphaBand() const;
 | |
| 
 | |
|     virtual void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems /Out/ ) const;
 | |
| %Docstring
 | |
| Gets symbology items if provided by renderer
 | |
| %End
 | |
| 
 | |
|     virtual void readXml( const QDomElement &rendererElem );
 | |
| 
 | |
| %Docstring
 | |
| Sets base class members from xml. Usually called from create() methods of subclasses
 | |
| %End
 | |
| 
 | |
|     void copyCommonProperties( const QgsRasterRenderer *other, bool copyMinMaxOrigin = true );
 | |
| %Docstring
 | |
| Copies common properties like opacity / transparency data from other renderer.
 | |
| Useful when cloning renderers.
 | |
| 
 | |
| .. versionadded:: 2.16
 | |
| %End
 | |
| 
 | |
|     virtual QList<int> usesBands() const;
 | |
| %Docstring
 | |
| Returns a list of band numbers used by the renderer
 | |
| %End
 | |
| 
 | |
|     const QgsRasterMinMaxOrigin &minMaxOrigin() const;
 | |
| %Docstring
 | |
| Returns const reference to origin of min/max values
 | |
| %End
 | |
| 
 | |
|     void setMinMaxOrigin( const QgsRasterMinMaxOrigin &origin );
 | |
| %Docstring
 | |
| Sets origin of min/max values
 | |
| %End
 | |
| 
 | |
|     virtual void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props = QgsStringMap() ) const;
 | |
| %Docstring
 | |
| Used from subclasses to create SLD Rule elements following SLD v1.0 specs
 | |
| 
 | |
| .. versionadded:: 3.6
 | |
| %End
 | |
| 
 | |
|     virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
 | |
| %Docstring
 | |
| Accepts the specified symbology ``visitor``, causing it to visit all symbols associated
 | |
| with the renderer.
 | |
| 
 | |
| Returns ``True`` if the visitor should continue visiting other objects, or ``False`` if visiting
 | |
| should be canceled.
 | |
| 
 | |
| .. versionadded:: 3.10
 | |
| %End
 | |
| 
 | |
|   protected:
 | |
| 
 | |
|     void _writeXml( QDomDocument &doc, QDomElement &rasterRendererElem ) const;
 | |
| %Docstring
 | |
| Write upper class info into rasterrenderer element (called by writeXml method of subclasses)
 | |
| %End
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|     QRgb renderColorForNodataPixel() const;
 | |
| %Docstring
 | |
| Returns the color for the renderer to use to represent nodata pixels.
 | |
| 
 | |
| Subclasses should use this rather then nodataColor() to determine the color to use for nodata pixels
 | |
| during an actual rendering operation.
 | |
| 
 | |
| .. versionadded:: 3.10
 | |
| %End
 | |
| 
 | |
|   private:
 | |
|     QgsRasterRenderer( const QgsRasterRenderer & );
 | |
|     const QgsRasterRenderer &operator=( const QgsRasterRenderer & );
 | |
| };
 | |
| 
 | |
| /************************************************************************
 | |
|  * This file has been generated automatically from                      *
 | |
|  *                                                                      *
 | |
|  * src/core/raster/qgsrasterrenderer.h                                  *
 | |
|  *                                                                      *
 | |
|  * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 | |
|  ************************************************************************/
 |