QGIS API Documentation
4.3.0-Master (1c7cf7431bd)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
annotations
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
16
#include "
qgscreateannotationitemmaptool.h
"
17
18
#include "
qgsannotationitem.h
"
19
#include "
qgsannotationlayer.h
"
20
#include "
qgsmapcanvas.h
"
21
22
#include "moc_qgscreateannotationitemmaptool.cpp"
23
24
QgsCreateAnnotationItemMapToolHandler::QgsCreateAnnotationItemMapToolHandler
(
QgsMapCanvas
*canvas,
QgsAdvancedDigitizingDockWidget
*cadDockWidget, QObject *parent )
25
: QObject( parent )
26
, mMapCanvas( canvas )
27
{
28
Q_UNUSED( cadDockWidget )
29
}
30
31
QgsAnnotationItem
*
QgsCreateAnnotationItemMapToolHandler::takeCreatedItem
()
32
{
33
return
mCreatedItem.release();
34
}
35
36
QgsCreateAnnotationItemMapToolHandler::~QgsCreateAnnotationItemMapToolHandler
() =
default
;
37
38
QgsAnnotationLayer
*
QgsCreateAnnotationItemMapToolHandler::targetLayer
()
39
{
40
if
(
QgsAnnotationLayer
*res = qobject_cast<QgsAnnotationLayer *>( mMapCanvas->currentLayer() ) )
41
return
res;
42
else
43
return
QgsProject::instance
()->
mainAnnotationLayer
();
44
}
45
46
void
QgsCreateAnnotationItemMapToolHandler::pushCreatedItem
(
QgsAnnotationItem
*item )
47
{
48
mCreatedItem.
reset
( item );
49
emit
itemCreated
();
50
}
QgsAdvancedDigitizingDockWidget
A dockable widget used to handle the CAD tools on top of a selection of map tools.
Definition
qgsadvanceddigitizingdockwidget.h:55
QgsAnnotationItem
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
Definition
qgsannotationitem.h:49
QgsAnnotationLayer
Represents a map layer containing a set of georeferenced annotations, e.g.
Definition
qgsannotationlayer.h:52
QgsAnnotationLayer::reset
void reset()
Resets the annotation layer to a default state, and clears all items from it.
Definition
qgsannotationlayer.cpp:110
QgsCreateAnnotationItemMapToolHandler::targetLayer
QgsAnnotationLayer * targetLayer()
Returns the target layer for newly created items.
Definition
qgscreateannotationitemmaptool.cpp:38
QgsCreateAnnotationItemMapToolHandler::~QgsCreateAnnotationItemMapToolHandler
~QgsCreateAnnotationItemMapToolHandler() override
QgsCreateAnnotationItemMapToolHandler::takeCreatedItem
QgsAnnotationItem * takeCreatedItem()
Takes the newly created item from the tool, transferring ownership to the caller.
Definition
qgscreateannotationitemmaptool.cpp:31
QgsCreateAnnotationItemMapToolHandler::pushCreatedItem
void pushCreatedItem(QgsAnnotationItem *item)
Pushes a created item to the handler.
Definition
qgscreateannotationitemmaptool.cpp:46
QgsCreateAnnotationItemMapToolHandler::QgsCreateAnnotationItemMapToolHandler
QgsCreateAnnotationItemMapToolHandler(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, QObject *parent=nullptr)
Constructor for QgsCreateAnnotationItemMapToolHandler, with the specified parent object.
Definition
qgscreateannotationitemmaptool.cpp:24
QgsCreateAnnotationItemMapToolHandler::itemCreated
void itemCreated()
Emitted by the tool when a new annotation item has been created.
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition
qgsmapcanvas.h:96
QgsProject::instance
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition
qgsproject.cpp:490
QgsProject::mainAnnotationLayer
QgsAnnotationLayer * mainAnnotationLayer()
Returns the main annotation layer associated with the project.
Definition
qgsproject.cpp:5037
qgsannotationitem.h
qgsannotationlayer.h
qgscreateannotationitemmaptool.h
qgsmapcanvas.h
Generated on
for QGIS API Documentation by
1.17.0