QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
labeling
qgslabelposition.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgslabelposition.h
3
-------------------
4
begin : February 2021
5
copyright : (C) 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
#ifndef QGSLABELPOSITION_H
17
#define QGSLABELPOSITION_H
18
19
#include "qgis_core.h"
20
#include "
qgis_sip.h
"
21
#include "
qgsgeometry.h
"
22
#include "
qgspointxy.h
"
23
#include "
qgsrectangle.h
"
24
25
#include <QFont>
26
#include <QString>
27
28
using namespace
Qt::StringLiterals;
29
35
class
CORE_EXPORT
QgsLabelPosition
36
{
37
public
:
56
QgsLabelPosition
(
57
QgsFeatureId
id
,
58
double
r,
59
const
QVector< QgsPointXY > &corners,
60
const
QgsRectangle
&rect,
61
double
w,
62
double
h,
63
const
QString &layer,
64
const
QString &labeltext,
65
const
QFont &labelfont,
66
bool
upside_down,
67
bool
diagram =
false
,
68
bool
pinned =
false
,
69
const
QString &providerId = QString(),
70
const
QgsGeometry
&
labelGeometry
=
QgsGeometry
(),
71
bool
isUnplaced
=
false
72
)
73
:
featureId
( id )
74
,
rotation
( r )
75
,
cornerPoints
( corners )
76
,
labelRect
( rect )
77
,
labelGeometry
(
labelGeometry
)
78
,
width
( w )
79
,
height
( h )
80
,
layerID
( layer )
81
,
labelText
( labeltext )
82
,
labelFont
( labelfont )
83
,
upsideDown
( upside_down )
84
,
isDiagram
( diagram )
85
,
isPinned
( pinned )
86
,
providerID
( providerId )
87
,
isUnplaced
(
isUnplaced
)
88
{}
89
90
QgsLabelPosition
() =
default
;
91
92
#ifdef SIP_RUN
93
// clang-format off
94
SIP_PYOBJECT __repr__();
95
% MethodCode
96
const
QString text = sipCpp->labelText;
97
QString str = u
"<QgsLabelPosition: \"%1\"%2>"
_s.arg( text, sipCpp->isUnplaced ? u
" (unplaced)"
_s : QString() );
98
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
99
% End
100
// clang-format on
101
#endif
102
106
QgsFeatureId
featureId
107
=
FID_NULL
;
108
112
double
rotation
= 0;
113
114
QVector< QgsPointXY >
cornerPoints
;
115
QgsRectangle
labelRect
;
116
121
QgsGeometry
labelGeometry
;
122
126
double
width
= 0;
127
131
double
height
= 0;
132
136
QString
layerID
;
137
141
QString
labelText
;
142
146
QFont
labelFont
;
147
151
bool
upsideDown
=
false
;
152
156
bool
isDiagram
=
false
;
157
161
bool
isPinned
=
false
;
162
166
QString
providerID
;
167
172
bool
isUnplaced
=
false
;
173
179
long
long
groupedLabelId
= 0;
180
186
long
long
groupedPositionIndex
= 0;
187
193
long
long
subPartId
= 0;
194
};
195
196
#endif
// QGSLABELPOSITION_H
QgsGeometry
A geometry is the spatial representation of a feature.
Definition
qgsgeometry.h:267
QgsLabelPosition::labelGeometry
QgsGeometry labelGeometry
A polygon geometry representing the label's bounds in map coordinates.
Definition
qgslabelposition.h:121
QgsLabelPosition::QgsLabelPosition
QgsLabelPosition(QgsFeatureId id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram=false, bool pinned=false, const QString &providerId=QString(), const QgsGeometry &labelGeometry=QgsGeometry(), bool isUnplaced=false)
Constructor for QgsLabelPosition.
Definition
qgslabelposition.h:56
QgsLabelPosition::isDiagram
bool isDiagram
true if label is a diagram.
Definition
qgslabelposition.h:156
QgsLabelPosition::featureId
QgsFeatureId featureId
ID of feature associated with this label.
Definition
qgslabelposition.h:107
QgsLabelPosition::labelText
QString labelText
String shown in label.
Definition
qgslabelposition.h:141
QgsLabelPosition::groupedPositionIndex
long long groupedPositionIndex
For grouped labels, indicates the character index for this particular position.
Definition
qgslabelposition.h:186
QgsLabelPosition::providerID
QString providerID
ID of the associated label provider.
Definition
qgslabelposition.h:166
QgsLabelPosition::isUnplaced
bool isUnplaced
true if label position corresponds to an unplaced label.
Definition
qgslabelposition.h:172
QgsLabelPosition::groupedLabelId
long long groupedLabelId
If non zero, indicates that the label position is part of a group of label positions (i....
Definition
qgslabelposition.h:179
QgsLabelPosition::QgsLabelPosition
QgsLabelPosition()=default
QgsLabelPosition::labelFont
QFont labelFont
Font which the label is rendered using.
Definition
qgslabelposition.h:146
QgsLabelPosition::subPartId
long long subPartId
Sub part identifier (for features which register multiple labels).
Definition
qgslabelposition.h:193
QgsLabelPosition::width
double width
Width of label bounding box, in map units.
Definition
qgslabelposition.h:126
QgsLabelPosition::height
double height
Heeght of label bounding box, in map units.
Definition
qgslabelposition.h:131
QgsLabelPosition::rotation
double rotation
Rotation of label, in degrees clockwise.
Definition
qgslabelposition.h:112
QgsLabelPosition::upsideDown
bool upsideDown
true if label is upside down.
Definition
qgslabelposition.h:151
QgsLabelPosition::labelRect
QgsRectangle labelRect
Definition
qgslabelposition.h:115
QgsLabelPosition::isPinned
bool isPinned
true if label position has been pinned.
Definition
qgslabelposition.h:161
QgsLabelPosition::cornerPoints
QVector< QgsPointXY > cornerPoints
Definition
qgslabelposition.h:114
QgsLabelPosition::layerID
QString layerID
ID of associated map layer.
Definition
qgslabelposition.h:136
QgsRectangle
A rectangle specified with double values.
Definition
qgsrectangle.h:47
qgis_sip.h
FID_NULL
#define FID_NULL
Definition
qgsfeatureid.h:33
QgsFeatureId
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition
qgsfeatureid.h:32
qgsgeometry.h
qgspointxy.h
qgsrectangle.h
Generated on
for QGIS API Documentation by
1.17.0