QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgslabelobstaclesettings.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslabelobstaclesettings.h
3 --------------------------
4 Date : December 2019
5 Copyright : (C) 2019 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSLABELOBSTACLESETTINGS_H
17#define QGSLABELOBSTACLESETTINGS_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21#include "qgsgeometry.h"
22
25
34class CORE_EXPORT QgsLabelObstacleSettings
35{
36 public:
37
43 {
44 PolygonInterior,
45 PolygonBoundary,
46 PolygonWhole
47 };
48
55 bool isObstacle() const
56 {
57 return mIsObstacle;
58 }
59
66 void setIsObstacle( bool isObstacle )
67 {
68 mIsObstacle = isObstacle;
69 }
70
79 double factor() const
80 {
81 return mObstacleFactor;
82 }
83
92 void setFactor( double factor )
93 {
94 mObstacleFactor = factor;
95 }
96
104 {
105 return mObstacleType;
106 }
107
115 {
116 mObstacleType = type;
117 }
118
127 void setObstacleGeometry( const QgsGeometry &obstacleGeom );
128
133 QgsGeometry obstacleGeometry() const;
134
139 void updateDataDefinedProperties( const QgsPropertyCollection &properties, QgsExpressionContext &context );
140
141 private:
142
143 bool mIsObstacle = true;
144 double mObstacleFactor = 1.0;
145 ObstacleType mObstacleType = ObstacleType::PolygonBoundary;
146
148 QgsGeometry mObstacleGeometry;
149
150};
151
152#endif // QGSLABELOBSTACLESETTINGS_H
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A geometry is the spatial representation of a feature.
Contains settings related to how the label engine treats features as obstacles.
double factor() const
Returns the obstacle factor, where 1.0 = default, < 1.0 more likely to be covered by labels,...
void setType(ObstacleType type)
Controls how features act as obstacles for labels.
ObstacleType type() const
Returns how features act as obstacles for labels.
ObstacleType
Valid obstacle types, which affect how features within the layer will act as obstacles for labels.
void setIsObstacle(bool isObstacle)
Sets whether features are obstacles to labels of other layers.
void setFactor(double factor)
Sets the obstacle factor, where 1.0 = default, < 1.0 more likely to be covered by labels,...
bool isObstacle() const
Returns true if the features are obstacles to labels of other layers.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:271