QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsmaptoolshaperegistry.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaptoolshaperegistry.h
3 ----------------------
4 begin : January 2022
5 copyright : (C) 2022 by Denis Rouzaud
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSMAPTOOLSHAPEREGISTRY_H
19#define QGSMAPTOOLSHAPEREGISTRY_H
20
21#define SIP_NO_FILE
22
23#include "qgis_gui.h"
26
29
36{
37 Q_GADGET
38 public:
39
44
46
51
56 void removeMapTool( const QString &id );
57
59 QList<QgsMapToolShapeMetadata *> mapToolMetadatas() const { return mMapTools; }
60
62 QgsMapToolShapeMetadata *mapToolMetadata( const QString &id ) const;
63
68 QgsMapToolShapeAbstract *mapTool( const QString &id, QgsMapToolCapture *parentTool ) const SIP_FACTORY;
69
70 private:
71 QList<QgsMapToolShapeMetadata *> mMapTools;
72};
73
80{
81 public:
83
84 virtual ~QgsMapToolShapeMetadata() = default;
85
87 virtual QString id() const = 0;
88
90 virtual QString name() const = 0;
91
93 virtual QIcon icon() const = 0;
94
97
103};
104
105
106#endif // QGSMAPTOOLSHAPEREGISTRY_H
Base class for map tools capable of capturing point, lines and polygons.
Base class for shape map tools to be used by QgsMapToolCapture.
ShapeCategory
List of different shapes.
Base class for shape map tools metadata to be used in QgsMapToolShapeRegistry.
virtual QString name() const =0
Translated readable name.
virtual QgsMapToolShapeAbstract::ShapeCategory category() const =0
Returns the shape category of the tool.
QgsMapToolShapeMetadata()=default
virtual QIcon icon() const =0
Icon to be displayed in the toolbar.
virtual ~QgsMapToolShapeMetadata()=default
virtual QgsMapToolShapeAbstract * factory(QgsMapToolCapture *parentlTool) const =0
Creates the shape map tool for the given parentTool Caller takes ownership of the returned object.
virtual QString id() const =0
Unique ID for the shape map tool.
QgsMapToolShapeAbstract * mapTool(const QString &id, QgsMapToolCapture *parentTool) const
Constructs the map tool at the given id for the given parentTool Caller takes ownership of the return...
QList< QgsMapToolShapeMetadata * > mapToolMetadatas() const
Returns the list of map tools.
void removeMapTool(const QString &id)
Removes a registered map tool at the given id The tool will be deleted.
void addMapTool(QgsMapToolShapeMetadata *mapTool)
Adds a new shape map tool.
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:84