QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
src
core
annotations
qgsannotationlayer.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsannotationlayer.h
3
----------------
4
copyright : (C) 2019 by Sandro Mani
5
email : smani at sourcepole dot ch
6
***************************************************************************/
7
8
/***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16
17
#ifndef QGSANNOTATIONLAYER_H
18
#define QGSANNOTATIONLAYER_H
19
20
#include "qgis_core.h"
21
#include "
qgis_sip.h
"
22
#include "
qgsmaplayer.h
"
23
#include "
qgsmaplayerrenderer.h
"
24
25
class
QgsAnnotationItem
;
26
27
39
class
CORE_EXPORT
QgsAnnotationLayer
:
public
QgsMapLayer
40
{
41
Q_OBJECT
42
43
public
:
44
49
struct
LayerOptions
50
{
51
55
explicit
LayerOptions
(
const
QgsCoordinateTransformContext
&transformContext )
56
: transformContext( transformContext )
57
{}
58
62
QgsCoordinateTransformContext
transformContext
;
63
64
};
65
66
72
QgsAnnotationLayer
(
const
QString &name,
const
QgsAnnotationLayer::LayerOptions
&options );
73
~
QgsAnnotationLayer
()
override
;
74
78
void
reset();
79
87
QString addItem(
QgsAnnotationItem
*item
SIP_TRANSFER
);
88
92
bool
removeItem(
const
QString &
id
);
93
97
void
clear();
98
102
bool
isEmpty()
const
;
103
110
QMap<QString, QgsAnnotationItem *>
items
()
const
{
return
mItems; }
111
117
void
setOpacity(
double
opacity );
118
124
double
opacity
()
const
{
return
mOpacity; }
125
126
QgsAnnotationLayer
*
clone
() const override
SIP_FACTORY
;
127
QgsMapLayerRenderer
*createMapRenderer(
QgsRenderContext
&rendererContext ) override
SIP_FACTORY
;
128
QgsRectangle
extent() const override;
129
void
setTransformContext( const
QgsCoordinateTransformContext
&context ) override;
130
bool
readXml( const QDomNode &layerNode,
QgsReadWriteContext
&context ) override;
131
bool
writeXml( QDomNode &layer_node, QDomDocument &doc, const
QgsReadWriteContext
&context ) const override;
132
bool
writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const
QgsReadWriteContext
&, StyleCategories categories = AllStyleCategories ) const override;
133
bool
readSymbology( const QDomNode &node, QString &errorMessage,
QgsReadWriteContext
&context, StyleCategories categories = AllStyleCategories ) override;
134
135
private:
136
QMap<QString,
QgsAnnotationItem
*> mItems;
137
double
mOpacity = 1;
138
QgsCoordinateTransformContext
mTransformContext;
139
};
140
141
#endif // QGSANNOTATIONLAYER_H
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition:
qgscoordinatetransformcontext.h:58
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition:
qgsreadwritecontext.h:35
QgsMapLayer::clone
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
QgsRenderContext
Contains information about the context of a rendering operation.
Definition:
qgsrendercontext.h:58
QgsAnnotationLayer::LayerOptions
Setting options for loading annotation layers.
Definition:
qgsannotationlayer.h:50
QgsRectangle
A rectangle specified with double values.
Definition:
qgsrectangle.h:42
QgsAnnotationLayer::opacity
double opacity() const
Returns the opacity for the annotation layer, where opacity is a value between 0 (totally transparent...
Definition:
qgsannotationlayer.h:124
QgsMapLayerRenderer
Base class for utility classes that encapsulate information necessary for rendering of map layers.
Definition:
qgsmaplayerrenderer.h:51
SIP_FACTORY
#define SIP_FACTORY
Definition:
qgis_sip.h:76
qgsmaplayer.h
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition:
qgis_sip.h:36
qgsmaplayerrenderer.h
QgsAnnotationLayer::LayerOptions::transformContext
QgsCoordinateTransformContext transformContext
Coordinate transform context.
Definition:
qgsannotationlayer.h:62
QgsAnnotationLayer::items
QMap< QString, QgsAnnotationItem * > items() const
Returns a map of items contained in the layer, by unique item ID.
Definition:
qgsannotationlayer.h:110
QgsMapLayer
Base class for all map layer types.
Definition:
qgsmaplayer.h:83
QgsAnnotationLayer
Represents a map layer containing a set of georeferenced annotations, e.g.
Definition:
qgsannotationlayer.h:40
QgsAnnotationLayer::LayerOptions::LayerOptions
LayerOptions(const QgsCoordinateTransformContext &transformContext)
Constructor for LayerOptions.
Definition:
qgsannotationlayer.h:55
QgsAnnotationItem
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
Definition:
qgsannotationitem.h:39
Generated on Sat Oct 24 2020 17:43:09 for QGIS API Documentation by
1.8.20