Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move QgsLabelPosition out to own file
- Loading branch information
1 parent
f083876
commit a513f5a
Showing
6 changed files
with
239 additions
and
189 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
python/core/auto_generated/labeling/qgslabelposition.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/labeling/qgslabelposition.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsLabelPosition | ||
{ | ||
%Docstring | ||
Represents the calculated placement of a map label. | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslabelposition.h" | ||
%End | ||
public: | ||
|
||
QgsLabelPosition( QgsFeatureId id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram = false, bool pinned = false, const QString &providerId = QString(), | ||
const QgsGeometry &labelGeometry = QgsGeometry(), bool isUnplaced = false ); | ||
%Docstring | ||
Constructor for QgsLabelPosition. | ||
|
||
:param id: associated feature ID | ||
:param r: label rotation in degrees clockwise | ||
:param corners: corner points of label bounding box, in map units | ||
:param rect: label bounding box, in map units | ||
:param w: width of label, in map units | ||
:param h: height of label, in map units | ||
:param layer: ID of associated map layer | ||
:param labeltext: text rendered for label | ||
:param labelfont: font used to render label | ||
:param upside_down: ``True`` if label is upside down | ||
:param diagram: ``True`` if label is a diagram | ||
:param pinned: ``True`` if label has pinned placement | ||
:param providerId: ID of associated label provider | ||
:param labelGeometry: polygon geometry of label boundary | ||
:param isUnplaced: set to ``True`` if label was unplaced (e.g. due to collisions with other labels) | ||
%End | ||
|
||
QgsLabelPosition(); | ||
%Docstring | ||
Constructor for QgsLabelPosition | ||
%End | ||
|
||
QgsFeatureId featureId; | ||
|
||
double rotation; | ||
|
||
QVector< QgsPointXY > cornerPoints; | ||
QgsRectangle labelRect; | ||
|
||
QgsGeometry labelGeometry; | ||
|
||
double width; | ||
|
||
double height; | ||
|
||
QString layerID; | ||
|
||
QString labelText; | ||
|
||
QFont labelFont; | ||
|
||
bool upsideDown; | ||
|
||
bool isDiagram; | ||
|
||
bool isPinned; | ||
|
||
QString providerID; | ||
|
||
bool isUnplaced; | ||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/labeling/qgslabelposition.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
/*************************************************************************** | ||
qgslabelposition.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 QGSLABELPOSITION_H | ||
#define QGSLABELPOSITION_H | ||
|
||
#include "qgis_core.h" | ||
#include "qgis_sip.h" | ||
|
||
#include "qgspointxy.h" | ||
#include "qgsrectangle.h" | ||
#include "qgsgeometry.h" | ||
|
||
#include <QFont> | ||
|
||
/** | ||
* \ingroup core | ||
* \class QgsLabelPosition | ||
* \brief Represents the calculated placement of a map label. | ||
*/ | ||
class CORE_EXPORT QgsLabelPosition | ||
{ | ||
public: | ||
|
||
/** | ||
* Constructor for QgsLabelPosition. | ||
* \param id associated feature ID | ||
* \param r label rotation in degrees clockwise | ||
* \param corners corner points of label bounding box, in map units | ||
* \param rect label bounding box, in map units | ||
* \param w width of label, in map units | ||
* \param h height of label, in map units | ||
* \param layer ID of associated map layer | ||
* \param labeltext text rendered for label | ||
* \param labelfont font used to render label | ||
* \param upside_down TRUE if label is upside down | ||
* \param diagram TRUE if label is a diagram | ||
* \param pinned TRUE if label has pinned placement | ||
* \param providerId ID of associated label provider | ||
* \param labelGeometry polygon geometry of label boundary | ||
* \param isUnplaced set to TRUE if label was unplaced (e.g. due to collisions with other labels) | ||
*/ | ||
QgsLabelPosition( QgsFeatureId id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram = false, bool pinned = false, const QString &providerId = QString(), | ||
const QgsGeometry &labelGeometry = QgsGeometry(), bool isUnplaced = false ) | ||
: featureId( id ) | ||
, rotation( r ) | ||
, cornerPoints( corners ) | ||
, labelRect( rect ) | ||
, labelGeometry( labelGeometry ) | ||
, width( w ) | ||
, height( h ) | ||
, layerID( layer ) | ||
, labelText( labeltext ) | ||
, labelFont( labelfont ) | ||
, upsideDown( upside_down ) | ||
, isDiagram( diagram ) | ||
, isPinned( pinned ) | ||
, providerID( providerId ) | ||
, isUnplaced( isUnplaced ) | ||
{} | ||
|
||
//! Constructor for QgsLabelPosition | ||
QgsLabelPosition() = default; | ||
|
||
/** | ||
* ID of feature associated with this label. | ||
*/ | ||
QgsFeatureId featureId = FID_NULL; | ||
|
||
/** | ||
* Rotation of label, in degrees clockwise. | ||
*/ | ||
double rotation = 0; | ||
|
||
QVector< QgsPointXY > cornerPoints; | ||
QgsRectangle labelRect; | ||
|
||
/** | ||
* A polygon geometry representing the label's bounds in map coordinates. | ||
* \since QGIS 3.4.9 | ||
*/ | ||
QgsGeometry labelGeometry; | ||
|
||
/** | ||
* Width of label bounding box, in map units. | ||
*/ | ||
double width = 0; | ||
|
||
/** | ||
* Heeght of label bounding box, in map units. | ||
*/ | ||
double height = 0; | ||
|
||
/** | ||
* ID of associated map layer. | ||
*/ | ||
QString layerID; | ||
|
||
/** | ||
* String shown in label. | ||
*/ | ||
QString labelText; | ||
|
||
/** | ||
* Font which the label is rendered using. | ||
*/ | ||
QFont labelFont; | ||
|
||
/** | ||
* TRUE if label is upside down. | ||
*/ | ||
bool upsideDown = false; | ||
|
||
/** | ||
* TRUE if label is a diagram. | ||
*/ | ||
bool isDiagram = false; | ||
|
||
/** | ||
* TRUE if label position has been pinned. | ||
*/ | ||
bool isPinned = false; | ||
|
||
/** | ||
* ID of the associated label provider. | ||
* \since QGIS 2.14 | ||
*/ | ||
QString providerID; | ||
|
||
/** | ||
* TRUE if label position corresponds to an unplaced label. | ||
* \since QGIS 3.10 | ||
*/ | ||
bool isUnplaced = false; | ||
}; | ||
|
||
#endif // QGSLABELPOSITION_H |
Oops, something went wrong.