|
QGIS API Documentation
2.10.1-Pisa
|
LabelPosition is a candidate feature label position. More...
#include <labelposition.h>
Classes | |
| struct | CountContext |
| struct | PruneCtx |
Public Types | |
| enum | Quadrant { QuadrantAboveLeft, QuadrantAbove, QuadrantAboveRight, QuadrantLeft, QuadrantOver, QuadrantRight, QuadrantBelowLeft, QuadrantBelow, QuadrantBelowRight } |
| Position of label candidate relative to feature. More... | |
Public Member Functions | |
| LabelPosition (int id, double x1, double y1, double w, double h, double alpha, double cost, FeaturePart *feature, bool isReversed=false, Quadrant quadrant=QuadrantOver) | |
| create a new LabelPosition More... | |
| LabelPosition (const LabelPosition &other) | |
| copy constructor More... | |
| ~LabelPosition () | |
| double | getAlpha () const |
| get alpha More... | |
| void | getBoundingBox (double amin[2], double amax[2]) const |
| return bounding box - amin: xmin,ymin - amax: xmax,ymax More... | |
| double | getCost () const |
| get the position geographical cost More... | |
| double | getDistanceToPoint (double xp, double yp) |
| get distance from this label to a point. More... | |
| FeaturePart * | getFeaturePart () |
| return the feature corresponding to this labelposition More... | |
| double | getHeight () const |
| int | getId () const |
| return id More... | |
| char * | getLayerName () const |
| return pointer to layer's name. More... | |
| LabelPosition * | getNextPart () const |
| double | getNumOverlaps () const |
| int | getNumPointsInPolygon (int npol, double *xp, double *yp) |
| returns number of intersections with polygon (testing border and center) More... | |
| int | getPartId () const |
| int | getProblemFeatureId () const |
| Quadrant | getQuadrant () const |
| bool | getReversed () const |
| bool | getUpsideDown () const |
| double | getWidth () const |
| double | getX (int i=0) const |
| get the down-left x coordinate More... | |
| double | getY (int i=0) const |
| get the down-left y coordinate More... | |
| void | insertIntoIndex (RTree< LabelPosition *, double, 2, double > *index) |
| bool | isBorderCrossingLine (PointSet *feat) |
| returns true if this label crosses the specified line More... | |
| bool | isIn (double *bbox) |
| Is the labelposition in the bounding-box ? (intersect or inside????) More... | |
| bool | isInConflict (LabelPosition *ls) |
| Check whether or not this overlap with another labelPosition. More... | |
| bool | isInside (double *bbox) |
| Is the labelposition inside the bounding-box ? More... | |
| bool | isIntersect (double *bbox) |
| Is the labelposition intersect the bounding-box ? More... | |
| void | offsetPosition (double xOffset, double yOffset) |
| shift the label by specified offset More... | |
| void | print () |
| void | removeFromIndex (RTree< LabelPosition *, double, 2, double > *index) |
| void | resetNumOverlaps () |
| void | setCost (double newCost) |
| Modify candidate's cost. More... | |
| void | setNextPart (LabelPosition *next) |
| void | setPartId (int id) |
| void | setProblemIds (int probFid, int lpId) |
| set problem feature ID and assigned label candidate ID. More... | |
| void | validateCost () |
| Make sure the cost is less than 1. More... | |
Static Public Member Functions | |
| static bool | costGrow (void *l, void *r) |
| static bool | costShrink (void *l, void *r) |
| static bool | countFullOverlapCallback (LabelPosition *lp, void *ctx) |
| static bool | countOverlapCallback (LabelPosition *lp, void *ctx) |
| static bool | polygonObstacleCallback (PointSet *feat, void *ctx) |
| static bool | pruneCallback (LabelPosition *lp, void *ctx) |
| Check whether the candidate in ctx overlap with obstacle feat. More... | |
| static bool | removeOverlapCallback (LabelPosition *lp, void *ctx) |
Protected Member Functions | |
| bool | isInConflictMultiPart (LabelPosition *lp) |
| bool | isInConflictSinglePart (LabelPosition *lp) |
Protected Attributes | |
| double | alpha |
| double | cost |
| FeaturePart * | feature |
| double | h |
| int | id |
| int | nbOverlap |
| LabelPosition * | nextPart |
| int | partId |
| int | probFeat |
| LabelPosition::Quadrant | quadrant |
| bool | reversed |
| bool | upsideDown |
| double | w |
| double | x [4] |
| double | y [4] |
Friends | |
| class | CostCalculator |
| class | PolygonCostCalculator |
LabelPosition is a candidate feature label position.
Definition at line 54 of file labelposition.h.
Position of label candidate relative to feature.
| Enumerator | |
|---|---|
| QuadrantAboveLeft | |
| QuadrantAbove | |
| QuadrantAboveRight | |
| QuadrantLeft | |
| QuadrantOver | |
| QuadrantRight | |
| QuadrantBelowLeft | |
| QuadrantBelow | |
| QuadrantBelowRight | |
Definition at line 64 of file labelposition.h.
| pal::LabelPosition::LabelPosition | ( | int | id, |
| double | x1, | ||
| double | y1, | ||
| double | w, | ||
| double | h, | ||
| double | alpha, | ||
| double | cost, | ||
| FeaturePart * | feature, | ||
| bool | isReversed = false, |
||
| Quadrant | quadrant = QuadrantOver |
||
| ) |
create a new LabelPosition
| id | id of this labelposition |
| x1 | down-left x coordinate |
| y1 | down-left y coordinate |
| w | label width |
| h | label height |
| alpha | rotation in rad |
| cost | geographic cost |
| feature | labelpos owners |
| isReversed | label is reversed |
| quadrant | relative position of label to feature |
Definition at line 57 of file labelposition.cpp.
| pal::LabelPosition::LabelPosition | ( | const LabelPosition & | other | ) |
copy constructor
Definition at line 160 of file labelposition.cpp.
|
inline |
Definition at line 132 of file labelposition.h.
|
static |
Definition at line 404 of file labelposition.cpp.
|
static |
Definition at line 399 of file labelposition.cpp.
|
static |
Definition at line 475 of file labelposition.cpp.
|
static |
Definition at line 461 of file labelposition.cpp.
| double pal::LabelPosition::getAlpha | ( | ) | const |
| void pal::LabelPosition::getBoundingBox | ( | double | amin[2], |
| double | amax[2] | ||
| ) | const |
return bounding box - amin: xmin,ymin - amax: xmax,ymax
Definition at line 367 of file labelposition.cpp.
| double pal::LabelPosition::getCost | ( | ) | const |
get the position geographical cost
Definition at line 348 of file labelposition.cpp.
| double pal::LabelPosition::getDistanceToPoint | ( | double | xp, |
| double | yp | ||
| ) |
get distance from this label to a point.
If point lies inside, returns negative number.
Definition at line 512 of file labelposition.cpp.
| FeaturePart * pal::LabelPosition::getFeaturePart | ( | ) |
return the feature corresponding to this labelposition
Definition at line 362 of file labelposition.cpp.
|
inline |
Definition at line 231 of file labelposition.h.
| int pal::LabelPosition::getId | ( | ) | const |
| char * pal::LabelPosition::getLayerName | ( | ) | const |
|
inline |
Definition at line 245 of file labelposition.h.
|
inline |
Definition at line 191 of file labelposition.h.
| int pal::LabelPosition::getNumPointsInPolygon | ( | int | npol, |
| double * | xp, | ||
| double * | yp | ||
| ) |
returns number of intersections with polygon (testing border and center)
Definition at line 596 of file labelposition.cpp.
|
inline |
Definition at line 249 of file labelposition.h.
|
inline |
Definition at line 194 of file labelposition.h.
|
inline |
Definition at line 241 of file labelposition.h.
|
inline |
Definition at line 238 of file labelposition.h.
|
inline |
Definition at line 239 of file labelposition.h.
|
inline |
Definition at line 230 of file labelposition.h.
| double pal::LabelPosition::getX | ( | int | i = 0 | ) | const |
get the down-left x coordinate
Definition at line 333 of file labelposition.cpp.
| double pal::LabelPosition::getY | ( | int | i = 0 | ) | const |
get the down-left y coordinate
Definition at line 338 of file labelposition.cpp.
| void pal::LabelPosition::insertIntoIndex | ( | RTree< LabelPosition *, double, 2, double > * | index | ) |
Definition at line 435 of file labelposition.cpp.
| bool pal::LabelPosition::isBorderCrossingLine | ( | PointSet * | feat | ) |
returns true if this label crosses the specified line
Definition at line 566 of file labelposition.cpp.
| bool pal::LabelPosition::isIn | ( | double * | bbox | ) |
Is the labelposition in the bounding-box ? (intersect or inside????)
| bbox | the bounding-box double[4] = {xmin, ymin, xmax, ymax} |
Definition at line 184 of file labelposition.cpp.
| bool pal::LabelPosition::isInConflict | ( | LabelPosition * | ls | ) |
Check whether or not this overlap with another labelPosition.
| ls | other labelposition |
Definition at line 247 of file labelposition.cpp.
|
protected |
Definition at line 295 of file labelposition.cpp.
|
protected |
Definition at line 258 of file labelposition.cpp.
| bool pal::LabelPosition::isInside | ( | double * | bbox | ) |
Is the labelposition inside the bounding-box ?
| bbox | the bounding-box double[4] = {xmin, ymin, xmax, ymax} |
Definition at line 219 of file labelposition.cpp.
| bool pal::LabelPosition::isIntersect | ( | double * | bbox | ) |
Is the labelposition intersect the bounding-box ?
| bbox | the bounding-box double[4] = {xmin, ymin, xmax, ymax} |
Definition at line 202 of file labelposition.cpp.
| void pal::LabelPosition::offsetPosition | ( | double | xOffset, |
| double | yOffset | ||
| ) |
shift the label by specified offset
Definition at line 315 of file labelposition.cpp.
|
static |
Definition at line 410 of file labelposition.cpp.
| void pal::LabelPosition::print | ( | ) |
Definition at line 235 of file labelposition.cpp.
|
static |
Check whether the candidate in ctx overlap with obstacle feat.
Definition at line 446 of file labelposition.cpp.
| void pal::LabelPosition::removeFromIndex | ( | RTree< LabelPosition *, double, 2, double > * | index | ) |
Definition at line 426 of file labelposition.cpp.
|
static |
Definition at line 496 of file labelposition.cpp.
|
inline |
Definition at line 192 of file labelposition.h.
|
inline |
Modify candidate's cost.
Definition at line 213 of file labelposition.h.
|
inline |
Definition at line 246 of file labelposition.h.
|
inline |
Definition at line 250 of file labelposition.h.
|
inline |
set problem feature ID and assigned label candidate ID.
called from pal.cpp during extraction
Definition at line 197 of file labelposition.h.
| void pal::LabelPosition::validateCost | ( | ) |
Make sure the cost is less than 1.
Definition at line 353 of file labelposition.cpp.
|
friend |
Definition at line 56 of file labelposition.h.
|
friend |
Definition at line 57 of file labelposition.h.
|
protected |
Definition at line 89 of file labelposition.h.
|
protected |
Definition at line 80 of file labelposition.h.
|
protected |
Definition at line 81 of file labelposition.h.
|
protected |
Definition at line 91 of file labelposition.h.
|
protected |
Definition at line 79 of file labelposition.h.
|
protected |
Definition at line 86 of file labelposition.h.
|
protected |
Definition at line 93 of file labelposition.h.
|
protected |
Definition at line 94 of file labelposition.h.
|
protected |
Definition at line 84 of file labelposition.h.
|
protected |
Definition at line 103 of file labelposition.h.
|
protected |
Definition at line 99 of file labelposition.h.
|
protected |
Definition at line 101 of file labelposition.h.
|
protected |
Definition at line 90 of file labelposition.h.
|
protected |
Definition at line 88 of file labelposition.h.
|
protected |
Definition at line 88 of file labelposition.h.
1.8.6