QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
30 #ifndef LABELPOSITION_H
31 #define LABELPOSITION_H
36 #include "qgis_core.h"
58 friend class PolygonCostCalculator;
94 double alpha,
double cost,
95 FeaturePart *feature,
bool isReversed =
false, Quadrant quadrant = QuadrantOver );
105 bool isIn(
double *bbox );
112 bool isIntersect(
double *bbox );
117 bool intersects(
const GEOSPreparedGeometry *geometry );
122 bool within(
const GEOSPreparedGeometry *geometry );
129 bool isInside(
double *bbox );
140 void getBoundingBox(
double amin[2],
double amax[2] )
const;
143 double getDistanceToPoint(
double xp,
double yp )
const;
146 bool crossesLine(
PointSet *line )
const;
149 bool crossesBoundary(
PointSet *polygon )
const;
155 int polygonIntersectionCost(
PointSet *polygon )
const;
160 bool intersectsWithPolygon(
PointSet *polygon )
const;
163 void offsetPosition(
double xOffset,
double yOffset );
199 if ( mNextPart ) mNextPart->setProblemIds( probFid, lpId );
206 double cost()
const {
return mCost; }
213 void setCost(
double newCost ) { mCost = newCost; }
221 void setConflictsWithObstacle(
bool conflicts );
235 void setHasHardObstacleConflict(
bool conflicts );
252 double getX(
int i = 0 )
const;
258 double getY(
int i = 0 )
const;
266 double getAlpha()
const;
284 void setNextPart( std::unique_ptr< LabelPosition > next ) { mNextPart = std::move( next ); }
319 const GEOSPreparedGeometry *preparedMultiPartGeom()
const;
329 unsigned int globalId()
const {
return mGlobalId; }
342 double angleDifferential();
372 unsigned int mGlobalId = 0;
373 std::unique_ptr< LabelPosition > mNextPart;
376 bool mHasObstacleConflict;
377 bool mHasHardConflict =
false;
378 int mUpsideDownCharCount;
383 int partCount()
const;
389 double polygonIntersectionCostForParts(
PointSet *polygon )
const;
394 void createMultiPartGeosGeom()
const;
LabelPosition::Quadrant quadrant
Quadrant
Position of label candidate relative to feature.
int getProblemFeatureId() const
double cost() const
Returns the candidate label position's geographical cost.
LabelPosition is a candidate feature label position.
Quadrant getQuadrant() const
LabelPosition * nextPart() const
Returns the next part of this label position (i.e.
void setCost(double newCost)
Sets the candidate label position's geographical cost.
unsigned int globalId() const
Returns the global ID for the candidate, which is unique for a single run of the pal labelling engine...
Calculates label candidate costs considering different factors.
Main class to handle feature.
bool hasHardObstacleConflict() const
Returns whether the position is marked as having a hard conflict with an obstacle feature.
void setNextPart(std::unique_ptr< LabelPosition > next)
Sets the next part of this label position (i.e.
void decrementNumOverlaps()
Decreases the number of overlaps recorded against this position by 1.
bool getUpsideDown() const
void setProblemIds(int probFid, int lpId)
Set problem feature ID and assigned label candidate ID.
int getNumOverlaps() const
The underlying raw pal geometry class.
void incrementNumOverlaps()
Increases the number of overlaps recorded against this position by 1.
bool conflictsWithObstacle() const
Returns whether the position is marked as conflicting with an obstacle feature.
A rtree spatial index for use in the pal labeling engine.
int upsideDownCharCount() const
Returns the number of upside down characters for this label position.
void setGlobalId(unsigned int id)
Sets the global id for the candidate, which is unique for a single run of the pal labelling engine.
void setUpsideDownCharCount(int count)
Sets the count of upside down characters for this label position.