30 #ifndef LABELPOSITION_H 31 #define LABELPOSITION_H 36 #include "qgis_core.h" 94 double alpha,
double cost,
107 bool isIn(
double *bbox );
114 bool isIntersect(
double *bbox );
119 bool intersects(
const GEOSPreparedGeometry *geometry );
124 bool within(
const GEOSPreparedGeometry *geometry );
131 bool isInside(
double *bbox );
142 void getBoundingBox(
double amin[2],
double amax[2] )
const;
145 double getDistanceToPoint(
double xp,
double yp )
const;
148 bool crossesLine(
PointSet *line )
const;
151 bool crossesBoundary(
PointSet *polygon )
const;
157 int polygonIntersectionCost(
PointSet *polygon )
const;
162 bool intersectsWithPolygon(
PointSet *polygon )
const;
165 void offsetPosition(
double xOffset,
double yOffset );
192 if ( nextPart ) nextPart->setProblemIds( probFid, lpId );
199 double cost()
const {
return mCost; }
206 void setCost(
double newCost ) { mCost = newCost; }
214 void setConflictsWithObstacle(
bool conflicts );
229 double getX(
int i = 0 )
const;
235 double getY(
int i = 0 )
const;
244 double getAlpha()
const;
262 void removeFromIndex( RTree<LabelPosition *, double, 2, double> *index );
263 void insertIntoIndex( RTree<LabelPosition *, double, 2, double> *index );
272 static bool pruneCallback(
LabelPosition *candidatePosition,
void *ctx );
279 double *cost =
nullptr;
280 double *inactiveCost =
nullptr;
287 static bool countOverlapCallback(
LabelPosition *lp,
void *ctx );
289 static bool countFullOverlapCallback(
LabelPosition *lp,
void *ctx );
291 static bool removeOverlapCallback(
LabelPosition *lp,
void *ctx );
294 static bool polygonObstacleCallback(
pal::FeaturePart *obstacle,
void *ctx );
328 bool mHasObstacleConflict;
329 int mUpsideDownCharCount;
334 int partCount()
const;
340 double polygonIntersectionCostForParts(
PointSet *polygon )
const;
void setCost(double newCost)
Sets the candidate label position's geographical cost.
int incrementUpsideDownCharCount()
Increases the count of upside down characters for this label position.
int getProblemFeatureId() const
double cost() const
Returns the candidate label position's geographical cost.
LabelPosition * getNextPart() const
Quadrant getQuadrant() const
Main class to handle feature.
int upsideDownCharCount() const
Returns the number of upside down characters for this label position.
void setNextPart(LabelPosition *next)
bool conflictsWithObstacle() const
Returns whether the position is marked as conflicting with an obstacle feature.
int getNumOverlaps() const
LabelPosition is a candidate feature label position.
Quadrant
Position of label candidate relative to feature.
bool getUpsideDown() const
void setProblemIds(int probFid, int lpId)
Set problem feature ID and assigned label candidate ID.
Data structure to compute polygon's candidates costs.
LabelPosition::Quadrant quadrant
~LabelPosition() override