QGIS API Documentation 4.1.0-Master (01362494303)
Loading...
Searching...
No Matches
qgselevationprofile.h
Go to the documentation of this file.
1/***************************************************************************
2 qgselevationprofile.h
3 ------------------
4 Date : July 2025
5 Copyright : (C) 2025 Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSELEVATIONPROFILE_H
17#define QGSELEVATIONPROFILE_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
22#include "qgsmaplayerref.h"
23
24#include <QObject>
25#include <QPointer>
26
27class QgsProject;
29class QDomDocument;
30class QDomElement;
31class QgsMapLayer;
32class QgsCurve;
33class QgsLineSymbol;
34class QgsLayerTree;
35
44class CORE_EXPORT QgsElevationProfile : public QObject
45{
46 Q_OBJECT
47
48 public:
50
51
54 explicit QgsElevationProfile( QgsProject *project );
56
63 QString name() const { return mName; }
64
69 QDomElement writeXml( QDomDocument &document, const QgsReadWriteContext &context ) const;
70
79 bool readXml( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
80
86 void resolveReferences( const QgsProject *project );
87
91 QIcon icon() const;
92
101 QgsLayerTree *layerTree();
102
112 bool useProjectLayerTree() { return mUseProjectLayerTree; }
113
120
130 void setProfileCurve( QgsCurve *curve SIP_TRANSFER );
131
139 QgsCurve *profileCurve() const;
140
150 double tolerance() const;
151
157 bool lockAxisScales() const;
158
164 Qgis::DistanceUnit distanceUnit() const;
165
171 QgsLineSymbol *subsectionsSymbol();
172
181 void setSubsectionsSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
182
183 public slots:
184
191 void setName( const QString &name );
192
198 void setCrs( const QgsCoordinateReferenceSystem &crs );
199
209 void setTolerance( double tolerance );
210
216 void setLockAxisScales( bool lock );
217
223 void setDistanceUnit( Qgis::DistanceUnit unit );
224
225
235 void setUseProjectLayerTree( bool useProjectTree );
236
237 signals:
238
245 void nameChanged( const QString &newName );
246
252 void useProjectLayerTreeChanged( bool useProjectTree );
253
263
273
274 private slots:
275
276 void dirtyProject();
277
278 private:
279 void setupLayerTreeConnections();
280
281 QPointer< QgsProject > mProject;
282 QString mName;
284 bool mLockAxisScales = false;
286 std::unique_ptr<QgsLayerTree> mLayerTree;
287 bool mUseProjectLayerTree = false;
288 std::unique_ptr<QgsCurve> mProfileCurve;
289 double mTolerance = 0;
290 std::unique_ptr<QgsLineSymbol> mSubsectionsSymbol;
291};
292
293#endif // QGSELEVATIONPROFILE_H
DistanceUnit
Units of distance.
Definition qgis.h:5314
@ Unknown
Unknown distance unit.
Definition qgis.h:5364
Represents a coordinate reference system (CRS).
Abstract base class for curved geometry type.
Definition qgscurve.h:36
void useProjectLayerTreeChanged(bool useProjectTree)
Emitted when the use project layer tree property is changed.
bool useProjectLayerTree()
Returns true if the profile should always use the project's layer tree.
double tolerance() const
Returns the tolerance of the profile (in crs() units).
QgsElevationProfile(QgsProject *project)
Constructor for QgsElevationProfile.
void profileCurveChanged()
Emitted when the profile curve is changed.
void nameChanged(const QString &newName)
Emitted when the profile is renamed.
QString name() const
Returns the profile's unique name.
void setUseProjectLayerTree(bool useProjectTree)
Sets whether the profile should always use the project's layer tree.
void toleranceChanged(double tolerance)
Emitted when the profile tolerance is changed.
~QgsElevationProfile() override
Namespace with helper functions for layer tree operations.
A line symbol type, for rendering LineString and MultiLineString geometries.
Base class for all map layer types.
Definition qgsmaplayer.h:83
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:114
A container for the context for various read/write operations on objects.
#define SIP_TRANSFER
Definition qgis_sip.h:35