QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Friends | List of all members
pal::Pal Class Reference

Pal main class. More...

#include <pal.h>

Public Member Functions

 Pal ()
 Create an new pal instance. More...
 
 ~Pal ()
 delete an instance More...
 
LayeraddLayer (const char *lyrName, double min_scale, double max_scale, Arrangement arrangement, Units label_unit, double defaultPriority, bool obstacle, bool active, bool toLabel, bool displayAll=false)
 add a new layer More...
 
LayergetLayer (const char *lyrName)
 Look for a layer. More...
 
QList< Layer * > * getLayers ()
 get all layers More...
 
void removeLayer (Layer *layer)
 remove a layer More...
 
std::list< LabelPosition * > * labeller (double scale, double bbox[4], PalStat **stats, bool displayAll)
 the labeling machine Will extract all active layers More...
 
std::list< LabelPosition * > * labeller (int nbLayers, char **layersName, double *layersFactor, double scale, double bbox[4], PalStat **stat, bool displayAll)
 the labeling machine Active layers are specifiend through layersName array More...
 
void registerCancellationCallback (FnIsCancelled fnCancelled, void *context)
 Register a function that returns whether this job has been cancelled - PAL calls it during the computation. More...
 
bool isCancelled ()
 Check whether the job has been cancelled. More...
 
ProblemextractProblem (double scale, double bbox[4])
 
std::list< LabelPosition * > * solveProblem (Problem *prob, bool displayAll)
 
void setDpi (int dpi)
 Set map resolution. More...
 
int getDpi ()
 get map resolution More...
 
void setShowPartial (bool show)
 Set flag show partial label. More...
 
bool getShowPartial ()
 Get flag show partial label. More...
 
void setPointP (int point_p)
 set # candidates to generate for points features Higher the value is, longer Pal::labeller will spend time More...
 
void setLineP (int line_p)
 set maximum # candidates to generate for lines features Higher the value is, longer Pal::labeller will spend time More...
 
void setPolyP (int poly_p)
 set maximum # candidates to generate for polygon features Higher the value is, longer Pal::labeller will spend time More...
 
int getPointP ()
 get # candidates to generate for point features More...
 
int getLineP ()
 get maximum # candidates to generate for line features More...
 
int getPolyP ()
 get maximum # candidates to generate for polygon features More...
 
Units getMapUnit ()
 get current map unit More...
 
void setMapUnit (Units map_unit)
 set map unit More...
 
void setSearch (SearchMethod method)
 Select the search method to use. More...
 
SearchMethod getSearch ()
 get the search method in use More...
 

Friends

class Problem
 
class FeaturePart
 
class Layer
 

Detailed Description

Pal main class.

A pal object will contains layers and global information such as which search method will be used, the map resolution (dpi) ....

Author
Maxence Laurent (maxence dot laurent at heig-vd dot ch)

Definition at line 126 of file pal.h.

Constructor & Destructor Documentation

pal::Pal::Pal ( )

Create an new pal instance.

Definition at line 90 of file pal.cpp.

pal::Pal::~Pal ( )

delete an instance

Definition at line 162 of file pal.cpp.

Member Function Documentation

Layer * pal::Pal::addLayer ( const char *  lyrName,
double  min_scale,
double  max_scale,
Arrangement  arrangement,
Units  label_unit,
double  defaultPriority,
bool  obstacle,
bool  active,
bool  toLabel,
bool  displayAll = false 
)

add a new layer

Parameters
lyrNamelayer's name
min_scalebellow this scale: no labelling (-1 to disable)
max_scaleabove this scale: no labelling (-1 to disable)
arrangementHowto place candidates
label_unitUnit for labels sizes
defaultPrioritylayer's prioriry (0 is the best, 1 the worst)
obstacle'true' will discourage other label to be placed above features of this layer
activeis the layer is active (currently displayed)
toLabelthe layer will be labeled only if toLablel is true
displayAllif true, all features will be labelled even though overlaps occur
Exceptions
PalException::LayerExists
Todo:
add symbolUnit

Definition at line 180 of file pal.cpp.

Problem * pal::Pal::extractProblem ( double  scale,
double  bbox[4] 
)

Definition at line 838 of file pal.cpp.

int pal::Pal::getDpi ( )

get map resolution

Returns
map resolution (dot per inch)

Definition at line 972 of file pal.cpp.

Layer * pal::Pal::getLayer ( const char *  lyrName)

Look for a layer.

Parameters
lyrNamename of layer to search
Exceptions
PalException::UnkownLayer
Returns
a pointer on layer or NULL if layer not exist

Definition at line 135 of file pal.cpp.

