QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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 
34 class CORE_EXPORT QgsLabelObstacleSettings
35 {
36  public:
37 
43  {
44  PolygonInterior,
46  PolygonBoundary,
48  PolygonWhole
52  };
53 
60  bool isObstacle() const
61  {
62  return mIsObstacle;
63  }
64 
71  void setIsObstacle( bool isObstacle )
72  {
73  mIsObstacle = isObstacle;
74  }
75 
84  double factor() const
85  {
86  return mObstacleFactor;
87  }
88 
97  void setFactor( double factor )
98  {
99  mObstacleFactor = factor;
100  }
101 
109  {
110  return mObstacleType;
111  }
112 
119  void setType( ObstacleType type )
120  {
121  mObstacleType = type;
122  }
123 
132  void setObstacleGeometry( const QgsGeometry &obstacleGeom );
133 
138  QgsGeometry obstacleGeometry() const;
139 
144  void updateDataDefinedProperties( const QgsPropertyCollection &properties, QgsExpressionContext &context );
145 
146  private:
147 
148  bool mIsObstacle = true;
149  double mObstacleFactor = 1.0;
150  ObstacleType mObstacleType = PolygonBoundary;
151 
153  QgsGeometry mObstacleGeometry;
154 
155 };
156 
157 #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.
Definition: qgsgeometry.h:125
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.
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,...
ObstacleType
Valid obstacle types, which affect how features within the layer will act as obstacles for 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.