QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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 "qgscalloutposition.h"
26#include "qgslabelposition.h"
27#include "qgsmapsettings.h"
28
29#include <QList>
30#include <QVector>
31
32class QgsPointXY;
33
34#ifndef SIP_RUN
35namespace pal
36{
37 class LabelPosition;
38}
39#endif
40
41// TODO QGIS 4.0 - this should be private, not exposed to SIP
42
49class CORE_EXPORT QgsLabelSearchTree
50{
51 public:
52
55
58
63 Q_DECL_DEPRECATED void clear() SIP_DEPRECATED;
64
65 //TODO: why does this break bindings with QList<QgsLabelPosition>?
66
71 void label( const QgsPointXY &p, QList<QgsLabelPosition *> &posList ) const SIP_SKIP;
72
73 //TODO: why does this break bindings with QList<QgsLabelPosition>?
74
80 QList< QgsLabelPosition > allLabels() const;
81
86 void labelsInRect( const QgsRectangle &r, QList<QgsLabelPosition *> &posList ) const SIP_SKIP;
87
93 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;
94
102 bool insertCallout( const QgsCalloutPosition &position ) SIP_SKIP;
103
113 QList<const QgsCalloutPosition *> calloutsInRectangle( const QgsRectangle &rectangle ) const;
114
123 QList<QgsLabelPosition *> groupedLabelPositions( long long groupId ) const SIP_SKIP;
124
129 void setMapSettings( const QgsMapSettings &settings );
130
131 private:
133 long long mNextFeatureId = 1;
134 QHash< long long, QList< QgsLabelPosition * > > mLinkedLabelHash;
135 std::vector< std::unique_ptr< QgsLabelPosition > > mOwnedPositions;
137 std::vector< std::unique_ptr< QgsCalloutPosition > > mOwnedCalloutPositions;
138 QgsMapSettings mMapSettings;
139 QTransform mTransform;
140
141#ifdef SIP_RUN
144#endif
145};
146
147#endif // QGSLABELTREE_H
Represents the calculated placement of a map label callout line.
A generic rtree spatial index based on a libspatialindex backend.
Represents the calculated placement of a map label.
QList< QgsLabelPosition * > groupedLabelPositions(long long groupId) const
Returns a list of all label positions sharing the same group ID (i.e.
QgsLabelSearchTree & operator=(const QgsLabelSearchTree &rh)=delete
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)
Inserts label position.
Q_DECL_DEPRECATED void clear()
Removes and deletes all the entries.
void label(const QgsPointXY &p, QList< QgsLabelPosition * > &posList) const
Returns label position(s) at a given point.
QgsLabelSearchTree(const QgsLabelSearchTree &rh)=delete
void labelsInRect(const QgsRectangle &r, QList< QgsLabelPosition * > &posList) const
Returns label position(s) in given rectangle.
QList< const QgsCalloutPosition * > calloutsInRectangle(const QgsRectangle &rectangle) const
Returns the list of callouts with origins or destinations inside the given rectangle.
bool insertCallout(const QgsCalloutPosition &position)
Inserts a rendered callout position.
void setMapSettings(const QgsMapSettings &settings)
Sets the map settings associated with the labeling run.
QList< QgsLabelPosition > allLabels() const
Returns a list of all labels generated by the labeling run.
Contains configuration for rendering maps.
Represents a 2D point.
Definition qgspointxy.h:60
A rectangle specified with double values.
LabelPosition is a candidate feature label position.
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_SKIP
Definition qgis_sip.h:134
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features