QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Typedefs | Enumerations | Functions
pal Namespace Reference

Classes

struct  _chain
 
struct  _cHullBox
 
struct  _cross
 
struct  _elementary_transformation
 
struct  _featCbackCtx
 
struct  _filterContext
 
struct  _nokContext
 
struct  _subpart
 
struct  _Triple
 
class  Cell
 
struct  ChainContext
 
class  CostCalculator
 
struct  FalpContext
 
class  Feats
 For usage in problem solving algorithm. More...
 
class  Feature
 
class  FeaturePart
 Main class to handle feature. More...
 
struct  Ft
 
class  HashTable
 
class  InternalException
 Various Exceptions. More...
 
class  LabelInfo
 optional additional info about label (for curved labels) More...
 
class  LabelPosition
 LabelPositon is a candidate feature label position. More...
 
class  Layer
 A layer of spacial entites. More...
 
class  LinkedList
 
class  Pal
 Pal main class. More...
 
class  PalException
 Various Exceptions. More...
 
class  PalGeometry
 Interface that allows Pal to access user's geometries. More...
 
class  PalStat
 Summury of problem. More...
 
struct  Point
 
class  PointSet
 
class  PolygonCostCalculator
 Data structure to compute polygon's candidates costs. More...
 
class  PriorityQueue
 
class  Problem
 Represent a problem. More...
 
class  RTree
 
class  SimpleMutex
 
class  Sol
 
struct  SubPartContext
 
struct  UpdateContext
 

Typedefs

typedef struct pal::_featCbackCtx FeatCallBackCtx
 
typedef struct pal::_filterContext FilterContext
 
typedef enum _Units Units
 Typedef for _Units enumeration. More...
 
typedef enum _searchMethod SearchMethod
 Typedef for _Units enumeration. More...
 
typedef enum _arrangement Arrangement
 typedef for _arrangement enumeration More...
 
typedef struct pal::_cross Crossing
 
typedef struct pal::_cHullBox CHullBox
 
typedef struct pal::_Triple Triple
 
typedef struct pal::_nokContext NokContext
 
typedef struct pal::_subpart SubPart
 
typedef struct pal::_chain Chain
 
typedef THREAD_TYPE MUTEX_T
 
typedef struct
pal::_elementary_transformation 
ElemTrans
 

Enumerations

enum  _Units { PIXEL = 0, METER, FOOT, DEGREE }
 Units for label sizes and distlabel. More...
 
enum  _searchMethod {
  CHAIN = 0, POPMUSIC_TABU_CHAIN = 1, POPMUSIC_TABU = 2, POPMUSIC_CHAIN = 3,
  FALP = 4
}
 Search method to use. More...
 
enum  _arrangement {
  P_POINT = 0, P_POINT_OVER, P_LINE, P_CURVED,
  P_HORIZ, P_FREE
}
 The way to arrange labels against spatial entities. More...
 
enum  LineArrangementFlags { FLAG_ON_LINE = 1, FLAG_ABOVE_LINE = 2, FLAG_BELOW_LINE = 4, FLAG_MAP_ORIENTATION = 8 }
 enumeration line arrangement flags. More...
 

Functions

static LabelPosition_createCurvedCandidate (LabelPosition *lp, double angle, double dist)
 
void heapsort (int *sid, int *id, const double *const x, int N)
 
void heapsort2 (int *x, double *heap, int N)
 
