QGIS API Documentation  2.11.0-Master
Public Types | Public Member Functions | Friends | List of all members
pal::Pal Class Reference

Pal main class. More...

#include <pal.h>

Public Types

typedef bool(* FnIsCancelled) (void *ctx)
 

Public Member Functions

 Pal ()
 Create an new pal instance. More...
 
 ~Pal ()
 delete an instance More...
 
LayeraddLayer (const QString &layerName, Arrangement arrangement, double defaultPriority, bool obstacle, bool active, bool toLabel, bool displayAll=false)
 add a new layer More...
 
ProblemextractProblem (double bbox[4])
 
LayergetLayer (const QString &layerName)
 Look for a layer. More...
 
QList< Layer * > getLayers ()
 get all layers More...
 
int getLineP ()
 get maximum # candidates to generate for line features More...
 
int getPointP ()
 get # candidates to generate for point features More...
 
int getPolyP ()
 get maximum # candidates to generate for polygon features More...
 
SearchMethod getSearch ()
 get the search method in use More...
 
bool getShowPartial ()
 Get flag show partial label. More...
 
bool isCancelled ()
 Check whether the job has been cancelled. More...
 
std::list< LabelPosition * > * labeller (double bbox[4], PalStat **stats, bool displayAll)
 the labeling machine Will extract all active layers More...
 
std::list< LabelPosition * > * labeller (const QStringList &layerNames, 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...
 
void removeLayer (Layer *layer)
 remove a layer 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 setPointP (int point_p)
 set # candidates to generate for points 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...
 
void setSearch (SearchMethod method)
 Select the search method to use. More...
 
void setShowPartial (bool show)
 Set flag show partial label. More...
 
std::list< LabelPosition * > * solveProblem (Problem *prob, bool displayAll)
 

Friends

class FeaturePart
 
class Layer
 
class Problem
 

Detailed Description

Pal main class.

A pal object will contains layers and global information such as which search method will be used.

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

Definition at line 109 of file pal.h.

Member Typedef Documentation

typedef bool( * pal::Pal::FnIsCancelled) (void *ctx)

Definition at line 199 of file pal.h.

Constructor & Destructor Documentation

pal::Pal::Pal ( )

Create an new pal instance.

Definition at line 78 of file pal.cpp.

pal::Pal::~Pal ( )

delete an instance

Definition at line 145 of file pal.cpp.

Member Function Documentation

Layer * pal::Pal::addLayer ( const QString layerName,
Arrangement  arrangement,
double  defaultPriority,
bool  obstacle,
bool  active,
bool  toLabel,
bool  displayAll = false 
)

add a new layer

Parameters
layerNamelayer's name
arrangementHowto place candidates
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 158 of file pal.cpp.

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

Definition at line 643 of file pal.cpp.

Layer * pal::Pal::getLayer ( const QString layerName)

Look for a layer.

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

Definition at line 116 of file pal.cpp.

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

get all layers

Returns
a list of all layers

Definition at line 110 of file pal.cpp.

int pal::Pal::getLineP ( )

get maximum # candidates to generate for line features

Definition at line 728 of file pal.cpp.

int pal::Pal::getPointP ( )

get # candidates to generate for point features

Definition at line 723 of file pal.cpp.

int pal::Pal::getPolyP ( )

get maximum # candidates to generate for polygon features

Definition at line 733 of file pal.cpp.

SearchMethod pal::Pal::getSearch ( )

get the search method in use

Returns
the search method

Definition at line 753 of file pal.cpp.

bool pal::Pal::getShowPartial ( )

Get flag show partial label.

Returns
value of flag

Definition at line 748 of file pal.cpp.

bool pal::Pal::isCancelled ( )
inline

Check whether the job has been cancelled.

Definition at line 205 of file pal.h.

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

the labeling machine Will extract all active layers

Parameters
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 537 of file pal.cpp.

std::list< LabelPosition * > * pal::Pal::labeller ( const QStringList layerNames,
double  bbox[4],
PalStat **  stat,
bool  displayAll 
)

the labeling machine Active layers are specifiend through layersName array

Todo:
add obstacles and tolabel arrays
Parameters
layerNamesnames of layers to label
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 545 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 637 of file pal.cpp.

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

remove a layer

Parameters
layerlayer to remove

Definition at line 130 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 672 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 666 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 678 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 758 of file pal.cpp.

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

Set flag show partial label.

Parameters
showflag value

Definition at line 718 of file pal.cpp.

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

Definition at line 648 of file pal.cpp.

Friends And Related Function Documentation

friend class FeaturePart
friend

Definition at line 112 of file pal.h.

friend class Layer
friend

Definition at line 113 of file pal.h.

friend class Problem
friend

Definition at line 111 of file pal.h.


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