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 );
190 if ( nextPart ) nextPart->setProblemIds( probFid, lpId );
197 double cost()
const {
return mCost; }
204 void setCost(
double newCost ) { mCost = newCost; }
212 void setConflictsWithObstacle(
bool conflicts );
227 double getX(
int i = 0 )
const;
233 double getY(
int i = 0 )
const;
241 double getAlpha()
const;
259 void removeFromIndex( RTree<LabelPosition *, double, 2, double> *index );
260 void insertIntoIndex( RTree<LabelPosition *, double, 2, double> *index );
269 static bool pruneCallback(
LabelPosition *candidatePosition,
void *ctx );
276 double *cost =
nullptr;
277 double *inactiveCost =
nullptr;
284 static bool countOverlapCallback(
LabelPosition *lp,
void *ctx );
286 static bool countFullOverlapCallback(
LabelPosition *lp,
void *ctx );
288 static bool removeOverlapCallback(
LabelPosition *lp,
void *ctx );
291 static bool polygonObstacleCallback(
pal::FeaturePart *obstacle,
void *ctx );
325 bool mHasObstacleConflict;
326 int mUpsideDownCharCount;
331 int partCount()
const;
337 double polygonIntersectionCostForParts(
PointSet *polygon )
const;
int upsideDownCharCount() const
Returns the number of upside down characters for this label position.
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.
double cost() const
Returns the candidate label position's geographical cost.
bool conflictsWithObstacle() const
Returns whether the position is marked as conflicting with an obstacle feature.
int getProblemFeatureId() const
Quadrant getQuadrant() const
LabelPosition * getNextPart() const
Main class to handle feature.
bool getUpsideDown() const
void setNextPart(LabelPosition *next)
LabelPosition is a candidate feature label position.
int getNumOverlaps() const
Quadrant
Position of label candidate relative to feature.
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