QList< Layer * > * pal::Pal::getLayers ( )

get all layers

Returns
a list of all layers

Definition at line 129 of file pal.cpp.

int pal::Pal::getLineP ( )

get maximum # candidates to generate for line features

Definition at line 952 of file pal.cpp.

Units pal::Pal::getMapUnit ( )

get current map unit

Definition at line 1034 of file pal.cpp.

int pal::Pal::getPointP ( )

get # candidates to generate for point features

Definition at line 947 of file pal.cpp.

int pal::Pal::getPolyP ( )

get maximum # candidates to generate for polygon features

Definition at line 957 of file pal.cpp.

SearchMethod pal::Pal::getSearch ( )

get the search method in use

Returns
the search method

Definition at line 982 of file pal.cpp.

bool pal::Pal::getShowPartial ( )

Get flag show partial label.

Returns
value of flag

Definition at line 977 of file pal.cpp.

bool pal::Pal::isCancelled ( )
inline

Check whether the job has been cancelled.

Definition at line 355 of file pal.h.

std::list< LabelPosition * > * pal::Pal::labeller ( double  scale,
double  bbox[4],
PalStat **  stats,
bool  displayAll 
)

the labeling machine Will extract all active layers

Parameters
scalemap scale is 1:scale
bboxmap extent
statsA PalStat object (can be NULL)
displayAllif true, all feature will be labelled even though overlaps occur
Returns
A list of label to display on map

Definition at line 662 of file pal.cpp.

std::list< LabelPosition * > * pal::Pal::labeller ( int  nbLayers,
char **  layersName,
double *  layersFactor,
double  scale,
double  bbox[4],
PalStat **  stat,
bool  displayAll 
)

the labeling machine Active layers are specifiend through layersName array

Todo:
add obstacles and tolabel arrays
Parameters
nbLayers# layers
layersNamenames of layers to label
layersFactorlayers priorities array
scalemap scale is '1:scale'
bboxmap extent
statwill be filled with labelling process statistics, can be NULL
displayAllif true, all feature will be labelled even though overlaps occur
Todo:
UnknownLayer will be ignored ? should throw exception or not ???
Returns
A list of label to display on map

Definition at line 697 of file pal.cpp.

void pal::Pal::registerCancellationCallback ( Pal::FnIsCancelled  fnCancelled,
void *  context 
)

Register a function that returns whether this job has been cancelled - PAL calls it during the computation.

Definition at line 832 of file pal.cpp.

void pal::Pal::removeLayer ( Layer layer)

remove a layer

Parameters
layerlayer to remove

Definition at line 150 of file pal.cpp.

void pal::Pal::setDpi ( int  dpi)

Set map resolution.

Parameters
dpimap resolution (dot per inch)

Definition at line 936 of file pal.cpp.

void pal::Pal::setLineP ( int  line_p)

set maximum # candidates to generate for lines features Higher the value is, longer Pal::labeller will spend time

Parameters
line_pmaximum # candidates for a line

Definition at line 889 of file pal.cpp.

void pal::Pal::setMapUnit ( Units  map_unit)

set map unit

Definition at line 1042 of file pal.cpp.

void pal::Pal::setPointP ( int  point_p)

set # candidates to generate for points features Higher the value is, longer Pal::labeller will spend time

Parameters
point_p# candidates for a point

Definition at line 883 of file pal.cpp.

void pal::Pal::setPolyP ( int  poly_p)

set maximum # candidates to generate for polygon features Higher the value is, longer Pal::labeller will spend time

Parameters
poly_pmaximum # candidate for a polygon

Definition at line 895 of file pal.cpp.

void pal::Pal::setSearch ( SearchMethod  method)

Select the search method to use.

For interactive mapping using CHAIN is a good idea because it is the fastest. Other methods, ordered by speedness, are POPMUSIC_TABU, POPMUSIC_CHAIN and POPMUSIC_TABU_CHAIN, defined in pal::_searchMethod enumeration

Parameters
methodthe method to use

Definition at line 987 of file pal.cpp.

void pal::Pal::setShowPartial ( bool  show)

Set flag show partial label.

Parameters
showflag value

Definition at line 942 of file pal.cpp.

std::list< LabelPosition * > * pal::Pal::solveProblem ( Problem prob,
bool  displayAll 
)

Definition at line 865 of file pal.cpp.

Friends And Related Function Documentation

friend class FeaturePart
friend

Definition at line 129 of file pal.h.

friend class Layer
friend

Definition at line 130 of file pal.h.

friend class Problem
friend

Definition at line 128 of file pal.h.


The documentation for this class was generated from the following files: