QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsrasterlayerelevationproperties.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsrasterlayerelevationproperties.h
3 ---------------
4 begin : February 2022
5 copyright : (C) 2022 by Nyall Dawson
6 email : nyall dot dawson dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18
19#ifndef QGSRASTERLAYERELEVATIONPROPERTIES_H
20#define QGSRASTERLAYERELEVATIONPROPERTIES_H
21
22#include "qgis_core.h"
23#include "qgis_sip.h"
25#include "qgslinesymbol.h"
26
27class QgsRasterLayer;
28
37{
38
39 Q_OBJECT
40
41 public:
42
48
49 bool hasElevation() const override;
50 QDomElement writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) override;
51 bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
53 QString htmlSummary() const override;
54 bool isVisibleInZRange( const QgsDoubleRange &range, QgsMapLayer *layer = nullptr ) const override;
55 QgsDoubleRange calculateZRange( QgsMapLayer *layer ) const override;
56 QList< double > significantZValues( QgsMapLayer *layer ) const override;
57 bool showByDefaultInElevationProfilePlots() const override;
58 QgsMapLayerElevationProperties::Flags flags() const override;
59
65 bool isEnabled() const { return mEnabled; }
66
72 void setEnabled( bool enabled );
73
80 Qgis::RasterElevationMode mode() const;
81
88 void setMode( Qgis::RasterElevationMode mode );
89
97 int bandNumber() const { return mBandNumber; }
98
106 void setBandNumber( int band );
107
118 QgsDoubleRange fixedRange() const;
119
130 void setFixedRange( const QgsDoubleRange &range );
131
142 QMap<int, QgsDoubleRange> fixedRangePerBand() const;
143
154 void setFixedRangePerBand( const QMap<int, QgsDoubleRange> &ranges );
155
163 QgsDoubleRange elevationRangeForPixelValue( QgsRasterLayer *layer, int band, double pixelValue ) const;
164
173 int bandForElevationRange( QgsRasterLayer *layer, const QgsDoubleRange &range ) const;
174
180 QgsLineSymbol *profileLineSymbol() const;
181
189 void setProfileLineSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
190
196 QgsFillSymbol *profileFillSymbol() const;
197
205 void setProfileFillSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
206
212 Qgis::ProfileSurfaceSymbology profileSymbology() const { return mSymbology; }
213
219 void setProfileSymbology( Qgis::ProfileSurfaceSymbology symbology );
220
231 double elevationLimit() const;
232
243 void setElevationLimit( double limit );
244
260 static bool layerLooksLikeDem( QgsRasterLayer *layer );
261
262 private:
263
264 void setDefaultProfileLineSymbol( const QColor &color );
265 void setDefaultProfileFillSymbol( const QColor &color );
266
267 bool mEnabled = false;
268
270
271 std::unique_ptr< QgsLineSymbol > mProfileLineSymbol;
272 std::unique_ptr< QgsFillSymbol > mProfileFillSymbol;
274 double mElevationLimit = std::numeric_limits< double >::quiet_NaN();
275 int mBandNumber = 1;
276
277 QgsDoubleRange mFixedRange;
278 QMap< int, QgsDoubleRange > mRangePerBand;
279};
280
281#endif // QGSRASTERLAYERELEVATIONPROPERTIES_H
RasterElevationMode
Raster layer elevation modes.
Definition qgis.h:3783
@ RepresentsElevationSurface
Pixel values represent an elevation surface.
ProfileSurfaceSymbology
Surface symbology type for elevation profile plots.
Definition qgis.h:3942
@ Line
The elevation surface will be rendered using a line symbol.
QgsRange which stores a range of double values.
Definition qgsrange.h:231
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol type, for rendering LineString and MultiLineString geometries.
Base class for storage of map layer elevation properties.
virtual QgsMapLayerElevationProperties * clone() const =0
Creates a clone of the properties.
virtual QDomElement writeXml(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context)=0
Writes the properties to a DOM element, to be used later with readXml().
virtual bool readXml(const QDomElement &element, const QgsReadWriteContext &context)=0
Reads the elevation properties from a DOM element previously written by writeXml().
virtual bool hasElevation() const
Returns true if the layer has an elevation or z component.
Base class for all map layer types.
Definition qgsmaplayer.h:76
Raster layer specific subclass of QgsMapLayerElevationProperties.
Qgis::ProfileSurfaceSymbology profileSymbology() const
Returns the symbology option used to render the raster profile in elevation profile plots.
int bandNumber() const
Returns the band number from which the elevation should be taken.
Represents a raster layer.
The class is used as a container of context for various read/write operations on other objects.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76