QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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 5.0 - this should be private, not exposed to SIP
42
49class CORE_EXPORT QgsLabelSearchTree
50{
51 public:
54
57
62 Q_DECL_DEPRECATED void clear() SIP_DEPRECATED;
63
64 //TODO: why does this break bindings with QList<QgsLabelPosition>?
65
70 void label( const QgsPointXY &p, QList<QgsLabelPosition *> &posList ) const SIP_SKIP;
71
72 //TODO: why does this break bindings with QList<QgsLabelPosition>?
73
79 QList< QgsLabelPosition > allLabels() const;
80
85 void labelsInRect( const QgsRectangle &r, QList<QgsLabelPosition *> &posList ) const SIP_SKIP;
86
92 bool insertLabel(
93 pal::LabelPosition *labelPos,
94 QgsFeatureId featureId,
95 const QString &layerName,
96 const QString &labeltext,
97 const QFont &labelfont,
98 bool diagram = false,
99 bool pinned = false,
100 const QString &providerId = QString(),
101 bool isUnplaced = false,
102 long long linkedId = 0
103 ) SIP_SKIP;
104
112 bool insertCallout( const QgsCalloutPosition &position ) SIP_SKIP;
113
123 QList<const QgsCalloutPosition *> calloutsInRectangle( const QgsRectangle &rectangle ) const;
124
133 QList<QgsLabelPosition *> groupedLabelPositions( long long groupId ) const SIP_SKIP;
134
139 void setMapSettings( const QgsMapSettings &settings );
140
141 private:
143 long long mNextFeatureId = 1;
144 QHash< long long, QList< QgsLabelPosition * > > mLinkedLabelHash;
145 std::vector< std::unique_ptr< QgsLabelPosition > > mOwnedPositions;
147 std::vector< std::unique_ptr< QgsCalloutPosition > > mOwnedCalloutPositions;
148 QgsMapSettings mMapSettings;
149 QTransform mTransform;
150
151#ifdef SIP_RUN
154#endif
155};
156
157#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:62
A rectangle specified with double values.
LabelPosition is a candidate feature label position.
#define SIP_DEPRECATED
Definition qgis_sip.h:113
#define SIP_SKIP
Definition qgis_sip.h:133
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features