QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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"
24#include "qgslinesymbol.h"
26
27class QgsRasterLayer;
28
37{
38 Q_OBJECT
39
40 public:
46
47 bool hasElevation() const override;
48 QDomElement writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) override;
49 bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
51 QString htmlSummary() const override;
52 bool isVisibleInZRange( const QgsDoubleRange &range, QgsMapLayer *layer = nullptr ) const override;
53 QgsDoubleRange calculateZRange( QgsMapLayer *layer ) const override;
54 QList< double > significantZValues( QgsMapLayer *layer ) const override;
55 bool showByDefaultInElevationProfilePlots() const override;
57
63 bool isEnabled() const { return mEnabled; }
64
70 void setEnabled( bool enabled );
71
78 Qgis::RasterElevationMode mode() const;
79
86 void setMode( Qgis::RasterElevationMode mode );
87
95 int bandNumber() const { return mBandNumber; }
96
104 void setBandNumber( int band );
105
116 QgsDoubleRange fixedRange() const;
117
128 void setFixedRange( const QgsDoubleRange &range );
129
140 QMap<int, QgsDoubleRange> fixedRangePerBand() const;
141
152 void setFixedRangePerBand( const QMap<int, QgsDoubleRange> &ranges );
153
161 QgsDoubleRange elevationRangeForPixelValue( QgsRasterLayer *layer, int band, double pixelValue ) const;
162
171 int bandForElevationRange( QgsRasterLayer *layer, const QgsDoubleRange &range ) const;
172
178 QgsLineSymbol *profileLineSymbol() const;
179
187 void setProfileLineSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
188
194 QgsFillSymbol *profileFillSymbol() const;
195
203 void setProfileFillSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
204
210 Qgis::ProfileSurfaceSymbology profileSymbology() const { return mSymbology; }
211
217 void setProfileSymbology( Qgis::ProfileSurfaceSymbology symbology );
218
229 double elevationLimit() const;
230
241 void setElevationLimit( double limit );
242
258 static bool layerLooksLikeDem( QgsRasterLayer *layer );
259
260 private:
261 void setDefaultProfileLineSymbol( const QColor &color );
262 void setDefaultProfileFillSymbol( const QColor &color );
263
264 bool mEnabled = false;
265
267
268 std::unique_ptr< QgsLineSymbol > mProfileLineSymbol;
269 std::unique_ptr< QgsFillSymbol > mProfileFillSymbol;
271 double mElevationLimit = std::numeric_limits< double >::quiet_NaN();
272 int mBandNumber = 1;
273
274 QgsDoubleRange mFixedRange;
275 QMap< int, QgsDoubleRange > mRangePerBand;
276};
277
278#endif // QGSRASTERLAYERELEVATIONPROPERTIES_H
RasterElevationMode
Raster layer elevation modes.
Definition qgis.h:4138
@ RepresentsElevationSurface
Pixel values represent an elevation surface.
Definition qgis.h:4140
ProfileSurfaceSymbology
Surface symbology type for elevation profile plots.
Definition qgis.h:4322
@ Line
The elevation surface will be rendered using a line symbol.
Definition qgis.h:4323
QgsRange which stores a range of double values.
Definition qgsrange.h:217
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol type, for rendering LineString and MultiLineString geometries.
virtual QgsMapLayerElevationProperties * clone() const =0
Creates a clone of the properties.
QgsMapLayerElevationProperties(QObject *parent)
Constructor for QgsMapLayerElevationProperties, with the specified parent object.
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:83
bool isEnabled() const
Returns true if the elevation properties are enabled, i.e.
QList< double > significantZValues(QgsMapLayer *layer) const override
Returns a list of significant elevation/z-values for the specified layer, using the settings defined ...
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.
QgsDoubleRange calculateZRange(QgsMapLayer *layer) const override
Attempts to calculate the overall elevation or z range for the specified layer, using the settings de...
QgsMapLayerElevationProperties::Flags flags() const override
Returns flags associated to the elevation properties.
QString htmlSummary() const override
Returns a HTML formatted summary of the properties.
bool isVisibleInZRange(const QgsDoubleRange &range, QgsMapLayer *layer=nullptr) const override
Returns true if the layer should be visible and rendered for the specified z range.
QgsRasterLayerElevationProperties(QObject *parent)
Constructor for QgsRasterLayerElevationProperties, with the specified parent object.
bool showByDefaultInElevationProfilePlots() const override
Returns true if the layer should be visible by default in newly created elevation profile plots.
Represents a raster layer.
A container for the context for various read/write operations on objects.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_FACTORY
Definition qgis_sip.h:83