QGIS API Documentation
3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
src
gui
maptools
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
6
email :
[email protected]
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"
24
#include "
qgsabstractrelationeditorwidget.h
"
25
#include "
qgsmaptoolshapeabstract.h
"
26
27
class
QgsMapToolShapeMetadata
;
28
class
QgsMapToolCapture
;
29
35
class
GUI_EXPORT
QgsMapToolShapeRegistry
36
{
37
Q_GADGET
38
public
:
39
43
QgsMapToolShapeRegistry
();
44
45
~QgsMapToolShapeRegistry
();
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
QList<QgsMapToolShapeMetadata *> mMapTools;
72
};
73
79
class
GUI_EXPORT
QgsMapToolShapeMetadata
80
{
81
public
:
82
QgsMapToolShapeMetadata
() =
default
;
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
96
virtual
QgsMapToolShapeAbstract::ShapeCategory
category
()
const
= 0;
97
102
virtual
QgsMapToolShapeAbstract
*
factory
(
QgsMapToolCapture
*parentlTool )
const
SIP_FACTORY
= 0;
103
};
104
105
106
#endif
// QGSMAPTOOLSHAPEREGISTRY_H
QgsMapToolCapture
Base class for map tools capable of capturing point, lines and polygons.
Definition
qgsmaptoolcapture.h:50
QgsMapToolShapeAbstract
Base class for shape map tools to be used by QgsMapToolCapture.
Definition
qgsmaptoolshapeabstract.h:42
QgsMapToolShapeAbstract::ShapeCategory
ShapeCategory
List of different shapes.
Definition
qgsmaptoolshapeabstract.h:47
QgsMapToolShapeMetadata
Base class for shape map tools metadata to be used in QgsMapToolShapeRegistry.
Definition
qgsmaptoolshaperegistry.h:80
QgsMapToolShapeMetadata::name
virtual QString name() const =0
Translated readable name.
QgsMapToolShapeMetadata::category
virtual QgsMapToolShapeAbstract::ShapeCategory category() const =0
Returns the shape category of the tool.
QgsMapToolShapeMetadata::QgsMapToolShapeMetadata
QgsMapToolShapeMetadata()=default
QgsMapToolShapeMetadata::icon
virtual QIcon icon() const =0
Icon to be displayed in the toolbar.
QgsMapToolShapeMetadata::~QgsMapToolShapeMetadata
virtual ~QgsMapToolShapeMetadata()=default
QgsMapToolShapeMetadata::factory
virtual QgsMapToolShapeAbstract * factory(QgsMapToolCapture *parentlTool) const =0
Creates the shape map tool for the given parentTool Caller takes ownership of the returned object.
QgsMapToolShapeMetadata::id
virtual QString id() const =0
Unique ID for the shape map tool.
QgsMapToolShapeRegistry::mapTool
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...
Definition
qgsmaptoolshaperegistry.cpp:71
QgsMapToolShapeRegistry::mapToolMetadatas
QList< QgsMapToolShapeMetadata * > mapToolMetadatas() const
Returns the list of map tools.
Definition
qgsmaptoolshaperegistry.h:59
QgsMapToolShapeRegistry::removeMapTool
void removeMapTool(const QString &id)
Removes a registered map tool at the given id The tool will be deleted.
Definition
qgsmaptoolshaperegistry.cpp:43
QgsMapToolShapeRegistry::addMapTool
void addMapTool(QgsMapToolShapeMetadata *mapTool)
Adds a new shape map tool.
Definition
qgsmaptoolshaperegistry.cpp:32
QgsMapToolShapeRegistry::QgsMapToolShapeRegistry
QgsMapToolShapeRegistry()
Constructor.
Definition
qgsmaptoolshaperegistry.cpp:22
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:36
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:84
qgsabstractrelationeditorwidget.h
qgsmaptoolshapeabstract.h
Generated on
for QGIS API Documentation by
1.15.0