QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsadvanceddigitizingtoolsregistry.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsadvanceddigitizingtoolsregistry.cpp
3 -------------------
4 begin : July 27 2024
5 copyright : (C) 2024 by Mathieu Pellerin
6 email : mathieu at opengis dot ch
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
18#include "qgsapplication.h"
19
24
29
34
36{
37 addTool( new QgsAdvancedDigitizingToolMetadata( QStringLiteral( "circlesintersection" ),
38 QObject::tr( "2-Circle Point Intersection" ),
39 QgsApplication::getThemeIcon( QStringLiteral( "/cadtools/circlesintersection.svg" ) ),
41 {
42 return new QgsAdvancedDigitizingCirclesIntersectionTool( canvas, cadDockWidget );
43 } ) );
44}
45
47{
48 if ( mTools.contains( toolMetaData->name() ) )
49 return false;
50
51 mTools[toolMetaData->name()] = toolMetaData;
52
53 return true;
54}
55
56
58{
59 if ( !mTools.contains( name ) )
60 return false;
61
62 delete mTools.take( name );
63
64 return true;
65}
66
68{
69 if ( !mTools.contains( name ) )
70 return nullptr;
71
72 return mTools[name];
73}
74
76{
77 return mTools.keys();
78}
A advanced digitizing tools to handle the selection of a point at the intersection of two circles.
The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of...
Stores metadata about one advanced digitizing tool class.
QString name() const
Returns the tool's unique name.
virtual QgsAdvancedDigitizingTool * createTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Returns new tool of this type. Return nullptr on error.
Convenience metadata class that uses static functions to handle advanced digitizing tool creation.
QgsAdvancedDigitizingTool * createTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget) override
Returns new tool of this type. Return nullptr on error.
An abstract class for advanced digitizing tools.
bool removeTool(const QString &name)
Removes the advanced digitizing tool matching the provided name and return true on success.
bool addTool(QgsAdvancedDigitizingToolAbstractMetadata *toolMetaData)
Adds an advanced digitizing tool (take ownership) and return true on success.
QgsAdvancedDigitizingToolAbstractMetadata * toolMetadata(const QString &name)
Returns the advanced digitizing tool matching the provided name or nullptr when no match available.
void addDefaultTools()
Adds the default tools shipped in QGIS.
const QStringList toolMetadataNames() const
Returns the list of registered tool names.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Map canvas is a class for displaying all GIS data types on a canvas.