bool isSegIntersects (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
 
bool computeSegIntersectionExt (double x1, double y1, double x2, double y2, double xs1, double ys1, double x3, double y3, double x4, double y4, double xs2, double ys2, double *x, double *y)
 
bool computeLineSegIntersection (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double *x, double *y)
 
bool computeSegIntersection (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double *x, double *y)
 
bool computeLineIntersection (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double *x, double *y)
 
int convexHullId (int *id, const double *const x, const double *const y, int n, int *&cHull)
 
int reorderPolygon (int nbPoints, double *x, double *y)
 
bool isPointInPolygon (int npol, double *xp, double *yp, double x, double y)
 
void findLineCircleIntersection (double cx, double cy, double radius, double x1, double y1, double x2, double y2, double &xRes, double &yRes)
 
double cross_product (double x1, double y1, double x2, double y2, double x3, double y3)
 
double dist_euc2d (double x1, double y1, double x2, double y2)
 
double dist_euc2d_sq (double x1, double y1, double x2, double y2)
 
int convexHull (int *id, const double *const x, const double *const y, int n)
 
static FeaturePart_findConnectedPart (FeaturePart *partCheck, LinkedList< FeaturePart * > *otherParts)
 
void geosError (const char *fmt,...)
 
void geosNotice (const char *fmt,...)
 
bool extractFeatCallback (FeaturePart *ft_ptr, void *ctx)
 
bool filteringCallback (PointSet *pset, void *ctx)
 
bool ptrCrossingCompare (Crossing *a, Crossing *b)
 
bool crossingDist (void *a, void *b)
 
bool smaller (double l, double r)
 
bool bigger (double l, double r)
 
void delete_chain (Chain *chain)
 
bool borderSizeDec (void *l, void *r)
 
bool borderSizeInc (void *l, void *r)
 
bool increaseImportance (void *l, void *r)
 
bool increaseNbOverlap (void *l, void *r)
 
bool falpCallback2 (LabelPosition *lp, void *ctx)
 
void ignoreLabel (LabelPosition *lp, PriorityQueue *list, RTree< LabelPosition *, double, 2, double > *candidates)
 
bool falpCallback1 (LabelPosition *lp, void *ctx)
 
bool subPartCallback (LabelPosition *lp, void *ctx)
 
bool decreaseCost (void *tl, void *tr)
 
bool increaseCost (void *tl, void *tr)
 
void actualizeTabuCandidateList (int m, int iteration, int nbOverlap, int *candidateListSize, double candidateBaseFactor, double *candidateFactor, int minCandidateListSize, double reductionFactor, int minTabuTSize, double tabuFactor, int *tenure, int n)
 
void actualizeCandidateList (int nbOverlap, int *candidateListSize, double candidateBaseFactor, double *candidateFactor, int minCandidateListSize, double growingFactor, int n)
 
bool updateCandidatesCost (LabelPosition *lp, void *context)
 
bool chainCallback (LabelPosition *lp, void *context)
 
bool checkCallback (LabelPosition *lp, void *ctx)
 
bool nokCallback (LabelPosition *lp, void *context)
 
void sort (double *heap, int *x, int *y, int N)
 
void tabcpy (int n, const int *const x, const int *const y, const double *const prob, int *cx, int *cy, double *p)
 
void sort (void **items, int N, bool(*greater)(void *l, void *r))
 Sort an array of pointers. More...
 
bool ptrGeomEq (const GEOSGeometry *l, const GEOSGeometry *r)
 
LinkedList< const GEOSGeometry * > * unmulti (const GEOSGeometry *the_geom)
 
int max (int a, int b)
 
double max (double a, double b)
 returns the maximum of two doubles or the first argument if both are equal More...
 
int min (int a, int b)
 
double min (double a, double b)
 returns the minimum of two doubles or the first argument if both are equal More...
 
double vabs (double x)
 
double degree2meter (double delta_deg)
 
double unit_convert (double x, Units from, Units to, int dpi, double scale, double delta_canvas_width)
 
void convert2pt (int *x, double scale, int dpi)
 
int convert2pt (double x, double scale, int dpi)
 
bool intCompare (int a, int b)
 
bool strCompare (char *a, char *b)
 
bool ptrLPosCompare (LabelPosition *a, LabelPosition *b)
 
bool ptrPSetCompare (PointSet *a, PointSet *b)
 
bool ptrFeatureCompare (Feature *a, Feature *b)
 
bool ptrFeaturePartCompare (FeaturePart *a, FeaturePart *b)
 
bool ptrFeatsCompare (Feats *a, Feats *b)
 
bool ptrLayerCompare (Layer *a, Layer *b)
 
bool ptrETCompare (ElemTrans *a, ElemTrans *b)
 

Detailed Description

Introduction

Pal is a labelling library released under the GPLv3 license

Typedef Documentation

typedef for _arrangement enumeration

Definition at line 104 of file pal.h.

typedef struct pal::_chain pal::Chain
typedef struct pal::_cHullBox pal::CHullBox
typedef struct pal::_cross pal::Crossing
typedef THREAD_TYPE pal::MUTEX_T

Definition at line 62 of file simplemutex.h.

Typedef for _Units enumeration.

Definition at line 87 of file pal.h.

typedef struct pal::_subpart pal::SubPart
typedef struct pal::_Triple pal::Triple
typedef enum _Units pal::Units

Typedef for _Units enumeration.

Definition at line 74 of file pal.h.

Enumeration Type Documentation

The way to arrange labels against spatial entities.

image html arrangement.png "Arrangement modes" width=7cm

Enumerator
P_POINT 

arranges candidates around a point (centroid for polygon)

P_POINT_OVER 
P_LINE 

arranges candidates over a point (centroid for polygon)

Only for lines and polygons, arranges candidates over the line or the polygon perimeter

P_CURVED 
P_HORIZ 

Only for lines, labels along the line.

Only for polygon, arranges candidates horizontaly

P_FREE 

Only for polygon, arranges candidates with respect of polygon orientation.

Definition at line 93 of file pal.h.

Search method to use.

Enumerator
CHAIN 

is the worst but fastest method

POPMUSIC_TABU_CHAIN 

is the best but slowest

POPMUSIC_TABU 

is a little bit better than CHAIN but slower

POPMUSIC_CHAIN 

is slower and best than TABU, worse and faster than TABU_CHAIN

FALP 

Definition at line 77 of file pal.h.

Units for label sizes and distlabel.

Enumerator
PIXEL 

pixel [px]

METER 

meter [m]

FOOT 

foot [ft]

DEGREE 

degree [°]

Definition at line 65 of file pal.h.

enumeration line arrangement flags.

Flags can be combined.

Enumerator
FLAG_ON_LINE 
FLAG_ABOVE_LINE 
FLAG_BELOW_LINE 
FLAG_MAP_ORIENTATION 

Definition at line 107 of file pal.h.

Function Documentation

static LabelPosition* pal::_createCurvedCandidate ( LabelPosition *  lp,
double  angle,
double  dist 
)
static

Definition at line 910 of file feature.cpp.

References M_PI, and pal::LabelPosition::offsetPosition().

Referenced by pal::FeaturePart::setPositionForLineCurved().

static FeaturePart* pal::_findConnectedPart ( FeaturePart *  partCheck,
LinkedList< FeaturePart * > *  otherParts 
)
static

Definition at line 421 of file layer.cpp.

References pal::FeaturePart::isConnected().

Referenced by pal::Layer::joinConnectedFeatures().

void pal::actualizeCandidateList ( int  nbOverlap,
int *  candidateListSize,
double  candidateBaseFactor,
double *  candidateFactor,
int  minCandidateListSize,
double  growingFactor,
int  n 
)
inline

Definition at line 854 of file problem.cpp.

Referenced by pal::Problem::popmusic_tabu().

void pal::actualizeTabuCandidateList ( int  m,
int  iteration,
int  nbOverlap,
int *  candidateListSize,
double  candidateBaseFactor,
double *  candidateFactor,
int  minCandidateListSize,
double  reductionFactor,
int  minTabuTSize,
double  tabuFactor,
int *  tenure,
int  n 
)
inline

Definition at line 833 of file problem.cpp.

Referenced by pal::Problem::popmusic_tabu().

bool pal::bigger ( double  l,
double  r 
)

Definition at line 47 of file priorityqueue.cpp.

Referenced by pal::PriorityQueue::PriorityQueue().

bool pal::borderSizeDec ( void *  l,
void *  r 
)
inline

Definition at line 138 of file problem.cpp.

bool pal::borderSizeInc ( void *  l,
void *  r 
)
inline

Definition at line 143 of file problem.cpp.

Referenced by pal::Problem::popmusic().

bool pal::chainCallback ( LabelPosition *  lp,
void *  context 
)
bool pal::checkCallback ( LabelPosition *  lp,
void *  ctx 
)

Definition at line 2390 of file problem.cpp.

Referenced by pal::Problem::check_solution().

bool pal::computeLineIntersection ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4,
double *  x,
double *  y 
)
bool pal::computeLineSegIntersection ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4,
double *  x,
double *  y 
)

