QGIS API Documentation  3.0.2-Girona (307d082)
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 "pointset.h"
27 #include "labelposition.h"
28 #include "qgspallabeling.h"
29 #include "rtree.hpp"
30 
31 class QgsPointXY;
32 
37 class CORE_EXPORT QgsLabelSearchTree
38 {
39  public:
40 
44  QgsLabelSearchTree() = default;
46 
48  QgsLabelSearchTree( const QgsLabelSearchTree &rh ) = delete;
50  QgsLabelSearchTree &operator=( const QgsLabelSearchTree &rh ) = delete;
51 
53  void clear();
54 
60  void label( const QgsPointXY &p, QList<QgsLabelPosition *> &posList ) const SIP_SKIP;
61 
67  void labelsInRect( const QgsRectangle &r, QList<QgsLabelPosition *> &posList ) const SIP_SKIP;
68 
74  bool insertLabel( pal::LabelPosition *labelPos, int featureId, const QString &layerName, const QString &labeltext, const QFont &labelfont, bool diagram = false, bool pinned = false, const QString &providerId = QString() ) SIP_SKIP;
75 
76  private:
77  // set as mutable because RTree template is not const-correct
78  mutable pal::RTree<QgsLabelPosition *, double, 2, double> mSpatialIndex;
79  QList< QgsLabelPosition * > mOwnedPositions;
80 
81 #ifdef SIP_RUN
85  QgsLabelSearchTree &operator=( const QgsLabelSearchTree & );
86 #endif
87 };
88 
89 #endif // QGSLABELTREE_H
A rectangle specified with double values.
Definition: qgsrectangle.h:39
A class to query the labeling structure at a given point (small wraper around pal RTree class) ...
A class to represent a 2D point.
Definition: qgspointxy.h:43
#define SIP_SKIP
Definition: qgis_sip.h:119
LabelPosition is a candidate feature label position.
Definition: labelposition.h:55