|
QGIS API Documentation
2.6.0-Brighton
|
LabelPositon is a candidate feature label position. More...
#include <labelposition.h>
Classes | |
| struct | CountContext |
| struct | PruneCtx |
Public Member Functions | |
| LabelPosition (int id, double x1, double y1, double w, double h, double alpha, double cost, FeaturePart *feature, bool isReversed=false) | |
| create a new LabelPosition | |
| LabelPosition (const LabelPosition &other) | |
| copy constructor | |
| ~LabelPosition () | |
| bool | isIn (double *bbox) |
| Is the labelposition in the bounding-box ? (intersect or inside????) | |
| bool | isIntersect (double *bbox) |
| Is the labelposition intersect the bounding-box ? | |
| bool | isInside (double *bbox) |
| Is the labelposition inside the bounding-box ? | |
| bool | isInConflict (LabelPosition *ls) |
| Check whether or not this overlap with another labelPosition. | |
| void | getBoundingBox (double amin[2], double amax[2]) const |
| return bounding box - amin: xmin,ymin - amax: xmax,ymax | |
| double | getDistanceToPoint (double xp, double yp) |
| get distance from this label to a point. | |
| bool | isBorderCrossingLine (PointSet *feat) |
| returns true if this label crosses the specified line | |
| int | getNumPointsInPolygon (int npol, double *xp, double *yp) |
| returns number of intersections with polygon (testing border and center) | |
| void | offsetPosition (double xOffset, double yOffset) |
| shift the label by specified offset | |
| int | getId () const |
| return id | |
| FeaturePart * | getFeaturePart () |
| return the feature corresponding to this labelposition | |
| double | getNumOverlaps () const |
| void | resetNumOverlaps () |
| int | getProblemFeatureId () const |
| void | setProblemIds (int probFid, int lpId) |
| set problem feature ID and assigned label candidate ID. | |
| char * | getLayerName () const |
| return pointer to layer's name. | |
| double | getCost () const |
| get the position geographical cost | |
| void | setCost (double newCost) |
| Modify candidate's cost. | |
| void | validateCost () |
| Make sure the cost is less than 1. | |
| double | getX (int i=0) const |
| get the down-left x coordinate | |
| double | getY (int i=0) const |
| get the down-left y coordinate | |
| double | getWidth () const |
| double | getHeight () const |
| double | getAlpha () const |
| get alpha | |
| bool | getReversed () const |
| bool | getUpsideDown () const |
| void | print () |
| LabelPosition * | getNextPart () const |
| void | setNextPart (LabelPosition *next) |
| int | getPartId () const |
| void | setPartId (int id) |
| void | removeFromIndex (RTree< LabelPosition *, double, 2, double > *index) |
| void | insertIntoIndex (RTree< LabelPosition *, double, 2, double > *index) |
Static Public Member Functions | |
| static bool | pruneCallback (LabelPosition *lp, void *ctx) |
| Check whether the candidate in ctx overlap with obstacle feat. | |
| static bool | costShrink (void *l, void *r) |
| static bool | costGrow (void *l, void *r) |
| static bool | countOverlapCallback (LabelPosition *lp, void *ctx) |
| static bool | countFullOverlapCallback (LabelPosition *lp, void *ctx) |
| static bool | removeOverlapCallback (LabelPosition *lp, void *ctx) |
| static bool | polygonObstacleCallback (PointSet *feat, void *ctx) |
Protected Member Functions | |
| bool | isInConflictSinglePart (LabelPosition *lp) |
| bool | isInConflictMultiPart (LabelPosition *lp) |
Protected Attributes | |
| int | id |
| double | cost |
| FeaturePart * | feature |
| int | probFeat |
| int | nbOverlap |
| double | x [4] |
| double | y [4] |
| double | alpha |
| double | w |
| double | h |
| LabelPosition * | nextPart |
| int | partId |
| bool | reversed |
| bool | upsideDown |
Friends | |
| class | CostCalculator |
| class | PolygonCostCalculator |
LabelPositon is a candidate feature label position.
| pal::LabelPosition::LabelPosition | ( | int | id, |
| double | x1, | ||
| double | y1, | ||
| double | w, | ||
| double | h, | ||
| double | alpha, | ||
| double | cost, | ||
| FeaturePart * | feature, | ||
| bool | isReversed = false |
||
| ) |
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 |
| pal::LabelPosition::LabelPosition | ( | const LabelPosition & | other | ) |
copy constructor
|
inline |
|
static |
|
static |
|
static |
|
static |
| double pal::LabelPosition::getAlpha | ( | ) | const |
get alpha
| void pal::LabelPosition::getBoundingBox | ( | double | amin[2], |
| double | amax[2] | ||
| ) | const |
return bounding box - amin: xmin,ymin - amax: xmax,ymax
| double pal::LabelPosition::getCost | ( | ) | const |
get the position geographical cost
| double pal::LabelPosition::getDistanceToPoint | ( | double | xp, |
| double | yp | ||
| ) |
get distance from this label to a point.
If point lies inside, returns negative number.
| FeaturePart * pal::LabelPosition::getFeaturePart | ( | ) |
return the feature corresponding to this labelposition
|
inline |
| int pal::LabelPosition::getId | ( | ) | const |
return id
| char * pal::LabelPosition::getLayerName | ( | ) | const |
return pointer to layer's name.
used for stats
|
inline |
|
inline |
| int pal::LabelPosition::getNumPointsInPolygon | ( | int | npol, |
| double * | xp, | ||
| double * | yp | ||
| ) |
returns number of intersections with polygon (testing border and center)
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| double pal::LabelPosition::getX | ( | int | i = 0 | ) | const |
get the down-left x coordinate
| double pal::LabelPosition::getY | ( | int | i = 0 | ) | const |
get the down-left y coordinate
| void pal::LabelPosition::insertIntoIndex | ( | RTree< LabelPosition *, double, 2, double > * | index | ) |
| bool pal::LabelPosition::isBorderCrossingLine | ( | PointSet * | feat | ) |
returns true if this label crosses the specified line
| 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} |
| bool pal::LabelPosition::isInConflict | ( | LabelPosition * | ls | ) |
Check whether or not this overlap with another labelPosition.
| ls | other labelposition |
|
protected |
|
protected |
| bool pal::LabelPosition::isInside | ( | double * | bbox | ) |
Is the labelposition inside the bounding-box ?
| bbox | the bounding-box double[4] = {xmin, ymin, xmax, ymax} |
| bool pal::LabelPosition::isIntersect | ( | double * | bbox | ) |
Is the labelposition intersect the bounding-box ?
| bbox | the bounding-box double[4] = {xmin, ymin, xmax, ymax} |
| void pal::LabelPosition::offsetPosition | ( | double | xOffset, |
| double | yOffset | ||
| ) |
shift the label by specified offset
|
static |
| void pal::LabelPosition::print | ( | ) |
|
static |
Check whether the candidate in ctx overlap with obstacle feat.
| void pal::LabelPosition::removeFromIndex | ( | RTree< LabelPosition *, double, 2, double > * | index | ) |
|
static |
|
inline |
|
inline |
Modify candidate's cost.
|
inline |
|
inline |
|
inline |
set problem feature ID and assigned label candidate ID.
called from pal.cpp during extraction
| void pal::LabelPosition::validateCost | ( | ) |
Make sure the cost is less than 1.
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
1.8.1.2