QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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"
26 #include "qgspropertycollection.h"
27 
28 #include <QObject>
29 #include <QDomElement>
30 
41 class CORE_EXPORT QgsMapLayerElevationProperties : public QObject
42 {
43 #ifdef SIP_RUN
48 #endif
49 
50  Q_OBJECT
51 
52 #ifdef SIP_RUN
54  if ( qobject_cast<QgsPointCloudLayerElevationProperties *>( sipCpp ) )
55  {
56  sipType = sipType_QgsPointCloudLayerElevationProperties;
57  }
58  else if ( qobject_cast<QgsVectorLayerElevationProperties *>( sipCpp ) )
59  {
60  sipType = sipType_QgsVectorLayerElevationProperties;
61  }
62  else if ( qobject_cast<QgsRasterLayerElevationProperties *>( sipCpp ) )
63  {
64  sipType = sipType_QgsRasterLayerElevationProperties;
65  }
66  else if ( qobject_cast<QgsMeshLayerElevationProperties *>( sipCpp ) )
67  {
68  sipType = sipType_QgsMeshLayerElevationProperties;
69  }
70  else
71  {
72  sipType = 0;
73  }
74  SIP_END
75 #endif
76 
77  public:
78 
83  enum Property
84  {
87  };
88 
92  enum Flag
93  {
94  FlagDontInvalidateCachedRendersWhenRangeChanges = 1
95  };
96  Q_DECLARE_FLAGS( Flags, Flag )
97 
98 
102 
106  virtual bool hasElevation() const;
107 
113  virtual QDomElement writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) = 0;
114 
120  virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) = 0;
121 
127  virtual void setDefaultsFromLayer( QgsMapLayer *layer );
128 
134  virtual QString htmlSummary() const;
135 
141  virtual QgsMapLayerElevationProperties *clone() const = 0 SIP_FACTORY;
142 
146  virtual bool isVisibleInZRange( const QgsDoubleRange &range ) const;
147 
151  virtual QgsMapLayerElevationProperties::Flags flags() const { return QgsMapLayerElevationProperties::Flags(); }
152 
159  virtual QgsDoubleRange calculateZRange( QgsMapLayer *layer ) const;
160 
170  virtual bool showByDefaultInElevationProfilePlots() const;
171 
180  double zOffset() const { return mZOffset; }
181 
190  void setZOffset( double offset );
191 
203  double zScale() const { return mZScale; }
204 
216  void setZScale( double scale );
217 
223  QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
224 
232  const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
233 
243  void setDataDefinedProperties( const QgsPropertyCollection &collection );
244 
250  static QgsPropertiesDefinition propertyDefinitions();
251 
252  signals:
253 
259  void changed();
260 
266  void zOffsetChanged();
267 
273  void zScaleChanged();
274 
283  void profileRenderingPropertyChanged();
284 
293  void profileGenerationPropertyChanged();
294 
295  protected:
297  double mZScale = 1.0;
299  double mZOffset = 0.0;
300 
303 
306 
313  void writeCommonProperties( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context );
314 
321  void readCommonProperties( const QDomElement &element, const QgsReadWriteContext &context );
322 
328  void copyCommonProperties( const QgsMapLayerElevationProperties *other );
329 
330  private:
331 
335  static void initPropertyDefinitions();
336 
337 };
338 
339 #endif // QGSMAPLAYERELEVATIONPROPERTIES_H
QgsMapLayerElevationProperties::ZOffset
@ ZOffset
Definition: qgsmaplayerelevationproperties.h:85
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
QgsMapLayerElevationProperties
Base class for storage of map layer elevation properties.
Definition: qgsmaplayerelevationproperties.h:41
qgsreadwritecontext.h
QgsMapLayerElevationProperties::ExtrusionHeight
@ ExtrusionHeight
Z offset.
Definition: qgsmaplayerelevationproperties.h:86
qgsrange.h
qgsmeshlayerelevationproperties.h
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsMapLayerElevationProperties::Flag
Flag
Flags attached to the elevation property.
Definition: qgsmaplayerelevationproperties.h:92
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:186
QgsPropertiesDefinition
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
Definition: qgspropertycollection.h:29
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
qgsrasterlayerelevationproperties.h
QgsMapLayerElevationProperties::zScale
double zScale() const
Returns the z scale, which is a scaling factor which should be applied to z values from the layer.
Definition: qgsmaplayerelevationproperties.h:203
QgsMapLayerElevationProperties::flags
virtual QgsMapLayerElevationProperties::Flags flags() const
Returns flags associated to the elevation properties.
Definition: qgsmaplayerelevationproperties.h:151
QgsMapLayerElevationProperties::mDataDefinedProperties
QgsPropertyCollection mDataDefinedProperties
Property collection for data defined elevation settings.
Definition: qgsmaplayerelevationproperties.h:302
qgis_sip.h
QgsMapLayerElevationProperties::dataDefinedProperties
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the object's property collection, used for data defined overrides.
Definition: qgsmaplayerelevationproperties.h:232
QgsMapLayerElevationProperties::sPropertyDefinitions
static QgsPropertiesDefinition sPropertyDefinitions
Property definitions.
Definition: qgsmaplayerelevationproperties.h:305
QgsPropertyCollection
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
Definition: qgspropertycollection.h:318
QgsDoubleRange
QgsRange which stores a range of double values.
Definition: qgsrange.h:202
qgsvectorlayerelevationproperties.h
QgsMapLayer
Base class for all map layer types. This is the base class for all map layer types (vector,...
Definition: qgsmaplayer.h:72
QgsMapLayerElevationProperties::Property
Property
Data definable properties.
Definition: qgsmaplayerelevationproperties.h:83
qgspropertycollection.h
QgsMapLayerElevationProperties::zOffset
double zOffset() const
Returns the z offset, which is a fixed offset amount which should be added to z values from the layer...
Definition: qgsmaplayerelevationproperties.h:180
qgspointcloudlayerelevationproperties.h
SIP_END
#define SIP_END
Definition: qgis_sip.h:203
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsMapLayerElevationProperties::dataDefinedProperties
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the object's property collection, used for data defined overrides.
Definition: qgsmaplayerelevationproperties.h:223