QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
22 #include "qgsfeatureid.h"
23 
24 #include <QPointF>
25 
32 class CORE_EXPORT QgsCalloutPosition
33 {
34  public:
35 
42  QgsCalloutPosition( QgsFeatureId id, const QString &layer, const QString &providerId = QString() )
43  : featureId( id )
44  , layerID( layer )
45  , providerID( providerId )
46  {}
47 
49  QgsCalloutPosition() = default;
50 
54  QgsFeatureId featureId = FID_NULL;
55 
59  QString layerID;
60 
64  QString providerID;
65 
74  QPointF origin() const { return mOrigin; }
75 
84  void setOrigin( const QPointF &origin ) { mOrigin = origin; }
85 
94  QPointF destination() const { return mDestination; }
95 
104  void setDestination( const QPointF &destination ) { mDestination = destination; }
105 
114  bool originIsPinned() const { return mOriginIsPinned; }
115 
124  void setOriginIsPinned( bool pinned ) { mOriginIsPinned = pinned; }
125 
134  bool destinationIsPinned() const { return mDestinationIsPinned; }
135 
144  void setDestinationIsPinned( bool pinned ) { mDestinationIsPinned = pinned; }
145 
146  private:
147 
148  QPointF mOrigin;
149 
150  QPointF mDestination;
151 
152  bool mOriginIsPinned = false;
153  bool mDestinationIsPinned = false;
154 };
155 
156 #endif // QGSCALLOUTPOSITION_H
QgsCalloutPosition::providerID
QString providerID
ID of the associated label provider.
Definition: qgscalloutposition.h:64
QgsCalloutPosition::destination
QPointF destination() const
Returns the destination of the callout line, in map coordinates.
Definition: qgscalloutposition.h:94
QgsCalloutPosition::QgsCalloutPosition
QgsCalloutPosition(QgsFeatureId id, const QString &layer, const QString &providerId=QString())
Constructor for QgsCalloutPosition.
Definition: qgscalloutposition.h:42
FID_NULL
#define FID_NULL
Definition: qgsfeatureid.h:29
qgsfeatureid.h
QgsCalloutPosition::origin
QPointF origin() const
Returns the origin of the callout line, in map coordinates.
Definition: qgscalloutposition.h:74
QgsCalloutPosition::setDestination
void setDestination(const QPointF &destination)
Sets the destination of the callout line, in map coordinates.
Definition: qgscalloutposition.h:104
QgsCalloutPosition
Represents the calculated placement of a map label callout line.
Definition: qgscalloutposition.h:32
qgis_sip.h
QgsCalloutPosition::setDestinationIsPinned
void setDestinationIsPinned(bool pinned)
Sets whether the destination of the callout has pinned (manually placed).
Definition: qgscalloutposition.h:144
QgsCalloutPosition::destinationIsPinned
bool destinationIsPinned() const
Returns true if the destination of the callout has pinned (manually placed).
Definition: qgscalloutposition.h:134
QgsCalloutPosition::setOrigin
void setOrigin(const QPointF &origin)
Sets the origin of the callout line, in map coordinates.
Definition: qgscalloutposition.h:84
QgsCalloutPosition::layerID
QString layerID
ID of associated map layer.
Definition: qgscalloutposition.h:59
QgsCalloutPosition::originIsPinned
bool originIsPinned() const
Returns true if the origin of the callout has pinned (manually placed).
Definition: qgscalloutposition.h:114
QgsFeatureId
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition: qgsfeatureid.h:28
QgsCalloutPosition::setOriginIsPinned
void setOriginIsPinned(bool pinned)
Sets whether the origin of the callout has pinned (manually placed).
Definition: qgscalloutposition.h:124