Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add rendered callout details to QgsLabelingResults for retrieval afte…
…r a map render completes
- Loading branch information
Showing
with
586 additions
and 5 deletions.
- +21 −0 python/core/auto_generated/callouts/qgscallout.sip.in
- +98 −0 python/core/auto_generated/labeling/qgscalloutposition.sip.in
- +10 −0 python/core/auto_generated/labeling/qgslabelingresults.sip.in
- +12 −0 python/core/auto_generated/labeling/qgslabelsearchtree.sip.in
- +1 −1 python/core/core_auto.sip
- +1 −0 src/app/labeling/qgsmaptoollabel.cpp
- +1 −1 src/app/labeling/qgsmaptoolshowhidelabels.cpp
- +1 −0 src/core/CMakeLists.txt
- +16 −2 src/core/callouts/qgscallout.cpp
- +22 −0 src/core/callouts/qgscallout.h
- +113 −0 src/core/labeling/qgscalloutposition.h
- +16 −0 src/core/labeling/qgslabelingresults.cpp
- +10 −1 src/core/labeling/qgslabelingresults.h
- +30 −0 src/core/labeling/qgslabelsearchtree.cpp
- +23 −0 src/core/labeling/qgslabelsearchtree.h
- +10 −0 src/core/labeling/qgsvectorlayerlabelprovider.cpp
- +201 −0 tests/src/core/testqgslabelingengine.cpp
@@ -0,0 +1,98 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/labeling/qgscalloutposition.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsCalloutPosition | ||
{ | ||
%Docstring | ||
Represents the calculated placement of a map label callout line. | ||
|
||
.. versionadded:: 3.20 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgscalloutposition.h" | ||
%End | ||
public: | ||
|
||
QgsCalloutPosition( QgsFeatureId id, const QString &layer, const QString &providerId = QString() ); | ||
%Docstring | ||
Constructor for QgsCalloutPosition. | ||
|
||
:param id: associated feature ID | ||
:param layer: ID of associated map layer | ||
:param providerId: ID of associated label provider | ||
%End | ||
|
||
QgsCalloutPosition(); | ||
%Docstring | ||
Constructor for QgsCalloutPosition | ||
%End | ||
|
||
QgsFeatureId featureId; | ||
|
||
QString layerID; | ||
|
||
QString providerID; | ||
|
||
QPointF origin() const; | ||
%Docstring | ||
Returns the origin of the callout line, in map coordinates. | ||
|
||
The origin of the callout line is the line point associated with the label text. | ||
|
||
.. seealso:: :py:func:`setOrigin` | ||
|
||
.. seealso:: :py:func:`destination` | ||
%End | ||
|
||
void setOrigin( const QPointF &origin ); | ||
%Docstring | ||
Sets the ``origin`` of the callout line, in map coordinates. | ||
|
||
The origin of the callout line is the line point associated with the label text. | ||
|
||
.. seealso:: :py:func:`origin` | ||
|
||
.. seealso:: :py:func:`setDestination` | ||
%End | ||
|
||
QPointF destination() const; | ||
%Docstring | ||
Returns the destination of the callout line, in map coordinates. | ||
|
||
The destination of the callout line is the line point associated with the feature's geometry. | ||
|
||
.. seealso:: :py:func:`setDestination` | ||
|
||
.. seealso:: :py:func:`origin` | ||
%End | ||
|
||
void setDestination( const QPointF &destination ); | ||
%Docstring | ||
Sets the ``destination`` of the callout line, in map coordinates. | ||
|
||
The destination of the callout line is the line point associated with the feature's geometry. | ||
|
||
.. seealso:: :py:func:`destination` | ||
|
||
.. seealso:: :py:func:`setOrigin` | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/labeling/qgscalloutposition.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
@@ -0,0 +1,113 @@ | ||
/*************************************************************************** | ||
qgscalloutposition.h | ||
------------------- | ||
begin : February 2021 | ||
copyright : (C) Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSCALLOUTPOSITION_H | ||
#define QGSCALLOUTPOSITION_H | ||
|
||
#include "qgis_core.h" | ||
#include "qgis_sip.h" | ||
|
||
#include "qgsfeatureid.h" | ||
|
||
#include <QPointF> | ||
|
||
/** | ||
* \ingroup core | ||
* \class QgsCalloutPosition | ||
* \brief Represents the calculated placement of a map label callout line. | ||
* \since QGIS 3.20 | ||
*/ | ||
class CORE_EXPORT QgsCalloutPosition | ||
{ | ||
public: | ||
|
||
/** | ||
* Constructor for QgsCalloutPosition. | ||
* \param id associated feature ID | ||
* \param layer ID of associated map layer | ||
* \param providerId ID of associated label provider | ||
*/ | ||
QgsCalloutPosition( QgsFeatureId id, const QString &layer, const QString &providerId = QString() ) | ||
: featureId( id ) | ||
, layerID( layer ) | ||
, providerID( providerId ) | ||
{} | ||
|
||
//! Constructor for QgsCalloutPosition | ||
QgsCalloutPosition() = default; | ||
|
||
/** | ||
* ID of feature associated with this callout. | ||
*/ | ||
QgsFeatureId featureId = FID_NULL; | ||
|
||
/** | ||
* ID of associated map layer. | ||
*/ | ||
QString layerID; | ||
|
||
/** | ||
* ID of the associated label provider. | ||
*/ | ||
QString providerID; | ||
|
||
/** | ||
* Returns the origin of the callout line, in map coordinates. | ||
* | ||
* The origin of the callout line is the line point associated with the label text. | ||
* | ||
* \see setOrigin() | ||
* \see destination() | ||
*/ | ||
QPointF origin() const { return mOrigin; } | ||
|
||
/** | ||
* Sets the \a origin of the callout line, in map coordinates. | ||
* | ||
* The origin of the callout line is the line point associated with the label text. | ||
* | ||
* \see origin() | ||
* \see setDestination() | ||
*/ | ||
void setOrigin( const QPointF &origin ) { mOrigin = origin; } | ||
|
||
/** | ||
* Returns the destination of the callout line, in map coordinates. | ||
* | ||
* The destination of the callout line is the line point associated with the feature's geometry. | ||
* | ||
* \see setDestination() | ||
* \see origin() | ||
*/ | ||
QPointF destination() const { return mDestination; } | ||
|
||
/** | ||
* Sets the \a destination of the callout line, in map coordinates. | ||
* | ||
* The destination of the callout line is the line point associated with the feature's geometry. | ||
* | ||
* \see destination() | ||
* \see setOrigin() | ||
*/ | ||
void setDestination( const QPointF &destination ) { mDestination = destination; } | ||
|
||
private: | ||
|
||
QPointF mOrigin; | ||
|
||
QPointF mDestination; | ||
}; | ||
|
||
#endif // QGSCALLOUTPOSITION_H |
Oops, something went wrong.