QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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
254 private slots:
255
256 void dirtyProject();
257
258 private:
259 void setupLayerTreeConnections();
260
261 QPointer< QgsProject > mProject;
262 QString mName;
264 bool mLockAxisScales = false;
266 std::unique_ptr<QgsLayerTree> mLayerTree;
267 bool mUseProjectLayerTree = false;
268 std::unique_ptr<QgsCurve> mProfileCurve;
269 double mTolerance = 0;
270 std::unique_ptr<QgsLineSymbol> mSubsectionsSymbol;
271};
272
273#endif // QGSELEVATIONPROFILE_H
DistanceUnit
Units of distance.
Definition qgis.h:5170
@ Unknown
Unknown distance unit.
Definition qgis.h:5220
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:83
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:113
A container for the context for various read/write operations on objects.
#define SIP_TRANSFER
Definition qgis_sip.h:35