QGIS API Documentation 3.41.0-Master (d2aaa9c6e02)
Loading...
Searching...
No Matches
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, QgsMapLayer *layer = nullptr ) 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
151 bool customToleranceEnabled() const { return mEnableCustomTolerance; }
152
159 void setCustomToleranceEnabled( bool enabled );
160
171 double customTolerance() const { return mCustomTolerance; }
172
183 void setCustomTolerance( double tolerance );
184
193 bool respectLayerSymbology() const { return mRespectLayerSymbology; }
194
203 void setRespectLayerSymbology( bool enabled );
204
216 QgsLineSymbol *profileLineSymbol() const;
217
231 void setProfileLineSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
232
242 QgsFillSymbol *profileFillSymbol() const;
243
255 void setProfileFillSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
256
267 QgsMarkerSymbol *profileMarkerSymbol() const;
268
281 void setProfileMarkerSymbol( QgsMarkerSymbol *symbol SIP_TRANSFER );
282
290 Qgis::ProfileSurfaceSymbology profileSymbology() const { return mSymbology; }
291
299 void setProfileSymbology( Qgis::ProfileSurfaceSymbology symbology );
300
311 double elevationLimit() const;
312
323 void setElevationLimit( double limit );
324
332 bool showMarkerSymbolInSurfacePlots() const { return mShowMarkerSymbolInSurfacePlots; }
333
341 void setShowMarkerSymbolInSurfacePlots( bool show );
342
343 private:
344
345 void setDefaultProfileLineSymbol( const QColor &color );
346 void setDefaultProfileMarkerSymbol( const QColor &color );
347 void setDefaultProfileFillSymbol( const QColor &color );
348
351
353
354 bool mEnableExtrusion = false;
355 double mExtrusionHeight = 0;
356 bool mEnableCustomTolerance = false;
357 double mCustomTolerance = 0;
358
359 std::unique_ptr< QgsLineSymbol > mProfileLineSymbol;
360 std::unique_ptr< QgsFillSymbol > mProfileFillSymbol;
361 std::unique_ptr< QgsMarkerSymbol > mProfileMarkerSymbol;
362 bool mRespectLayerSymbology = true;
364 double mElevationLimit = std::numeric_limits< double >::quiet_NaN();
365 bool mShowMarkerSymbolInSurfacePlots = false;
366
367};
368
369#endif // QGSVECTORLAYERELEVATIONPROPERTIES_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
AltitudeClamping
Altitude clamping.
Definition qgis.h:3762
@ Terrain
Elevation is clamped to terrain (final elevation = terrain elevation)
AltitudeBinding
Altitude binding.
Definition qgis.h:3775
@ Centroid
Clamp just centroid of feature.
VectorProfileType
Types of elevation profiles to generate for vector sources.
Definition qgis.h:3973
@ IndividualFeatures
Treat each feature as an individual object (eg buildings)
ProfileSurfaceSymbology
Surface symbology type for elevation profile plots.
Definition qgis.h:3960
@ Line
The elevation surface will be rendered using a line symbol.
QgsRange which stores a range of double values.
Definition qgsrange.h:237
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol type, for rendering LineString and MultiLineString geometries.
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:76
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.
double customTolerance() const
Returns the feature custom tolerance.
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.
bool customToleranceEnabled() const
Returns true if custom tolerance 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