QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsvectorlayerelevationproperties.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayerelevationproperties.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 QGSVECTORLAYERELEVATIONPROPERTIES_H
20 #define QGSVECTORLAYERELEVATIONPROPERTIES_H
21 
22 #include "qgis_core.h"
23 #include "qgis_sip.h"
24 #include "qgis.h"
26 
27 class QgsLineSymbol;
28 class QgsFillSymbol;
29 class QgsMarkerSymbol;
30 
39 {
40 
41  Q_OBJECT
42 
43  public:
44 
50 
51  bool hasElevation() const override;
52  QDomElement writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) override;
53  bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
54  void setDefaultsFromLayer( QgsMapLayer *layer ) override;
56  QString htmlSummary() const override;
57  bool isVisibleInZRange( const QgsDoubleRange &range ) const override;
58  QgsDoubleRange calculateZRange( QgsMapLayer *layer ) const override;
59  bool showByDefaultInElevationProfilePlots() const override;
60 
67  Qgis::AltitudeClamping clamping() const { return mClamping; }
68 
75  void setClamping( Qgis::AltitudeClamping clamping );
76 
84  Qgis::AltitudeBinding binding() const { return mBinding; }
85 
93  void setBinding( Qgis::AltitudeBinding binding );
94 
100  Qgis::VectorProfileType type() const { return mType; }
101 
107  void setType( Qgis::VectorProfileType type );
108 
115  bool extrusionEnabled() const { return mEnableExtrusion; }
116 
123  void setExtrusionEnabled( bool enabled );
124 
133  double extrusionHeight() const { return mExtrusionHeight; }
134 
143  void setExtrusionHeight( double height );
144 
153  bool respectLayerSymbology() const { return mRespectLayerSymbology; }
154 
163  void setRespectLayerSymbology( bool enabled );
164 
176  QgsLineSymbol *profileLineSymbol() const;
177 
191  void setProfileLineSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
192 
202  QgsFillSymbol *profileFillSymbol() const;
203 
215  void setProfileFillSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
216 
227  QgsMarkerSymbol *profileMarkerSymbol() const;
228 
241  void setProfileMarkerSymbol( QgsMarkerSymbol *symbol SIP_TRANSFER );
242 
250  Qgis::ProfileSurfaceSymbology profileSymbology() const { return mSymbology; }
251 
259  void setProfileSymbology( Qgis::ProfileSurfaceSymbology symbology );
260 
268  bool showMarkerSymbolInSurfacePlots() const { return mShowMarkerSymbolInSurfacePlots; }
269 
277  void setShowMarkerSymbolInSurfacePlots( bool show );
278 
279  private:
280 
281  void setDefaultProfileLineSymbol( const QColor &color );
282  void setDefaultProfileMarkerSymbol( const QColor &color );
283  void setDefaultProfileFillSymbol( const QColor &color );
284 
287 
289 
290  bool mEnableExtrusion = false;
291  double mExtrusionHeight = 0;
292 
293  std::unique_ptr< QgsLineSymbol > mProfileLineSymbol;
294  std::unique_ptr< QgsFillSymbol > mProfileFillSymbol;
295  std::unique_ptr< QgsMarkerSymbol > mProfileMarkerSymbol;
296  bool mRespectLayerSymbology = true;
298  bool mShowMarkerSymbolInSurfacePlots = false;
299 
300 };
301 
302 #endif // QGSVECTORLAYERELEVATIONPROPERTIES_H
QgsMapLayerElevationProperties::clone
virtual QgsMapLayerElevationProperties * clone() const =0
Creates a clone of the properties.
Qgis::AltitudeClamping::Terrain
@ Terrain
Elevation is clamped to terrain (final elevation = terrain elevation)
QgsMapLayerElevationProperties::readXml
virtual bool readXml(const QDomElement &element, const QgsReadWriteContext &context)=0
Reads the elevation properties from a DOM element previously written by writeXml().
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
QgsVectorLayerElevationProperties::type
Qgis::VectorProfileType type() const
Returns the type of profile the layer represents.
Definition: qgsvectorlayerelevationproperties.h:100
QgsVectorLayerElevationProperties::showMarkerSymbolInSurfacePlots
bool showMarkerSymbolInSurfacePlots() const
Returns true if the marker symbol should also be shown in continuous surface plots.
Definition: qgsvectorlayerelevationproperties.h:268
Qgis::AltitudeBinding::Centroid
@ Centroid
Clamp just centroid of feature.
QgsMapLayerElevationProperties
Base class for storage of map layer elevation properties.
Definition: qgsmaplayerelevationproperties.h:41
Qgis::ProfileSurfaceSymbology
ProfileSurfaceSymbology
Surface symbology type for elevation profile plots.
Definition: qgis.h:1849
qgis.h
QgsVectorLayerElevationProperties::extrusionHeight
double extrusionHeight() const
Returns the feature extrusion height.
Definition: qgsvectorlayerelevationproperties.h:133
QgsMapLayerElevationProperties::setDefaultsFromLayer
virtual void setDefaultsFromLayer(QgsMapLayer *layer)
Sets default properties based on sensible choices for the given map layer.
Definition: qgsmaplayerelevationproperties.cpp:34
QgsMapLayerElevationProperties::writeXml
virtual QDomElement writeXml(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context)=0
Writes the properties to a DOM element, to be used later with readXml().
QgsVectorLayerElevationProperties::clamping
Qgis::AltitudeClamping clamping() const
Returns the altitude clamping method, which dictates how feature heights are interpreted with respect...
Definition: qgsvectorlayerelevationproperties.h:67
QgsMapLayerElevationProperties::isVisibleInZRange
virtual bool isVisibleInZRange(const QgsDoubleRange &range) const
Returns true if the layer should be visible and rendered for the specified z range.
Definition: qgsmaplayerelevationproperties.cpp:71
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsMapLayerElevationProperties::calculateZRange
virtual QgsDoubleRange calculateZRange(QgsMapLayer *layer) const
Attempts to calculate the overall elevation or z range for the specified layer, using the settings de...
Definition: qgsmaplayerelevationproperties.cpp:76
Qgis::ProfileSurfaceSymbology::Line
@ Line
The elevation surface will be rendered using a line symbol.
QgsMapLayerElevationProperties::hasElevation
virtual bool hasElevation() const
Returns true if the layer has an elevation or z component.
Definition: qgsmaplayerelevationproperties.cpp:29
QgsMapLayerElevationProperties::htmlSummary
virtual QString htmlSummary() const
Returns a HTML formatted summary of the properties.
Definition: qgsmaplayerelevationproperties.cpp:39
Qgis::AltitudeBinding
AltitudeBinding
Altitude binding.
Definition: qgis.h:1770
QgsVectorLayerElevationProperties::extrusionEnabled
bool extrusionEnabled() const
Returns true if extrusion is enabled.
Definition: qgsvectorlayerelevationproperties.h:115
QgsMarkerSymbol
A marker symbol type, for rendering Point and MultiPoint geometries.
Definition: qgsmarkersymbol.h:30
QgsVectorLayerElevationProperties::respectLayerSymbology
bool respectLayerSymbology() const
Returns true if layer symbology should be respected when rendering elevation profile plots.
Definition: qgsvectorlayerelevationproperties.h:153
Qgis::VectorProfileType::IndividualFeatures
@ IndividualFeatures
Treat each feature as an individual object (eg buildings)
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsLineSymbol
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgslinesymbol.h:29
Qgis::VectorProfileType
VectorProfileType
Types of elevation profiles to generate for vector sources.
Definition: qgis.h:1861
QgsVectorLayerElevationProperties
Vector layer specific subclass of QgsMapLayerElevationProperties.
Definition: qgsvectorlayerelevationproperties.h:38
QgsDoubleRange
QgsRange which stores a range of double values.
Definition: qgsrange.h:202
QgsMapLayer
Base class for all map layer types. This is the base class for all map layer types (vector,...
Definition: qgsmaplayer.h:72
QgsMapLayerElevationProperties::showByDefaultInElevationProfilePlots
virtual bool showByDefaultInElevationProfilePlots() const
Returns true if the layer should be visible by default in newly created elevation profile plots.
Definition: qgsmaplayerelevationproperties.cpp:81
QgsFillSymbol
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Definition: qgsfillsymbol.h:29
QgsVectorLayerElevationProperties::binding
Qgis::AltitudeBinding binding() const
Returns the altitude binding method, which determines how altitude is bound to individual vertices in...
Definition: qgsvectorlayerelevationproperties.h:84
Qgis::AltitudeClamping
AltitudeClamping
Altitude clamping.
Definition: qgis.h:1757
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
qgsmaplayerelevationproperties.h
QgsVectorLayerElevationProperties::profileSymbology
Qgis::ProfileSurfaceSymbology profileSymbology() const
Returns the symbology option used to render the vector profile in elevation profile plots.
Definition: qgsvectorlayerelevationproperties.h:250