QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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
18#include "qgsannotationitem.h"
19#include "qgsannotationlayer.h"
20#include "qgsmapcanvas.h"
21
22#include "moc_qgscreateannotationitemmaptool.cpp"
23
25 : QObject( parent )
26 , mMapCanvas( canvas )
27{
28 Q_UNUSED( cadDockWidget )
29}
30
35
37
39{
40 if ( QgsAnnotationLayer *res = qobject_cast<QgsAnnotationLayer *>( mMapCanvas->currentLayer() ) )
41 return res;
42 else
44}
45
47{
48 mCreatedItem.reset( item );
49 emit itemCreated();
50}
A dockable widget used to handle the CAD tools on top of a selection of map tools.
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
Represents a map layer containing a set of georeferenced annotations, e.g.
void reset()
Resets the annotation layer to a default state, and clears all items from it.
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.
static QgsProject * instance()
Returns the QgsProject singleton instance.
QgsAnnotationLayer * mainAnnotationLayer()
Returns the main annotation layer associated with the project.