QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgscreateannotationitemmaptool.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgscreateannotationitemmaptool.cpp
3 ------------------------
4 Date : September 2021
5 Copyright : (C) 2021 Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
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
17#include "qgsmapcanvas.h"
18#include "qgsannotationlayer.h"
19#include "qgsannotationitem.h"
20
22 : QObject( parent )
23 , mMapCanvas( canvas )
24 , mCadDockWidget( cadDockWidget )
25{
26
27}
28
30{
31 return mCreatedItem.release();
32}
33
35
37{
38 if ( QgsAnnotationLayer *res = qobject_cast< QgsAnnotationLayer * >( mMapCanvas->currentLayer() ) )
39 return res;
40 else
42}
43
45{
46 mCreatedItem.reset( item );
47 emit itemCreated();
48}
The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of...
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
Represents a map layer containing a set of georeferenced annotations, e.g.
QgsAnnotationLayer * targetLayer()
Returns the target layer for newly created items.
QgsAnnotationItem * takeCreatedItem()
Takes the newly created item from the tool, transferring ownership to the caller.
void pushCreatedItem(QgsAnnotationItem *item)
Pushes a created item to the handler.
QgsCreateAnnotationItemMapToolHandler(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, QObject *parent=nullptr)
Constructor for QgsCreateAnnotationItemMapToolHandler, with the specified parent object.
void itemCreated()
Emitted by the tool when a new annotation item has been created.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:93
QgsMapLayer * currentLayer()
returns current layer (set by legend widget)
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:481
QgsAnnotationLayer * mainAnnotationLayer()
Returns the main annotation layer associated with the project.