Definition at line 311 of file geomfunction.cpp.

References computeLineIntersection(), and cross_product().

Referenced by pal::PointSet::getDist().

bool pal::computeSegIntersection ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4,
double *  x,
double *  y 
)

Definition at line 332 of file geomfunction.cpp.

References computeLineIntersection(), and cross_product().

Referenced by computeSegIntersectionExt().

bool pal::computeSegIntersectionExt ( double  x1,
double  y1,
double  x2,
double  y2,
double  xs1,
double  ys1,
double  x3,
double  y3,
double  x4,
double  y4,
double  xs2,
double  ys2,
double *  x,
double *  y 
)
void pal::convert2pt ( int *  x,
double  scale,
int  dpi 
)
inline

Definition at line 210 of file util.h.

Referenced by pal::Pal::labeller().

int pal::convert2pt ( double  x,
double  scale,
int  dpi 
)
inline

Definition at line 216 of file util.h.

int pal::convexHull ( int *  id,
const double *const  x,
const double *const  y,
int  n 
)
int pal::convexHullId ( int *  id,
const double *const  x,
const double *const  y,
int  n,
int *&  cHull 
)
double pal::cross_product ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)
inline
bool pal::crossingDist ( void *  a,
void *  b 
)
inline

Definition at line 86 of file pointset.h.

