Class: QgsElevationProfileManager

Manages storage of a set of elevation profiles.

QgsElevationProfileManager handles the storage, serializing and deserializing of elevation profiles. Usually this class is not constructed directly, but rather accessed through a QgsProject via QgsProject.elevationProfileManager().

QgsElevationProfileManager retains ownership of all the profiles contained in the manager.

Added in version 4.0.

Class Hierarchy

Inheritance diagram of qgis.core.QgsElevationProfileManager

Base classes

QgsProjectStoredObjectManagerBase

Manages storage of a set of objects attached to a QgsProject.

QObject

Methods

addProfile

Adds a profile to the manager.

clear

Removes and deletes all profiles from the manager.

generateUniqueTitle

Generates a unique title for a new profile, which does not clash with any already contained by the manager.

profileByName

Returns the profile with a matching name, or None if no matching profiles were found.

profiles

Returns a list of all profiles contained in the manager.

readXml

Reads the manager's state from a DOM element, restoring all profiles present in the XML document.

removeProfile

Removes a profile from the manager.

resolveReferences

After reading settings from XML, resolves references to any layers in a project that have been read as layer IDs.

writeXml

Returns a DOM element representing the state of the manager.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsElevationProfileManager. See the FAQ for more details.

setupObjectConnections

Signals

profileAboutToBeAdded

Emitted when a profile is about to be added to the manager

profileAboutToBeRemoved

Emitted when a profile is about to be removed from the manager

profileAdded

Emitted when a profile has been added to the manager

profileRemoved

Emitted when a profile was removed from the manager

profileRenamed

Emitted when a profile is renamed

class qgis.core.QgsElevationProfileManager[source]

Bases: QgsProjectStoredObjectManagerBase

__init__(project: QgsProject | None = None)

Constructor for QgsElevationProfileManager. The project will become the parent object for this manager.

Parameters:

project (Optional[QgsProject] = None)

addProfile(self, profile: QgsElevationProfile | None) bool[source]

Adds a profile to the manager.

Ownership of the profile is transferred to the manager.

Returns True if the addition was successful, or False if the profile could not be added (eg as a result of a duplicate profile name).

See also

removeProfile()

See also

profileAdded()

Parameters:

profile (Optional[QgsElevationProfile])

Return type:

bool

clear(self)[source]

Removes and deletes all profiles from the manager.

See also

removeProfile()

generateUniqueTitle(self) str[source]

Generates a unique title for a new profile, which does not clash with any already contained by the manager.

Return type:

str

signal profileAboutToBeAdded(name: str)[source]

Emitted when a profile is about to be added to the manager

Parameters:

name (str)

signal profileAboutToBeRemoved(name: str)[source]

Emitted when a profile is about to be removed from the manager

Parameters:

name (str)

signal profileAdded(name: str)[source]

Emitted when a profile has been added to the manager

Parameters:

name (str)

profileByName(self, name: str | None) QgsElevationProfile | None[source]

Returns the profile with a matching name, or None if no matching profiles were found.

Parameters:

name (Optional[str])

Return type:

Optional[QgsElevationProfile]

signal profileRemoved(name: str)[source]

Emitted when a profile was removed from the manager

Parameters:

name (str)

signal profileRenamed(profile: QgsElevationProfile, newName: str)[source]

Emitted when a profile is renamed

Parameters:
profiles(self) List[QgsElevationProfile]

Returns a list of all profiles contained in the manager.

Return type:

List[QgsElevationProfile]

readXml(self, element: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) bool[source]

Reads the manager’s state from a DOM element, restoring all profiles present in the XML document.

See also

writeXml()

Parameters:
Return type:

bool

removeProfile(self, profile: QgsElevationProfile | None) bool[source]

Removes a profile from the manager. The profile is deleted.

Returns True if the removal was successful, or False if the removal failed (eg as a result of removing a profile which is not contained in the manager).

See also

addProfile()

See also

profileRemoved()

See also

clear()

Parameters:

profile (Optional[QgsElevationProfile])

Return type:

bool

resolveReferences(self, project: QgsProject | None)[source]

After reading settings from XML, resolves references to any layers in a project that have been read as layer IDs.

See also

readXml()

Parameters:

project (Optional[QgsProject])

virtual setupObjectConnections(self, profile: QgsElevationProfile | None)[source]
Parameters:

profile (Optional[QgsElevationProfile])

writeXml(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement[source]

Returns a DOM element representing the state of the manager.

See also

readXml()

Parameters:
Return type:

QDomElement