Branch data Line data Source code
1 : : /*************************************************************************** 2 : : qgslabelfeature.h 3 : : --------------------- 4 : : begin : December 2015 5 : : copyright : (C) 2015 by Martin Dobias 6 : : email : wonder dot sk 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 : : #ifndef QGSLABELFEATURE_H 16 : : #define QGSLABELFEATURE_H 17 : : 18 : : #define SIP_NO_FILE 19 : : 20 : : #include "qgis_core.h" 21 : : #include "qgspallabeling.h" 22 : : #include "geos_c.h" 23 : : #include "qgsgeos.h" 24 : : #include "qgsmargins.h" 25 : : #include "qgslabelobstaclesettings.h" 26 : : #include "qgslabeling.h" 27 : : 28 : : namespace pal 29 : : { 30 : : class Layer; 31 : : } 32 : : 33 : : class QgsAbstractLabelProvider; 34 : : class QgsRenderContext; 35 : : class QgsGeometry; 36 : : 37 : : 38 : : /** 39 : : * \ingroup core 40 : : * \brief The QgsLabelFeature class describes a feature that 41 : : * should be used within the labeling engine. Those may be the usual textual labels, 42 : : * diagrams, or any other custom type of map annotations (generated by custom 43 : : * label providers). 44 : : * 45 : : * Instances only contain data relevant to the labeling engine (geometry, label size etc.) 46 : : * necessary for the layout. Rendering of labels is done by label providers. 47 : : * 48 : : * Individual label providers may create subclasses of QgsLabelFeature in order to add 49 : : * more data to the instances that will be later used for drawing of labels. 50 : : * 51 : : * \note this class is not a part of public API yet. See notes in QgsLabelingEngine 52 : : * \note not available in Python bindings 53 : : * \since QGIS 2.12 54 : : */ 55 : : class CORE_EXPORT QgsLabelFeature 56 : : { 57 : : public: 58 : : 59 : : //! Create label feature, takes ownership of the geometry instance 60 : : QgsLabelFeature( QgsFeatureId id, geos::unique_ptr geometry, QSizeF size ); 61 : : //! Clean up geometry and curved label info (if present) 62 : : virtual ~QgsLabelFeature(); 63 : : 64 : : //! Identifier of the label (unique within the parent label provider) 65 : 0 : QgsFeatureId id() const { return mId; } 66 : : 67 : : //! Gets access to the associated geometry 68 : 0 : GEOSGeometry *geometry() const { return mGeometry.get(); } 69 : : 70 : : /** 71 : : * Sets the label's permissible zone geometry. If set, the feature's label MUST be fully contained 72 : : * within this zone, and the feature will not be labeled if no candidates can be generated which 73 : : * are not contained within the zone. 74 : : * \param geometry permissible zone geometry. If an invalid QgsGeometry is passed then no zone limit 75 : : * will be applied to the label candidates (this is the default behavior). 76 : : * \see permissibleZone() 77 : : * \since QGIS 3.0 78 : : */ 79 : : void setPermissibleZone( const QgsGeometry &geometry ); 80 : : 81 : : /** 82 : : * Returns the label's permissible zone geometry. If a valid geometry is returned, the feature's label 83 : : * MUST be fully contained within this zone, and the feature will not be labeled if no candidates can be 84 : : * generated which are not contained within the zone. 85 : : * \see setPermissibleZone() 86 : : * \see permissibleZonePrepared() 87 : : * \since QGIS 3.0 88 : : */ 89 : 0 : QgsGeometry permissibleZone() const { return mPermissibleZone; } 90 : : 91 : : /** 92 : : * Returns a GEOS prepared geometry representing the label's permissibleZone(). 93 : : * \see permissibleZone() 94 : : * \since QGIS 3.0 95 : : */ 96 : : //TODO - remove when QgsGeometry caches GEOS preparedness 97 : 0 : const GEOSPreparedGeometry *permissibleZonePrepared() const { return mPermissibleZoneGeosPrepared.get(); } 98 : : 99 : : //! Size of the label (in map units) 100 : : QSizeF size( double angle = 0.0 ) const; 101 : : 102 : : /** 103 : : * Sets the visual margin for the label feature. The visual margin represents a margin 104 : : * within the label which should not be considered when calculating the positions of candidates 105 : : * for the label feature. It is used in certain label placement modes to adjust the position 106 : : * of candidates so that they all appear to be at visually equal distances from a point feature. 107 : : * For instance, this can be used to place labels which sit above a point so that their baseline 108 : : * rather then the descender of the label is at a preset distance from the point. 109 : : * \param margin visual margins for label 110 : : * \see visualMargin() 111 : : */ 112 : 0 : void setVisualMargin( const QgsMargins &margin ) { mVisualMargin = margin; } 113 : : 114 : : /** 115 : : * Returns the visual margin for the label feature. 116 : : * \see setVisualMargin() for details 117 : : */ 118 : 0 : const QgsMargins &visualMargin() const { return mVisualMargin; } 119 : : 120 : : /** 121 : : * Sets the size of the rendered symbol associated with this feature. This size is taken into 122 : : * account in certain label placement modes to avoid placing labels over the rendered 123 : : * symbol for this feature. 124 : : * \see symbolSize() 125 : : */ 126 : 0 : void setSymbolSize( QSizeF size ) { mSymbolSize = size; } 127 : : 128 : : /** 129 : : * Returns the size of the rendered symbol associated with this feature, if applicable. 130 : : * This size is taken into account in certain label placement modes to avoid placing labels over 131 : : * the rendered symbol for this feature. The size will only be set for labels associated 132 : : * with a point feature. 133 : : * \see symbolSize() 134 : : */ 135 : 0 : const QSizeF &symbolSize() const { return mSymbolSize; } 136 : : 137 : : /** 138 : : * Returns the feature's labeling priority. 139 : : * \returns feature's priority, as a value between 0 (highest priority) 140 : : * and 1 (lowest priority). Returns -1.0 if feature will use the layer's default priority. 141 : : * \see setPriority 142 : : */ 143 : 0 : double priority() const { return mPriority; } 144 : : 145 : : /** 146 : : * Sets the priority for labeling the feature. 147 : : * \param priority feature's priority, as a value between 0 (highest priority) 148 : : * and 1 (lowest priority). Set to -1.0 to use the layer's default priority 149 : : * for this feature. 150 : : * \see priority 151 : : */ 152 : 0 : void setPriority( double priority ) { mPriority = priority; } 153 : : 154 : : /** 155 : : * Returns the label's z-index. Higher z-index labels are rendered on top of lower 156 : : * z-index labels. 157 : : * \see setZIndex() 158 : : * \since QGIS 2.14 159 : : */ 160 : 0 : double zIndex() const { return mZIndex; } 161 : : 162 : : /** 163 : : * Sets the label's z-index. Higher z-index labels are rendered on top of lower 164 : : * z-index labels. 165 : : * \param zIndex z-index for label 166 : : * \see zIndex() 167 : : * \since QGIS 2.14 168 : : */ 169 : 0 : void setZIndex( double zIndex ) { mZIndex = zIndex; } 170 : : 171 : : //! Whether the label should use a fixed position instead of being automatically placed 172 : 0 : bool hasFixedPosition() const { return mHasFixedPosition; } 173 : : //! Sets whether the label should use a fixed position instead of being automatically placed 174 : 0 : void setHasFixedPosition( bool enabled ) { mHasFixedPosition = enabled; } 175 : : //! Coordinates of the fixed position (relevant only if hasFixedPosition() returns TRUE) 176 : 0 : QgsPointXY fixedPosition() const { return mFixedPosition; } 177 : : 178 : : //! Sets coordinates of the fixed position (relevant only if hasFixedPosition() returns TRUE) 179 : 0 : void setFixedPosition( const QgsPointXY &point ) { mFixedPosition = point; } 180 : : 181 : : /** 182 : : * In case of quadrand or aligned positioning, this is set to the anchor point. 183 : : * This can be used for proper vector based output like DXF. 184 : : * 185 : : * \since QGIS 3.12 186 : : */ 187 : : QgsPointXY anchorPosition() const; 188 : : 189 : : /** 190 : : * In case of quadrand or aligned positioning, this is set to the anchor point. 191 : : * This can be used for proper vector based output like DXF. 192 : : * 193 : : * \since QGIS 3.12 194 : : */ 195 : : void setAnchorPosition( const QgsPointXY &anchorPosition ); 196 : : 197 : : //! Whether the label should use a fixed angle instead of using angle from automatic placement 198 : 0 : bool hasFixedAngle() const { return mHasFixedAngle; } 199 : : //! Sets whether the label should use a fixed angle instead of using angle from automatic placement 200 : 0 : void setHasFixedAngle( bool enabled ) { mHasFixedAngle = enabled; } 201 : : //! Angle in degrees of the fixed angle (relevant only if hasFixedAngle() returns TRUE) 202 : 0 : double fixedAngle() const { return mFixedAngle; } 203 : : //! Sets angle in degrees of the fixed angle (relevant only if hasFixedAngle() returns TRUE) 204 : 0 : void setFixedAngle( double angle ) { mFixedAngle = angle; } 205 : : 206 : : /** 207 : : * Returns whether the quadrant for the label is fixed. 208 : : * Applies to "around point" placement strategy. 209 : : * \see setHasFixedQuadrant 210 : : * \see quadOffset 211 : : */ 212 : 0 : bool hasFixedQuadrant() const { return mHasFixedQuadrant; } 213 : : 214 : : /** 215 : : * Sets whether the quadrant for the label must be respected. This can be used 216 : : * to fix the quadrant for specific features when using an "around point" placement. 217 : : * \see hasFixedQuadrant 218 : : * \see quadOffset 219 : : */ 220 : 0 : void setHasFixedQuadrant( bool enabled ) { mHasFixedQuadrant = enabled; } 221 : : 222 : : /** 223 : : * Applies to "offset from point" placement strategy and "around point" (in case hasFixedQuadrant() returns TRUE). 224 : : * Determines which side of the point to use. 225 : : * For X coordinate, values -1, 0, 1 mean left, center, right. 226 : : * For Y coordinate, values -1, 0, 1 mean above, center, below. 227 : : */ 228 : 0 : QPointF quadOffset() const { return mQuadOffset; } 229 : : 230 : : /** 231 : : * Set which side of the point to use 232 : : * \see quadOffset 233 : : */ 234 : 0 : void setQuadOffset( QPointF quadOffset ) { mQuadOffset = quadOffset; } 235 : : 236 : : /** 237 : : * Applies only to "offset from point" placement strategy. 238 : : * What offset (in map units) to use from the point 239 : : */ 240 : 0 : QgsPointXY positionOffset() const { return mPositionOffset; } 241 : : 242 : : /** 243 : : * Applies only to "offset from point" placement strategy. 244 : : * Set what offset (in map units) to use from the point 245 : : */ 246 : 0 : void setPositionOffset( const QgsPointXY &offset ) { mPositionOffset = offset; } 247 : : 248 : : /** 249 : : * Returns the offset type, which determines how offsets and distance to label 250 : : * behaves. Support depends on which placement mode is used for generating 251 : : * label candidates. 252 : : * \see setOffsetType() 253 : : */ 254 : 0 : QgsPalLayerSettings::OffsetType offsetType() const { return mOffsetType; } 255 : : 256 : : /** 257 : : * Sets the offset type, which determines how offsets and distance to label 258 : : * behaves. Support depends on which placement mode is used for generating 259 : : * label candidates. 260 : : * \see offsetType() 261 : : */ 262 : 0 : void setOffsetType( QgsPalLayerSettings::OffsetType type ) { mOffsetType = type; } 263 : : 264 : : /** 265 : : * Applies to "around point" placement strategy or linestring features. 266 : : * Distance of the label from the feature (in map units) 267 : : */ 268 : 0 : double distLabel() const { return mDistLabel; } 269 : : 270 : : /** 271 : : * Applies to "around point" placement strategy or linestring features. 272 : : * Set distance of the label from the feature (in map units) 273 : : */ 274 : 0 : void setDistLabel( double dist ) { mDistLabel = dist; } 275 : : 276 : : /** 277 : : * Returns the priority ordered list of predefined positions for label candidates. This property 278 : : * is only used for OrderedPositionsAroundPoint placements. 279 : : * \see setPredefinedPositionOrder() 280 : : */ 281 : 0 : QVector< QgsPalLayerSettings::PredefinedPointPosition > predefinedPositionOrder() const { return mPredefinedPositionOrder; } 282 : : 283 : : /** 284 : : * Sets the priority ordered list of predefined positions for label candidates. This property 285 : : * is only used for OrderedPositionsAroundPoint placements. 286 : : * \see predefinedPositionOrder() 287 : : */ 288 : 0 : void setPredefinedPositionOrder( const QVector< QgsPalLayerSettings::PredefinedPointPosition > &order ) { mPredefinedPositionOrder = order; } 289 : : 290 : : /** 291 : : * Applies only to linestring features - after what distance (in map units) 292 : : * the labels should be repeated (0 = no repetitions) 293 : : */ 294 : 0 : double repeatDistance() const { return mRepeatDistance; } 295 : : 296 : : /** 297 : : * Applies only to linestring features - set after what distance (in map units) 298 : : * the labels should be repeated (0 = no repetitions) 299 : : */ 300 : 0 : void setRepeatDistance( double dist ) { mRepeatDistance = dist; } 301 : : 302 : : //! Whether label should be always shown (sets very high label priority) 303 : 0 : bool alwaysShow() const { return mAlwaysShow; } 304 : : //! Sets whether label should be always shown (sets very high label priority) 305 : 0 : void setAlwaysShow( bool enabled ) { mAlwaysShow = enabled; } 306 : : 307 : : /** 308 : : * Returns the feature's arrangement flags. 309 : : * \see setArrangementFlags 310 : : */ 311 : 0 : QgsLabeling::LinePlacementFlags arrangementFlags() const { return mArrangementFlags; } 312 : : 313 : : /** 314 : : * Sets the feature's arrangement flags. 315 : : * \param flags arrangement flags 316 : : * \see arrangementFlags 317 : : */ 318 : 0 : void setArrangementFlags( QgsLabeling::LinePlacementFlags flags ) { mArrangementFlags = flags; } 319 : : 320 : : /** 321 : : * Returns the polygon placement flags, which dictate how polygon labels can be placed. 322 : : * 323 : : * \see setPolygonPlacementFlags() 324 : : * \since QGIS 3.14 325 : : */ 326 : 0 : QgsLabeling::PolygonPlacementFlags polygonPlacementFlags() const { return mPolygonPlacementFlags; } 327 : : 328 : : /** 329 : : * Sets the polygon placement \a flags, which dictate how polygon labels can be placed. 330 : : * 331 : : * \see polygonPlacementFlags() 332 : : * \since QGIS 3.14 333 : : */ 334 : 0 : void setPolygonPlacementFlags( QgsLabeling::PolygonPlacementFlags flags ) { mPolygonPlacementFlags = flags; } 335 : : 336 : : /** 337 : : * Text of the label 338 : : * 339 : : * Used also if "merge connected lines to avoid duplicate labels" is enabled 340 : : * to identify which features may be merged. 341 : : */ 342 : 0 : QString labelText() const { return mLabelText; } 343 : : //! Sets text of the label 344 : 0 : void setLabelText( const QString &text ) { mLabelText = text; } 345 : : 346 : : //! Gets PAL layer of the label feature. Should be only used internally in PAL 347 : 0 : pal::Layer *layer() const { return mLayer; } 348 : : //! Assign PAL layer to the label feature. Should be only used internally in PAL 349 : 0 : void setLayer( pal::Layer *layer ) { mLayer = layer; } 350 : : 351 : : //! Returns provider of this instance 352 : : QgsAbstractLabelProvider *provider() const; 353 : : 354 : : /** 355 : : * Returns the original feature associated with this label. 356 : : * \see setFeature() 357 : : * 358 : : * \since QGIS 3.10 359 : : */ 360 : : QgsFeature feature() const; 361 : : 362 : : /** 363 : : * Sets the original \a feature associated with this label. 364 : : * \see feature() 365 : : * 366 : : * \since QGIS 3.10 367 : : */ 368 : : void setFeature( const QgsFeature &feature ); 369 : : 370 : : /** 371 : : * Returns the feature symbol associated with this label. 372 : : * \see setSymbol() 373 : : * 374 : : * \since QGIS 3.10 375 : : */ 376 : 0 : const QgsSymbol *symbol() { return mSymbol; } 377 : : 378 : : /** 379 : : * Sets the feature \a symbol associated with this label. 380 : : * Ownership of \a symbol is not transferred to the label feature, . 381 : : * \see symbol() 382 : : * 383 : : * \since QGIS 3.10 384 : : */ 385 : 0 : void setSymbol( const QgsSymbol *symbol ) { mSymbol = symbol; } 386 : : 387 : : /** 388 : : * Returns the permissible distance (in map units) which labels are allowed to overrun the start 389 : : * or end of linear features. 390 : : * 391 : : * \see setOverrunDistance() 392 : : * \see overrunSmoothDistance() 393 : : * \since QGIS 3.10 394 : : */ 395 : : double overrunDistance() const; 396 : : 397 : : /** 398 : : * Sets the permissible \a distance (in map units) which labels are allowed to overrun the start 399 : : * or end of linear features. 400 : : * 401 : : * \see overrunDistance() 402 : : * \see setOverrunSmoothDistance() 403 : : * \since QGIS 3.10 404 : : */ 405 : : void setOverrunDistance( double distance ); 406 : : 407 : : /** 408 : : * Returns the distance (in map units) with which the ends of linear features are averaged over when 409 : : * calculating the direction at which to overrun labels. 410 : : * 411 : : * \see setOverrunSmoothDistance() 412 : : * \see overrunDistance() 413 : : * \since QGIS 3.10 414 : : */ 415 : : double overrunSmoothDistance() const; 416 : : 417 : : /** 418 : : * Sets the \a distance (in map units) with which the ends of linear features are averaged over when 419 : : * calculating the direction at which to overrun labels. 420 : : * 421 : : * \see overrunSmoothDistance() 422 : : * \see setOverrunDistance() 423 : : * \since QGIS 3.10 424 : : */ 425 : : void setOverrunSmoothDistance( double distance ); 426 : : 427 : : /** 428 : : * Returns the percent along the line at which labels should be placed, for line labels only. 429 : : * 430 : : * By default, this is 0.5 which indicates that labels should be placed as close to the 431 : : * center of the line as possible. A value of 0.0 indicates that the labels should be placed 432 : : * as close to the start of the line as possible, while a value of 1.0 pushes labels towards 433 : : * the end of the line. 434 : : * 435 : : * \see setLineAnchorPercent() 436 : : * \see lineAnchorType() 437 : : * \since QGIS 3.16 438 : : */ 439 : 0 : double lineAnchorPercent() const { return mLineAnchorPercent; } 440 : : 441 : : /** 442 : : * Sets the \a percent along the line at which labels should be placed, for line labels only. 443 : : * 444 : : * By default, this is 0.5 which indicates that labels should be placed as close to the 445 : : * center of the line as possible. A value of 0.0 indicates that the labels should be placed 446 : : * as close to the start of the line as possible, while a value of 1.0 pushes labels towards 447 : : * the end of the line. 448 : : * 449 : : * \see lineAnchorPercent() 450 : : * \see setLineAnchorType() 451 : : * \since QGIS 3.16 452 : : */ 453 : 0 : void setLineAnchorPercent( double percent ) { mLineAnchorPercent = percent; } 454 : : 455 : : 456 : : /** 457 : : * Returns the line anchor type, which dictates how the lineAnchorPercent() setting is 458 : : * handled. 459 : : * 460 : : * \see setLineAnchorType() 461 : : * \see lineAnchorPercent() 462 : : */ 463 : 0 : QgsLabelLineSettings::AnchorType lineAnchorType() const { return mLineAnchorType; } 464 : : 465 : : /** 466 : : * Sets the line anchor \a type, which dictates how the lineAnchorPercent() setting is 467 : : * handled. 468 : : * 469 : : * \see lineAnchorType() 470 : : * \see setLineAnchorPercent() 471 : : */ 472 : 0 : void setLineAnchorType( QgsLabelLineSettings::AnchorType type ) { mLineAnchorType = type; } 473 : : 474 : : /** 475 : : * Returns TRUE if all parts of the feature should be labeled. 476 : : * \see setLabelAllParts() 477 : : * \since QGIS 3.10 478 : : */ 479 : 0 : bool labelAllParts() const { return mLabelAllParts; } 480 : : 481 : : /** 482 : : * Sets whether all parts of the feature should be labeled. 483 : : * \see labelAllParts() 484 : : * \since QGIS 3.10 485 : : */ 486 : 0 : void setLabelAllParts( bool labelAllParts ) { mLabelAllParts = labelAllParts; } 487 : : 488 : : /** 489 : : * Sets an alternate label \a size to be used when a label rotation angle is between 45 to 135 490 : : * and 235 to 313 degrees and the text rotation mode is set to rotation-based. 491 : : * \since QGIS 3.10 492 : : */ 493 : 0 : void setRotatedSize( QSizeF size ) { mRotatedSize = size; } 494 : : 495 : : /** 496 : : * Returns the label's obstacle settings. 497 : : * 498 : : * \see setObstacleSettings() 499 : : * \since QGIS 3.12 500 : : */ 501 : : const QgsLabelObstacleSettings &obstacleSettings() const; 502 : : 503 : : /** 504 : : * Sets the label's obstacle \a settings. 505 : : * 506 : : * \see obstacleSettings() 507 : : * \since QGIS 3.12 508 : : */ 509 : : void setObstacleSettings( const QgsLabelObstacleSettings &settings ); 510 : : 511 : : /** 512 : : * Returns the original layer CRS of the feature associated with the label. 513 : : * 514 : : * \see setOriginalFeatureCrs() 515 : : * \since QGIS 3.20 516 : : */ 517 : : QgsCoordinateReferenceSystem originalFeatureCrs() const; 518 : : 519 : : /** 520 : : * Sets the original layer \a crs of the feature associated with the label. 521 : : * 522 : : * \see originalFeatureCrs() 523 : : * \since QGIS 3.20 524 : : */ 525 : : void setOriginalFeatureCrs( const QgsCoordinateReferenceSystem &crs ); 526 : : 527 : : /** 528 : : * Returns the minimum size (in map unit) for a feature to be labelled. 529 : : * 530 : : * \note At the moment this is only used when labeling merged lines 531 : : * \see minimumSize() 532 : : * \since QGIS 3.20 533 : : */ 534 : 0 : double minimumSize() const { return mMinimumSize; } 535 : : 536 : : /** 537 : : * Sets the minimum \a size (in map unit) for a feature to be labelled. 538 : : * 539 : : * \note At the moment this is only used when labeling merged lines 540 : : * \see setMinimumSize() 541 : : * \since QGIS 3.20 542 : : */ 543 : 0 : void setMinimumSize( double size ) { mMinimumSize = size; } 544 : : 545 : : protected: 546 : : //! Pointer to PAL layer (assigned when registered to PAL) 547 : : pal::Layer *mLayer = nullptr; 548 : : 549 : : //! Associated ID unique within the parent label provider 550 : : QgsFeatureId mId; 551 : : //! Geometry of the feature to be labelled 552 : : geos::unique_ptr mGeometry; 553 : : //! Optional geometry to use for label's permissible zone 554 : : QgsGeometry mPermissibleZone; 555 : : //! Width and height of the label 556 : : QSizeF mSize; 557 : : //! Width and height of the label when rotated between 45 to 135 and 235 to 315 degrees; 558 : : QSizeF mRotatedSize; 559 : : //! Visual margin of label contents 560 : : QgsMargins mVisualMargin; 561 : : //! Size of associated rendered symbol, if applicable 562 : : QSizeF mSymbolSize; 563 : : //! Priority of the label 564 : : double mPriority = -1; 565 : : //! Z-index of label (higher z-index labels are rendered on top of lower z-index labels) 566 : : double mZIndex = 0; 567 : : //! whether mFixedPosition should be respected 568 : : bool mHasFixedPosition = false; 569 : : //! fixed position for the label (instead of automatic placement) 570 : : QgsPointXY mFixedPosition; 571 : : //! whether mFixedAngle should be respected 572 : : bool mHasFixedAngle = false; 573 : : //! fixed rotation for the label (instead of automatic choice) 574 : : double mFixedAngle = 0; 575 : : //! whether mQuadOffset should be respected (only for "around point" placement) 576 : : bool mHasFixedQuadrant = false; 577 : : //! whether the side of the label is fixed (only for "around point" placement) 578 : : QPointF mQuadOffset; 579 : : //! offset of label from the feature (only for "offset from point" placement) 580 : : QgsPointXY mPositionOffset; 581 : : //! distance of label from the feature (only for "around point" placement or linestrings) 582 : : double mDistLabel = 0; 583 : : //! Offset type for certain placement modes 584 : : QgsPalLayerSettings::OffsetType mOffsetType = QgsPalLayerSettings::FromPoint; 585 : : //! Ordered list of predefined positions for label (only for OrderedPositionsAroundPoint placement) 586 : : QVector< QgsPalLayerSettings::PredefinedPointPosition > mPredefinedPositionOrder; 587 : : //! distance after which label should be repeated (only for linestrings) 588 : : double mRepeatDistance = 0; 589 : : //! whether to always show label - even in case of collisions 590 : : bool mAlwaysShow = false; 591 : : //! text of the label 592 : : QString mLabelText; 593 : : 594 : : //! Distance to allow label to overrun linear features 595 : : double mOverrunDistance = 0; 596 : : //! Distance to smooth angle of line start and end when calculating overruns 597 : : double mOverrunSmoothDistance = 0; 598 : : 599 : : QgsLabeling::LinePlacementFlags mArrangementFlags = QgsLabeling::LinePlacementFlags(); 600 : : QgsLabeling::PolygonPlacementFlags mPolygonPlacementFlags = QgsLabeling::PolygonPlacementFlag::AllowPlacementInsideOfPolygon; 601 : : 602 : : private: 603 : : 604 : : //! GEOS geometry on which mPermissibleZoneGeosPrepared is based on 605 : : geos::unique_ptr mPermissibleZoneGeos; 606 : : 607 : : // TODO - not required when QgsGeometry caches geos preparedness 608 : : geos::prepared_unique_ptr mPermissibleZoneGeosPrepared; 609 : : 610 : : QgsFeature mFeature; 611 : : 612 : : const QgsSymbol *mSymbol = nullptr; 613 : : 614 : : bool mLabelAllParts = false; 615 : : 616 : : QgsLabelObstacleSettings mObstacleSettings{}; 617 : : 618 : : QgsPointXY mAnchorPosition; 619 : : 620 : : double mLineAnchorPercent = 0.5; 621 : : QgsLabelLineSettings::AnchorType mLineAnchorType = QgsLabelLineSettings::AnchorType::HintOnly; 622 : : 623 : : QgsCoordinateReferenceSystem mOriginalFeatureCrs; 624 : : 625 : : double mMinimumSize = 0.0; 626 : : 627 : : }; 628 : : 629 : : #endif // QGSLABELFEATURE_H