mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
Move QgsLabelPosition out to own file
This commit is contained in:
parent
f083876383
commit
a513f5a1e6
87
python/core/auto_generated/labeling/qgslabelposition.sip.in
Normal file
87
python/core/auto_generated/labeling/qgslabelposition.sip.in
Normal file
@ -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 *
|
||||
************************************************************************/
|
@ -12,74 +12,6 @@
|
||||
|
||||
|
||||
|
||||
class QgsLabelPosition
|
||||
{
|
||||
%Docstring
|
||||
Represents the calculated placement of a map label.
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgspallabeling.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;
|
||||
};
|
||||
|
||||
class QgsPalLayerSettings
|
||||
{
|
||||
%Docstring
|
||||
|
@ -329,6 +329,7 @@
|
||||
%Include auto_generated/labeling/qgslabelingenginesettings.sip
|
||||
%Include auto_generated/labeling/qgslabellinesettings.sip
|
||||
%Include auto_generated/labeling/qgslabelobstaclesettings.sip
|
||||
%Include auto_generated/labeling/qgslabelposition.sip
|
||||
%Include auto_generated/labeling/qgslabelsearchtree.sip
|
||||
%Include auto_generated/labeling/qgslabelthinningsettings.sip
|
||||
%Include auto_generated/labeling/qgspallabeling.sip
|
||||
|
@ -1217,6 +1217,7 @@ set(QGIS_CORE_HDRS
|
||||
labeling/qgslabelingenginesettings.h
|
||||
labeling/qgslabellinesettings.h
|
||||
labeling/qgslabelobstaclesettings.h
|
||||
labeling/qgslabelposition.h
|
||||
labeling/qgslabelsearchtree.h
|
||||
labeling/qgslabelthinningsettings.h
|
||||
labeling/qgspallabeling.h
|
||||
|
149
src/core/labeling/qgslabelposition.h
Normal file
149
src/core/labeling/qgslabelposition.h
Normal file
@ -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
|
@ -46,6 +46,7 @@
|
||||
#include "qgslabelthinningsettings.h"
|
||||
#include "qgslabellinesettings.h"
|
||||
#include "qgslabeling.h"
|
||||
#include "qgslabelposition.h"
|
||||
|
||||
class QgsTextDocument;
|
||||
|
||||
@ -79,127 +80,6 @@ class QgsVectorLayerDiagramProvider;
|
||||
class QgsExpressionContext;
|
||||
class QgsCallout;
|
||||
|
||||
/**
|
||||
* \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;
|
||||
};
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
* \class QgsPalLayerSettings
|
||||
|
Loading…
x
Reference in New Issue
Block a user