bool pal::decreaseCost ( void *  tl,
void *  tr 
)

Definition at line 821 of file problem.cpp.

Referenced by pal::Problem::popmusic_tabu(), and pal::Problem::popmusic_tabu_chain().

double pal::degree2meter ( double  delta_deg)
inline

Definition at line 105 of file util.h.

Referenced by unit_convert().

void pal::delete_chain ( Chain *  chain)
inline
double pal::dist_euc2d ( double  x1,
double  y1,
double  x2,
double  y2 
)
inline
double pal::dist_euc2d_sq ( double  x1,
double  y1,
double  x2,
double  y2 
)
inline
bool pal::extractFeatCallback ( FeaturePart *  ft_ptr,
void *  ctx 
)
bool pal::falpCallback1 ( LabelPosition *  lp,
void *  ctx 
)

Definition at line 300 of file problem.cpp.

References ignoreLabel(), and pal::LabelPosition::isInConflict().

Referenced by pal::Problem::init_sol_falp().

bool pal::falpCallback2 ( LabelPosition *  lp,
void *  ctx 
)
bool pal::filteringCallback ( PointSet *  pset,
void *  ctx 
)
void pal::findLineCircleIntersection ( double  cx,
double  cy,
double  radius,
double  x1,
double  y1,
double  x2,
double  y2,
double &  xRes,
double &  yRes 
)

Definition at line 629 of file geomfunction.cpp.

Referenced by pal::FeaturePart::curvedPlacementAtOffset().

void pal::geosError ( const char *  fmt,
  ... 
)

Definition at line 69 of file pal.cpp.

void pal::geosNotice ( const char *  fmt,
  ... 
)

Definition at line 76 of file pal.cpp.

void pal::heapsort ( int *  sid,
int *  id,
const double *const  x,
int  N 
)

Definition at line 44 of file geomfunction.cpp.

Referenced by convexHullId().

void pal::heapsort2 ( int *  x,
double *  heap,
int  N 
)

Definition at line 86 of file geomfunction.cpp.

Referenced by convexHullId().

void pal::ignoreLabel ( LabelPosition *  lp,
PriorityQueue *  list,
RTree< LabelPosition *, double, 2, double > *  candidates 
)
bool pal::increaseCost ( void *  tl,
void *  tr 
)

Definition at line 826 of file problem.cpp.

bool pal::increaseImportance ( void *  l,
void *  r 
)
inline

Definition at line 148 of file problem.cpp.

bool pal::increaseNbOverlap ( void *  l,
void *  r 
)
inline

Definition at line 153 of file problem.cpp.

