QGIS API Documentation 3.99.0-Master (752b475928d)
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:
49
51
52
55 explicit QgsElevationProfile( QgsProject *project );
57
64 QString name() const { return mName; }
65
70 QDomElement writeXml( QDomDocument &document, const QgsReadWriteContext &context ) const;
71
80 bool readXml( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
81
87 void resolveReferences( const QgsProject *project );
88
92 QIcon icon() const;
93
102 QgsLayerTree *layerTree();
103
113 bool useProjectLayerTree() { return mUseProjectLayerTree; }
114
121
131 void setProfileCurve( QgsCurve *curve SIP_TRANSFER );
132
140 QgsCurve *profileCurve() const;
141
151 double tolerance() const;
152
158 bool lockAxisScales() const;
159
165 Qgis::DistanceUnit distanceUnit() const;
166
172 QgsLineSymbol *subsectionsSymbol();
173
182 void setSubsectionsSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
183
184 public slots:
185
192 void setName( const QString &name );
193
199 void setCrs( const QgsCoordinateReferenceSystem &crs );
200
210 void setTolerance( double tolerance );
211
217 void setLockAxisScales( bool lock );
218
224 void setDistanceUnit( Qgis::DistanceUnit unit );
225
226
236 void setUseProjectLayerTree( bool useProjectTree );
237
238 signals:
239
246 void nameChanged( const QString &newName );
247
253 void useProjectLayerTreeChanged( bool useProjectTree );
254
255 private slots:
256
257 void dirtyProject();
258
259 private:
260
261 void setupLayerTreeConnections();
262
263 QPointer< QgsProject > mProject;
264 QString mName;
266 bool mLockAxisScales = false;
268 std::unique_ptr<QgsLayerTree> mLayerTree;
269 bool mUseProjectLayerTree = false;
270 std::unique_ptr<QgsCurve> mProfileCurve;
271 double mTolerance = 0;
272 std::unique_ptr<QgsLineSymbol> mSubsectionsSymbol;
273
274};
275
276#endif // QGSELEVATIONPROFILE_H
DistanceUnit
Units of distance.
Definition qgis.h:5013
@ Unknown
Unknown distance unit.
Definition qgis.h:5063
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.
QgsElevationProfile(QgsProject *project)
Constructor for QgsElevationProfile.
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.
~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:80
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
A container for the context for various read/write operations on objects.
#define SIP_TRANSFER
Definition qgis_sip.h:36