QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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:
59 explicit QgsElevationProfileManager( QgsProject *project SIP_TRANSFERTHIS = nullptr );
60
62
75
87 bool removeProfile( QgsElevationProfile *profile );
88
93 void clear();
94
98 QList< QgsElevationProfile * > profiles() const;
99
104 QgsElevationProfile *profileByName( const QString &name ) const;
105
112 bool readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context );
113
118 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
119
125 void resolveReferences( const QgsProject *project );
126
131 QString generateUniqueTitle() const;
132
133 signals:
134
136 void profileAboutToBeAdded( const QString &name );
137
139 void profileAdded( const QString &name );
140
142 void profileRemoved( const QString &name );
143
145 void profileAboutToBeRemoved( const QString &name );
146
148 void profileRenamed( QgsElevationProfile *profile, const QString &newName );
149
150 protected:
151 void setupObjectConnections( QgsElevationProfile *profile ) override;
152};
153
154
155#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:113
A container for the context for various read/write operations on objects.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_TRANSFER
Definition qgis_sip.h:35