QGIS API Documentation 3.41.0-Master (45a0abf3bec)
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
25#include "qgis_gui.h"
26
29
36{
37 Q_GADGET
38 public:
39
44
46
50 void addMapTool( QgsMapToolShapeMetadata *mapTool SIP_TRANSFER );
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
72 QList<QgsMapToolShapeMetadata *> mMapTools;
73
74};
75
82{
83 public:
84
86
87 virtual ~QgsMapToolShapeMetadata() = default;
88
90 virtual QString id() const = 0;
91
93 virtual QString name() const = 0;
94
96 virtual QIcon icon() const = 0;
97
100
106};
107
108
109#endif // QGSMAPTOOLSHAPEREGISTRY_H
QgsMapToolCapture is a base class capable of capturing point, lines and polygons.
QgsMapToolShapeAbstract is a base class for shape map tools to be used by QgsMapToolCapture.
ShapeCategory
List of different shapes.
QgsMapToolShapeMetadata is a base class for shape map tools metadata to be used in QgsMapToolShapeReg...
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.
Keeps track of the registered shape map tools.
QList< QgsMapToolShapeMetadata * > mapToolMetadatas() const
Returns the list of map tools.
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76