QGIS API Documentation 3.41.0-Master (d5b93354e9c)
Loading...
Searching...
No Matches
qgsmaplayerelevationproperties.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaplayerelevationproperties.h
3 ---------------
4 begin : November 2020
5 copyright : (C) 2020 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 QGSMAPLAYERELEVATIONPROPERTIES_H
20#define QGSMAPLAYERELEVATIONPROPERTIES_H
21
22#include "qgis_core.h"
23#include "qgis_sip.h"
24#include "qgsreadwritecontext.h"
25#include "qgsrange.h"
27
28#include <QObject>
29#include <QDomElement>
30
31class QgsMapLayer;
32
33
44class CORE_EXPORT QgsMapLayerElevationProperties : public QObject
45{
46 //SIP_TYPEHEADER_INCLUDE( "qgspointcloudlayerelevationproperties.h" );
47 //SIP_TYPEHEADER_INCLUDE( "qgsrasterlayerelevationproperties.h" );
48 //SIP_TYPEHEADER_INCLUDE( "qgsvectorlayerelevationproperties.h" );
49 //SIP_TYPEHEADER_INCLUDE( "qgsmeshlayerelevationproperties.h" );
50 //SIP_TYPEHEADER_INCLUDE( "qgstiledscenelayerelevationproperties.h" );
51 Q_OBJECT
52
53#ifdef SIP_RUN
55 if ( qobject_cast<QgsPointCloudLayerElevationProperties *>( sipCpp ) )
56 {
57 sipType = sipType_QgsPointCloudLayerElevationProperties;
58 }
59 else if ( qobject_cast<QgsVectorLayerElevationProperties *>( sipCpp ) )
60 {
61 sipType = sipType_QgsVectorLayerElevationProperties;
62 }
63 else if ( qobject_cast<QgsRasterLayerElevationProperties *>( sipCpp ) )
64 {
65 sipType = sipType_QgsRasterLayerElevationProperties;
66 }
67 else if ( qobject_cast<QgsMeshLayerElevationProperties *>( sipCpp ) )
68 {
69 sipType = sipType_QgsMeshLayerElevationProperties;
70 }
71 else if ( qobject_cast<QgsTiledSceneLayerElevationProperties *>( sipCpp ) )
72 {
73 sipType = sipType_QgsTiledSceneLayerElevationProperties;
74 }
75 else
76 {
77 sipType = 0;
78 }
80#endif
81
82 public:
83
84 // *INDENT-OFF*
85
91 {
92 ZOffset,
93 ExtrusionHeight,
94 RasterPerBandLowerElevation,
95 RasterPerBandUpperElevation,
96 };
97 // *INDENT-ON*
98
102 enum Flag SIP_ENUM_BASETYPE( IntFlag )
103 {
104 FlagDontInvalidateCachedRendersWhenRangeChanges = 1
105 };
106 Q_DECLARE_FLAGS( Flags, Flag )
107
108
112
116 virtual bool hasElevation() const;
117
123 virtual QDomElement writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) = 0;
124
130 virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) = 0;
131
137 virtual void setDefaultsFromLayer( QgsMapLayer *layer );
138
144 virtual QString htmlSummary() const;
145
152
158 virtual bool isVisibleInZRange( const QgsDoubleRange &range, QgsMapLayer *layer = nullptr ) const;
159
164
171 virtual QgsDoubleRange calculateZRange( QgsMapLayer *layer ) const;
172
181 virtual QList< double > significantZValues( QgsMapLayer *layer ) const;
182
192 virtual bool showByDefaultInElevationProfilePlots() const;
193
202 double zOffset() const { return mZOffset; }
203
212 void setZOffset( double offset );
213
225 double zScale() const { return mZScale; }
226
238 void setZScale( double scale );
239
245 QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
246
254 const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
255
265 void setDataDefinedProperties( const QgsPropertyCollection &collection );
266
272 static QgsPropertiesDefinition propertyDefinitions();
273
274 signals:
275
281 void changed();
282
289
296
306
316
317 protected:
319 double mZScale = 1.0;
321 double mZOffset = 0.0;
322
325
328
335 void writeCommonProperties( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context );
336
343 void readCommonProperties( const QDomElement &element, const QgsReadWriteContext &context );
344
350 void copyCommonProperties( const QgsMapLayerElevationProperties *other );
351
352 private:
353
357 static void initPropertyDefinitions();
358
359};
360
361#endif // QGSMAPLAYERELEVATIONPROPERTIES_H
QgsRange which stores a range of double values.
Definition qgsrange.h:231
Base class for storage of map layer elevation properties.
void zScaleChanged()
Emitted when the z scale changes.
QgsPropertyCollection mDataDefinedProperties
Property collection for data defined elevation settings.
void profileGenerationPropertyChanged()
Emitted when any of the elevation properties which relate solely to generation of elevation profiles ...
virtual QgsMapLayerElevationProperties::Flags flags() const
Returns flags associated to the elevation properties.
virtual QgsMapLayerElevationProperties * clone() const =0
Creates a clone of the properties.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the object's property collection, used for data defined overrides.
void changed()
Emitted when any of the elevation properties have changed.
void profileRenderingPropertyChanged()
Emitted when any of the elevation properties which relate solely to presentation of elevation results...
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the object's property collection, used for data defined overrides.
void zOffsetChanged()
Emitted when the z offset changes.
double zScale() const
Returns the z scale, which is a scaling factor which should be applied to z values from the layer.
virtual QDomElement writeXml(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context)=0
Writes the properties to a DOM element, to be used later with readXml().
static QgsPropertiesDefinition sPropertyDefinitions
Property definitions.
virtual bool readXml(const QDomElement &element, const QgsReadWriteContext &context)=0
Reads the elevation properties from a DOM element previously written by writeXml().
Flag
Flags attached to the elevation property.
double zOffset() const
Returns the z offset, which is a fixed offset amount which should be added to z values from the layer...
Base class for all map layer types.
Definition qgsmaplayer.h:76
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
The class is used as a container of context for various read/write operations on other objects.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:278
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:271
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_END
Definition qgis_sip.h:208
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.