QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgslabelsearchtree.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslabelsearchtree.h
3  Node for raster calculator tree
4  --------------------
5  begin : 2010-11-02
6  copyright : (C) 2010 by Marco Hugentobler
7  email : marco dot hugentobler at sourcepole dot ch
8 ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSLABELSEARCHTREE_H
20 #define QGSLABELSEARCHTREE_H
21 
22 #include "qgis_core.h"
23 #include "qgis_sip.h"
24 #include <QList>
25 #include <QVector>
26 #include "qgslabelposition.h"
27 #include "qgscalloutposition.h"
28 #include "qgsgenericspatialindex.h"
29 #include "qgsmapsettings.h"
30 
31 class QgsPointXY;
32 
33 #ifndef SIP_RUN
34 namespace pal
35 {
36  class LabelPosition;
37 }
38 #endif
39 
40 // TODO QGIS 4.0 - this should be private, not exposed to SIP
41 
46 class CORE_EXPORT QgsLabelSearchTree
47 {
48  public:
49 
55 
57  QgsLabelSearchTree( const QgsLabelSearchTree &rh ) = delete;
59  QgsLabelSearchTree &operator=( const QgsLabelSearchTree &rh ) = delete;
60 
65  Q_DECL_DEPRECATED void clear() SIP_DEPRECATED;
66 
67  //TODO: why does this break bindings with QList<QgsLabelPosition>?
68 
73  void label( const QgsPointXY &p, QList<QgsLabelPosition *> &posList ) const SIP_SKIP;
74 
75  //TODO: why does this break bindings with QList<QgsLabelPosition>?
76 
82  QList< QgsLabelPosition > allLabels() const;
83 
88  void labelsInRect( const QgsRectangle &r, QList<QgsLabelPosition *> &posList ) const SIP_SKIP;
89 
95  bool insertLabel( pal::LabelPosition *labelPos, QgsFeatureId featureId, const QString &layerName, const QString &labeltext, const QFont &labelfont, bool diagram = false, bool pinned = false, const QString &providerId = QString(), bool isUnplaced = false, long long linkedId = 0 ) SIP_SKIP;
96 
104  bool insertCallout( const QgsCalloutPosition &position ) SIP_SKIP;
105 
115  QList<const QgsCalloutPosition *> calloutsInRectangle( const QgsRectangle &rectangle ) const;
116 
125  QList<QgsLabelPosition *> groupedLabelPositions( long long groupId ) const SIP_SKIP;
126 
131  void setMapSettings( const QgsMapSettings &settings );
132 
133  private:
135  long long mNextFeatureId = 1;
136  QHash< long long, QList< QgsLabelPosition * > > mLinkedLabelHash;
137  std::vector< std::unique_ptr< QgsLabelPosition > > mOwnedPositions;
139  std::vector< std::unique_ptr< QgsCalloutPosition > > mOwnedCalloutPositions;
140  QgsMapSettings mMapSettings;
141  QTransform mTransform;
142 
143 #ifdef SIP_RUN
147  QgsLabelSearchTree &operator=( const QgsLabelSearchTree & );
148 #endif
149 };
150 
151 #endif // QGSLABELTREE_H
qgslabelposition.h
pal::LabelPosition
LabelPosition is a candidate feature label position.
Definition: labelposition.h:55
qgsmapsettings.h
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
pal
Definition: qgsdiagramrenderer.h:50
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
QgsGenericSpatialIndex< QgsLabelPosition >
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsCalloutPosition
Represents the calculated placement of a map label callout line.
Definition: qgscalloutposition.h:32
qgis_sip.h
qgscalloutposition.h
QgsPointXY
A class to represent a 2D point.
Definition: qgspointxy.h:58
QgsLabelSearchTree
A class to query the labeling structure at a given point (small wrapper around pal RTree class)
Definition: qgslabelsearchtree.h:46
QgsMapSettings
The QgsMapSettings class contains configuration for rendering of the map. The rendering itself is don...
Definition: qgsmapsettings.h:88
qgsgenericspatialindex.h
QgsFeatureId
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition: qgsfeatureid.h:28