QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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
27class QgsLineSymbol;
28class QgsFillSymbol;
29class 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
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:72
AltitudeClamping
Altitude clamping.
Definition: qgis.h:1927
@ Terrain
Elevation is clamped to terrain (final elevation = terrain elevation)
AltitudeBinding
Altitude binding.
Definition: qgis.h:1940
@ Centroid
Clamp just centroid of feature.
VectorProfileType
Types of elevation profiles to generate for vector sources.
Definition: qgis.h:2031
@ IndividualFeatures
Treat each feature as an individual object (eg buildings)
ProfileSurfaceSymbology
Surface symbology type for elevation profile plots.
Definition: qgis.h:2019
@ Line
The elevation surface will be rendered using a line symbol.
QgsRange which stores a range of double values.
Definition: qgsrange.h:203
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Definition: qgsfillsymbol.h:30
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgslinesymbol.h:30
Base class for storage of map layer elevation properties.
virtual QgsMapLayerElevationProperties * clone() const =0
Creates a clone of the properties.
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 void setDefaultsFromLayer(QgsMapLayer *layer)
Sets default properties based on sensible choices for the given map layer.
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:73
A marker symbol type, for rendering Point and MultiPoint geometries.
The class is used as a container of context for various read/write operations on other objects.
Vector layer specific subclass of QgsMapLayerElevationProperties.
double extrusionHeight() const
Returns the feature extrusion height.
Qgis::VectorProfileType type() const
Returns the type of profile the layer represents.
bool showMarkerSymbolInSurfacePlots() const
Returns true if the marker symbol should also be shown in continuous surface plots.
Qgis::AltitudeBinding binding() const
Returns the altitude binding method, which determines how altitude is bound to individual vertices in...
Qgis::ProfileSurfaceSymbology profileSymbology() const
Returns the symbology option used to render the vector profile in elevation profile plots.
bool respectLayerSymbology() const
Returns true if layer symbology should be respected when rendering elevation profile plots.
bool extrusionEnabled() const
Returns true if extrusion is enabled.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76