QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgscalloutposition.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscalloutposition.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 QGSCALLOUTPOSITION_H
17#define QGSCALLOUTPOSITION_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21#include "qgsfeatureid.h"
22
23#include <QPointF>
24
31class CORE_EXPORT QgsCalloutPosition
32{
33 public:
34
41 QgsCalloutPosition( QgsFeatureId id, const QString &layer, const QString &providerId = QString() )
42 : featureId( id )
43 , layerID( layer )
44 , providerID( providerId )
45 {}
46
47 QgsCalloutPosition() = default;
48
53
57 QString layerID;
58
62 QString providerID;
63
72 QPointF origin() const { return mOrigin; }
73
82 void setOrigin( const QPointF &origin ) { mOrigin = origin; }
83
92 QPointF destination() const { return mDestination; }
93
102 void setDestination( const QPointF &destination ) { mDestination = destination; }
103
112 bool originIsPinned() const { return mOriginIsPinned; }
113
122 void setOriginIsPinned( bool pinned ) { mOriginIsPinned = pinned; }
123
132 bool destinationIsPinned() const { return mDestinationIsPinned; }
133
142 void setDestinationIsPinned( bool pinned ) { mDestinationIsPinned = pinned; }
143
144 private:
145
146 QPointF mOrigin;
147
148 QPointF mDestination;
149
150 bool mOriginIsPinned = false;
151 bool mDestinationIsPinned = false;
152};
153
154#endif // QGSCALLOUTPOSITION_H
QgsFeatureId featureId
ID of feature associated with this callout.
void setDestination(const QPointF &destination)
Sets the destination of the callout line, in map coordinates.
QString providerID
ID of the associated label provider.
QPointF origin() const
Returns the origin of the callout line, in map coordinates.
void setOrigin(const QPointF &origin)
Sets the origin of the callout line, in map coordinates.
QgsCalloutPosition()=default
QPointF destination() const
Returns the destination of the callout line, in map coordinates.
bool originIsPinned() const
Returns true if the origin of the callout has pinned (manually placed).
bool destinationIsPinned() const
Returns true if the destination of the callout has pinned (manually placed).
QgsCalloutPosition(QgsFeatureId id, const QString &layer, const QString &providerId=QString())
Constructor for QgsCalloutPosition.
QString layerID
ID of associated map layer.
void setDestinationIsPinned(bool pinned)
Sets whether the destination of the callout has pinned (manually placed).
void setOriginIsPinned(bool pinned)
Sets whether the origin of the callout has pinned (manually placed).
#define FID_NULL
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features