QGIS API Documentation 3.41.0-Master (af5edcb665c)
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:
43
45
49 void addMapTool( QgsMapToolShapeMetadata *mapTool SIP_TRANSFER );
50
55 void removeMapTool( const QString &id );
56
58 QList<QgsMapToolShapeMetadata *> mapToolMetadatas() const { return mMapTools; }
59
61 QgsMapToolShapeMetadata *mapToolMetadata( const QString &id ) const;
62
67 QgsMapToolShapeAbstract *mapTool( const QString &id, QgsMapToolCapture *parentTool ) const SIP_FACTORY;
68
69 private:
70 QList<QgsMapToolShapeMetadata *> mMapTools;
71};
72
79{
80 public:
82
83 virtual ~QgsMapToolShapeMetadata() = default;
84
86 virtual QString id() const = 0;
87
89 virtual QString name() const = 0;
90
92 virtual QIcon icon() const = 0;
93
96
102};
103
104
105#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