Branch data Line data Source code
1 : : /*************************************************************************** 2 : : qgslabeling.h 3 : : -------------------------- 4 : : Date : January 2020 5 : : Copyright : (C) 2020 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 QGSLABELING_H 17 : : #define QGSLABELING_H 18 : : 19 : : #include "qgis_core.h" 20 : : #include "qgis_sip.h" 21 : : #include <QFlags> 22 : : 23 : : /** 24 : : * \ingroup core 25 : : * \class QgsLabeling 26 : : * 27 : : * \brief Contains constants and enums relating to labeling. 28 : : * 29 : : * \since QGIS 3.12 30 : : */ 31 : : class CORE_EXPORT QgsLabeling 32 : : { 33 : : public: 34 : : 35 : : /** 36 : : * Line placement flags, which control how candidates are generated for a linear feature. 37 : : */ 38 : : enum LinePlacementFlag 39 : : { 40 : : OnLine = 1, //!< Labels can be placed directly over a line feature. 41 : : AboveLine = 2, //!< Labels can be placed above a line feature. Unless MapOrientation is also specified this mode respects the direction of the line feature, so a line from right to left labels will have labels placed placed below the line feature. 42 : : BelowLine = 4, //!< Labels can be placed below a line feature. Unless MapOrientation is also specified this mode respects the direction of the line feature, so a line from right to left labels will have labels placed placed above the line feature. 43 : : MapOrientation = 8, //!< Signifies that the AboveLine and BelowLine flags should respect the map's orientation rather than the feature's orientation. For example, AboveLine will always result in label's being placed above a line, regardless of the line's direction. 44 : : }; 45 : : Q_DECLARE_FLAGS( LinePlacementFlags, LinePlacementFlag ) 46 : : 47 : : /** 48 : : * Polygon placement flags, which control how candidates are generated for a polygon feature. 49 : : * 50 : : * \since QGIS 3.14 51 : : */ 52 : : enum PolygonPlacementFlag 53 : : { 54 : : AllowPlacementOutsideOfPolygon = 1 << 0, //!< Labels can be placed outside of a polygon feature 55 : : AllowPlacementInsideOfPolygon = 1 << 1, //!< Labels can be placed inside a polygon feature 56 : : }; 57 : : Q_DECLARE_FLAGS( PolygonPlacementFlags, PolygonPlacementFlag ) 58 : : 59 : : }; 60 : : 61 : 0 : Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLabeling::LinePlacementFlags ) 62 : : Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLabeling::PolygonPlacementFlags ) 63 : : 64 : : #endif // QGSLABELING_H