QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgselevationprofilemanager.h
Go to the documentation of this file.
1/***************************************************************************
2 qgselevationprofilemanager.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 QGSELEVATIONPROFILEMANAGER_H
17#define QGSELEVATIONPROFILEMANAGER_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
22
23#include <QObject>
24
25class QDomElement;
26class QDomDocument;
29
45#ifdef SIP_RUN
46class CORE_EXPORT QgsElevationProfileManager : public QgsProjectStoredObjectManagerBase // for sip we skip to the base class and avoid the template difficulty
47{
48#else
49class CORE_EXPORT QgsElevationProfileManager : public QgsAbstractProjectStoredObjectManager< QgsElevationProfile >
50{
51#endif
52 Q_OBJECT
53
54 public:
55
60 explicit QgsElevationProfileManager( QgsProject *project SIP_TRANSFERTHIS = nullptr );
61
63
76
88 bool removeProfile( QgsElevationProfile *profile );
89
94 void clear();
95
99 QList< QgsElevationProfile * > profiles() const;
100
105 QgsElevationProfile *profileByName( const QString &name ) const;
106
113 bool readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context );
114
119 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
120
126 void resolveReferences( const QgsProject *project );
127
132 QString generateUniqueTitle() const;
133
134 signals:
135
137 void profileAboutToBeAdded( const QString &name );
138
140 void profileAdded( const QString &name );
141
143 void profileRemoved( const QString &name );
144
146 void profileAboutToBeRemoved( const QString &name );
147
149 void profileRenamed( QgsElevationProfile *profile, const QString &newName );
150
151 protected:
152
153 void setupObjectConnections( QgsElevationProfile *profile ) override;
154
155};
156
157
158#endif // QGSELEVATIONPROFILEMANAGER_H
Manages storage of a set of elevation profiles.
void profileRenamed(QgsElevationProfile *profile, const QString &newName)
Emitted when a profile is renamed.
void profileRemoved(const QString &name)
Emitted when a profile was removed from the manager.
QgsElevationProfile * profileByName(const QString &name) const
Returns the profile with a matching name, or nullptr if no matching profiles were found.
void setupObjectConnections(QgsElevationProfile *profile) override
bool readXml(const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context)
Reads the manager's state from a DOM element, restoring all profiles present in the XML document.
QString generateUniqueTitle() const
Generates a unique title for a new profile, which does not clash with any already contained by the ma...
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Returns a DOM element representing the state of the manager.
void profileAdded(const QString &name)
Emitted when a profile has been added to the manager.
bool removeProfile(QgsElevationProfile *profile)
Removes a profile from the manager.
void profileAboutToBeAdded(const QString &name)
Emitted when a profile is about to be added to the manager.
void clear()
Removes and deletes all profiles from the manager.
bool addProfile(QgsElevationProfile *profile)
Adds a profile to the manager.
QList< QgsElevationProfile * > profiles() const
Returns a list of all profiles contained in the manager.
void profileAboutToBeRemoved(const QString &name)
Emitted when a profile is about to be removed from the manager.
QgsElevationProfileManager(QgsProject *project=nullptr)
Constructor for QgsElevationProfileManager.
void resolveReferences(const QgsProject *project)
After reading settings from XML, resolves references to any layers in a project that have been read a...
Represents an elevation profile attached to a project.
Manages storage of a set of objects attached to a QgsProject.
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_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36