bool pal::intCompare ( int  a,
int  b 
)
inline
bool pal::isPointInPolygon ( int  npol,
double *  xp,
double *  yp,
double  x,
double  y 
)
bool pal::isSegIntersects ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4 
)

Definition at line 140 of file geomfunction.cpp.

References cross_product().

Referenced by pal::PointSet::splitPolygons().

int pal::max ( int  a,
int  b 
)
inline
double pal::max ( double  a,
double  b 
)
inline

returns the maximum of two doubles or the first argument if both are equal

Definition at line 90 of file util.h.

int pal::min ( int  a,
int  b 
)
inline
double pal::min ( double  a,
double  b 
)
inline

returns the minimum of two doubles or the first argument if both are equal

Definition at line 96 of file util.h.

bool pal::nokCallback ( LabelPosition *  lp,
void *  context 
)
bool pal::ptrCrossingCompare ( Crossing *  a,
Crossing *  b 
)
inline

Definition at line 81 of file pointset.h.

bool pal::ptrETCompare ( ElemTrans *  a,
ElemTrans *  b 
)
inline

Definition at line 265 of file util.h.

Referenced by pal::Problem::chain().

bool pal::ptrFeatsCompare ( Feats *  a,
Feats *  b 
)
inline

Definition at line 254 of file util.h.

Referenced by pal::Pal::extract().

bool pal::ptrFeatureCompare ( Feature *  a,
Feature *  b 
)
inline

Definition at line 245 of file util.h.

Referenced by pal::Layer::Layer().

bool pal::ptrFeaturePartCompare ( FeaturePart *  a,
FeaturePart *  b 
)
inline

Definition at line 249 of file util.h.

Referenced by pal::Layer::addFeaturePart(), pal::Layer::chopFeatures(), and pal::Layer::Layer().

bool pal::ptrGeomEq ( const GEOSGeometry *  l,
const GEOSGeometry *  r 
)
inline

Definition at line 190 of file util.cpp.

Referenced by unmulti().

bool pal::ptrLayerCompare ( Layer *  a,
Layer *  b 
)
inline

Definition at line 259 of file util.h.

bool pal::ptrLPosCompare ( LabelPosition *  a,
LabelPosition *  b 
)
inline
bool pal::ptrPSetCompare ( PointSet *  a,
PointSet *  b 
)
inline

Definition at line 240 of file util.h.

Referenced by pal::FeaturePart::setPositionForPolygon().

int pal::reorderPolygon ( int  nbPoints,
double *  x,
double *  y 
)

Definition at line 496 of file geomfunction.cpp.

References convexHullId().

Referenced by pal::FeaturePart::extractCoords(), and pal::Layer::registerFeature().

bool pal::smaller ( double  l,
double  r 
)

Definition at line 42 of file priorityqueue.cpp.

Referenced by pal::PriorityQueue::PriorityQueue().

void pal::sort ( double *  heap,
int *  x,
int *  y,
int  N 
)
void pal::sort ( void **  items,
int  N,
bool(*)(void *l, void *r)  greater 
)

Sort an array of pointers.

Parameters
itemsarays of pointers to sort
Nnumber of items
greaterfunction to compare two items

Definition at line 139 of file util.cpp.

bool pal::strCompare ( char *  a,
char *  b 
)
inline

Definition at line 230 of file util.h.

Referenced by pal::Layer::Layer().

bool pal::subPartCallback ( LabelPosition *  lp,
void *  ctx 
)
void pal::tabcpy ( int  n,
const int *const  x,
const int *const  y,
const double *const  prob,
int *  cx,
int *  cy,
double *  p 
)

Definition at line 125 of file util.cpp.

double pal::unit_convert ( double  x,
Units  from,
Units  to,
int  dpi,
double  scale,
double  delta_canvas_width 
)
inline
LinkedList< const GEOSGeometry * > * pal::unmulti ( const GEOSGeometry *  the_geom)

Definition at line 196 of file util.cpp.

References ptrGeomEq().

Referenced by pal::Layer::registerFeature().

bool pal::updateCandidatesCost ( LabelPosition *  lp,
void *  context 
)
double pal::vabs ( double  x)
inline