QGIS API Documentation
3.0.2-Girona (307d082)
|
Main Pal labeling class. More...
#include <pal.h>
Public Types | |
typedef bool(* | FnIsCanceled) (void *ctx) |
Public Member Functions | |
Pal () | |
Create an new pal instance. More... | |
Pal (const Pal &other)=delete | |
Pal cannot be copied. More... | |
~Pal () | |
Layer * | addLayer (QgsAbstractLabelProvider *provider, const QString &layerName, QgsPalLayerSettings::Placement arrangement, double defaultPriority, bool active, bool toLabel, bool displayAll=false) |
add a new layer More... | |
std::unique_ptr< Problem > | extractProblem (const QgsRectangle &extent, const QgsGeometry &mapBoundary) |
Extracts the labeling problem for the specified map extent - only features within this extent will be considered. 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 | isCanceled () |
Check whether the job has been canceled. More... | |
Pal & | operator= (const Pal &other)=delete |
Pal cannot be copied. More... | |
void | registerCancelationCallback (FnIsCanceled fnCanceled, void *context) |
Register a function that returns whether this job has been canceled - 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... | |
QList< LabelPosition * > | solveProblem (Problem *prob, bool displayAll) |
Friends | |
class | FeaturePart |
class | Layer |
class | Problem |
Main Pal labeling class.
A pal object will contains layers and global information such as which search method will be used.
Layer * Pal::addLayer | ( | QgsAbstractLabelProvider * | provider, |
const QString & | layerName, | ||
QgsPalLayerSettings::Placement | arrangement, | ||
double | defaultPriority, | ||
bool | active, | ||
bool | toLabel, | ||
bool | displayAll = false |
||
) |
add a new layer
provider | Provider associated with the layer |
layerName | layer's name |
arrangement | Howto place candidates |
defaultPriority | layer's prioriry (0 is the best, 1 the worst) |
active | is the layer is active (currently displayed) |
toLabel | the layer will be labeled only if toLablel is true |
displayAll | if true, all features will be labelled even though overlaps occur |
PalException::LayerExists |
std::unique_ptr< Problem > Pal::extractProblem | ( | const QgsRectangle & | extent, |
const QgsGeometry & | mapBoundary | ||
) |
Extracts the labeling problem for the specified map extent - only features within this extent will be considered.
The mapBoundary argument specifies the actual geometry of the map boundary, which will be used to detect whether a label is visible (or partially visible) in the rendered map. This may differ from extent in the case of rotated or non-rectangular maps.
int Pal::getLineP | ( | ) |
int Pal::getPointP | ( | ) |
int Pal::getPolyP | ( | ) |
SearchMethod Pal::getSearch | ( | ) |
bool Pal::getShowPartial | ( | ) |
|
inline |
void Pal::registerCancelationCallback | ( | Pal::FnIsCanceled | fnCanceled, |
void * | context | ||
) |
void Pal::removeLayer | ( | Layer * | layer | ) |
void Pal::setLineP | ( | int | line_p | ) |
void Pal::setPointP | ( | int | point_p | ) |
void Pal::setPolyP | ( | int | poly_p | ) |
void 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
method | the method to use |
void Pal::setShowPartial | ( | bool | show | ) |
QList< LabelPosition * > Pal::solveProblem | ( | Problem * | prob, |
bool | displayAll | ||
) |
|
friend |