QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
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 "moc_qgscreateannotationitemmaptool.cpp"
18#include "qgsmapcanvas.h"
19#include "qgsannotationlayer.h"
20#include "qgsannotationitem.h"
21
23 : QObject( parent )
24 , mMapCanvas( canvas )
25{
26 Q_UNUSED( cadDockWidget )
27}
28
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.
QgsMapLayer * currentLayer()
returns current layer (set by legend widget)
static QgsProject * instance()
Returns the QgsProject singleton instance.
QgsAnnotationLayer * mainAnnotationLayer()
Returns the main annotation layer associated with the project.