QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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:
42 {
43 PolygonInterior,
44 PolygonBoundary,
45 PolygonWhole
46 };
47
54 bool isObstacle() const { return mIsObstacle; }
55
62 void setIsObstacle( bool isObstacle ) { mIsObstacle = isObstacle; }
63
72 double factor() const { return mObstacleFactor; }
73
82 void setFactor( double factor ) { mObstacleFactor = factor; }
83
90 ObstacleType type() const { return mObstacleType; }
91
98 void setType( ObstacleType type ) { mObstacleType = type; }
99
108 void setObstacleGeometry( const QgsGeometry &obstacleGeom );
109
114 QgsGeometry obstacleGeometry() const;
115
120 void updateDataDefinedProperties( const QgsPropertyCollection &properties, QgsExpressionContext &context );
121
122 private:
123 bool mIsObstacle = true;
124 double mObstacleFactor = 1.0;
125 ObstacleType mObstacleType = ObstacleType::PolygonBoundary;
126
128 QgsGeometry mObstacleGeometry;
129};
130
131#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 an integer key value.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:267