Skip to content

Class QfMarkupCollection

ClassList > QfMarkupCollection

This class holds a collection of markup items.

  • #include <qfmarkupcollection.h>

Inherits the following classes: QObject

Public Properties

Type Name
property qsizetype count
property QList< QfMarkupItem > items
property QString name
property QString uuid

Public Signals

Type Name
signal void countChanged
Emitted when the number of items in the collection changed.
signal void itemsChanged
Emitted when the list of items in the collection changed.
signal void nameChanged
Emitted when the collection name changed.
signal void uuidChanged
Emitted when the UUID changed.

Public Functions

Type Name
QfMarkupCollection (const QString & name=QString(), QObject * parent=nullptr)
Q_INVOKABLE QString addItem (const QfMarkupItem & item, bool resetVectorLayer=true)
QgsAnnotationLayer * asAnnotationLayer ()
QgsVectorLayer * asVectorLayer ()
qsizetype count () const
Q_INVOKABLE QgsRectangle extent () const
QList< QfMarkupItem > items () const
QString name () const
bool readGeoJson (const QString & path)
Q_INVOKABLE void removeItem (const QString & uuid, bool resetVectorLayer=true)
Q_INVOKABLE void replaceItem (const QString & uuid, const QfMarkupItem & item, bool resetVectorLayer=true)
void setName (const QString & name)
QString uuid () const
bool writeGeoJson (const QString & path)

Public Static Functions

Type Name
Q_INVOKABLE QfMarkupItem createItem (const QString & label, const QString & description, const QgsGeometry & geometry, const QColor & color)

Public Properties Documentation

property count [1/2]

qsizetype QfMarkupCollection::count;

property items [1/2]

QList<QfMarkupItem> QfMarkupCollection::items;

property name [1/2]

QString QfMarkupCollection::name;

property uuid [1/2]

QString QfMarkupCollection::uuid;

Public Signals Documentation

signal countChanged

Emitted when the number of items in the collection changed.

void QfMarkupCollection::countChanged;


signal itemsChanged

Emitted when the list of items in the collection changed.

void QfMarkupCollection::itemsChanged;


signal nameChanged

Emitted when the collection name changed.

void QfMarkupCollection::nameChanged;


signal uuidChanged

Emitted when the UUID changed.

void QfMarkupCollection::uuidChanged;


Public Functions Documentation

function QfMarkupCollection

explicit QfMarkupCollection::QfMarkupCollection (
    const QString & name=QString(),
    QObject * parent=nullptr
) 

function addItem

Q_INVOKABLE QString QfMarkupCollection::addItem (
    const QfMarkupItem & item,
    bool resetVectorLayer=true
) 

Adds an item into the collection and return its UUID.


function asAnnotationLayer

QgsAnnotationLayer * QfMarkupCollection::asAnnotationLayer () 

Returns a pointer to an annotation layer matching the content of the collection.

Note:

The ownership remains with the collection.


function asVectorLayer

QgsVectorLayer * QfMarkupCollection::asVectorLayer () 

Returns a pointer to a memory vector layer matching the content of the collection.

The layer geometry type is a GeometryCollection and it can be used to modify the attributes and geometries of individual markup items within the collection.

Note:

The ownership remains with the collection.


function count [2/2]

inline qsizetype QfMarkupCollection::count () const

Returns the number of items in the collection.


function extent

Q_INVOKABLE QgsRectangle QfMarkupCollection::extent () const

Returns the combined extent of all item geometries within the collection.


function items [2/2]

inline QList< QfMarkupItem > QfMarkupCollection::items () const

Returns the list of items in the collection.


function name [2/2]

inline QString QfMarkupCollection::name () const

Returns the name of the collection.


function readGeoJson

bool QfMarkupCollection::readGeoJson (
    const QString & path
) 

Restore a collection from the content of a GeoJSON at the provided path.


function removeItem

Q_INVOKABLE void QfMarkupCollection::removeItem (
    const QString & uuid,
    bool resetVectorLayer=true
) 

Removes an item matching the provided uuid from the collection.


function replaceItem

Q_INVOKABLE void QfMarkupCollection::replaceItem (
    const QString & uuid,
    const QfMarkupItem & item,
    bool resetVectorLayer=true
) 

Replaces an item matching the provided uuid with a new item within the collection.


function setName

void QfMarkupCollection::setName (
    const QString & name
) 

Sets the name of the collection.


function uuid [2/2]

inline QString QfMarkupCollection::uuid () const

Returns the UUID of the collection.


function writeGeoJson

bool QfMarkupCollection::writeGeoJson (
    const QString & path
) 

Saves the collection from the content of a GeoJSON at the provided path.


Public Static Functions Documentation

function createItem

static Q_INVOKABLE QfMarkupItem QfMarkupCollection::createItem (
    const QString & label,
    const QString & description,
    const QgsGeometry & geometry,
    const QColor & color
) 


The documentation for this class was generated from the following file src/core/qfmarkupcollection.h