QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgselevationmap.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgselevationmap.h
3
--------------------------------------
4
Date : August 2022
5
Copyright : (C) 2022 by Martin Dobias
6
Email : wonder dot sk at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSELEVATIONMAP_H
17
#define QGSELEVATIONMAP_H
18
19
#include <memory>
20
21
#include "
qgis.h
"
22
#include "
qgis_sip.h
"
23
24
#include <QImage>
25
26
class
QgsRasterBlock
;
27
45
class
CORE_EXPORT
QgsElevationMap
46
{
47
public
:
48
QgsElevationMap
() =
default
;
49
51
explicit
QgsElevationMap
(
const
QSize &size,
float
devicePixelRatio = 1.0 );
52
60
explicit
QgsElevationMap
(
const
QImage &image );
61
62
QgsElevationMap
(
const
QgsElevationMap
&other );
63
79
void
applyEyeDomeLighting
( QImage &image,
int
distance,
float
strength,
float
rendererScale )
const
;
80
99
void
applyHillshading
( QImage &image,
bool
multiDirectional,
double
altitude,
double
azimuth,
double
zFactor,
double
cellSizeX,
double
cellSizeY )
const
;
100
102
QImage
rawElevationImage
()
const
{
return
mElevationImage; }
103
104
#ifndef SIP_RUN
105
110
QRgb *
rawElevationImageData
() {
return
reinterpret_cast<
QRgb *
>
( mElevationImage.bits() ); }
111
#endif
112
114
QPainter *painter()
const
;
115
125
void
combine(
const
QgsElevationMap
&otherElevationMap,
Qgis::ElevationMapCombineMethod
method );
126
131
void
fillWithRasterBlock(
QgsRasterBlock
*block,
int
top,
int
left,
double
zScale = 1.0,
double
offset = 0.0 )
SIP_SKIP
;
132
138
bool
isValid() const;
139
141
static QRgb encodeElevation(
float
z );
143
static
float
decodeElevation( QRgb colorRaw );
144
146
static std::unique_ptr<
QgsElevationMap
> fromRasterBlock(
QgsRasterBlock
*block )
SIP_SKIP
;
147
149
inline
bool
isNoData
( QRgb colorRaw )
const
{
return
colorRaw == 0; }
150
152
inline
float
noDataValue
()
const
{
return
decodeElevation
( 0 ); }
153
154
QgsElevationMap
&operator=(
const
QgsElevationMap
&other );
155
156
private
:
157
mutable
QImage mElevationImage;
158
mutable
std::unique_ptr<QPainter> mPainter;
159
};
160
161
#endif
// QGSELEVATIONMAP_H
Qgis::ElevationMapCombineMethod
ElevationMapCombineMethod
Methods used to select the elevation when two elevation maps are combined.
Definition
qgis.h:5470
QgsElevationMap
Stores a digital elevation model in a raster image which may get updated as a part of the map layer r...
Definition
qgselevationmap.h:46
QgsElevationMap::QgsElevationMap
QgsElevationMap()=default
QgsElevationMap::applyEyeDomeLighting
void applyEyeDomeLighting(QImage &image, int distance, float strength, float rendererScale) const
Applies eye dome lighting effect to the given image.
Definition
qgselevationmap.cpp:91
QgsElevationMap::noDataValue
float noDataValue() const
Returns the no data value for the elevation map.
Definition
qgselevationmap.h:152
QgsElevationMap::rawElevationImage
QImage rawElevationImage() const
Returns raw elevation image with elevations encoded as color values.
Definition
qgselevationmap.h:102
QgsElevationMap::isNoData
bool isNoData(QRgb colorRaw) const
Returns whether the encoded value is a no data value.
Definition
qgselevationmap.h:149
QgsElevationMap::rawElevationImageData
QRgb * rawElevationImageData()
Returns pointer to the actual elevation image data.
Definition
qgselevationmap.h:110
QgsElevationMap::decodeElevation
static float decodeElevation(QRgb colorRaw)
Converts a color back to elevation value.
Definition
qgselevationmap.cpp:57
QgsElevationMap::applyHillshading
void applyHillshading(QImage &image, bool multiDirectional, double altitude, double azimuth, double zFactor, double cellSizeX, double cellSizeY) const
Applies hill shading effect to the given image.
Definition
qgselevationmap.cpp:178
QgsRasterBlock
Raster data container.
Definition
qgsrasterblock.h:42
qgis.h
qgis_sip.h
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
Generated on
for QGIS API Documentation by
1.17.0