QGIS API Documentation
2.6.0-Brighton
|
A layer of spacial entites. More...
#include <layer.h>
Public Types | |
enum | LabelMode { LabelPerFeature, LabelPerFeaturePart } |
enum | UpsideDownLabels { Upright, ShowDefined, ShowAll } |
Public Member Functions | |
bool | getDisplayAll () const |
int | getNbFeatures () |
get the number of features into layer | |
const char * | getName () |
get layer's name | |
Arrangement | getArrangement () |
get arrangement policy | |
void | setArrangement (Arrangement arrangement) |
set arrangement policy | |
unsigned long | getArrangementFlags () const |
void | setArrangementFlags (unsigned long flags) |
Units | getLabelUnit () |
get units for label size | |
void | setLabelUnit (Units label_unit) |
set unit for label size | |
void | setActive (bool active) |
activate or desactivate the layer | |
bool | isActive () |
return the layer's activity status | |
void | setToLabel (bool toLabel) |
tell pal whether the layer has to be labelled. | |
bool | isToLabel () |
return if the layer will be labelled or not | |
void | setObstacle (bool obstacle) |
mark layer's features as obstacles | |
bool | isObstacle () |
return the obstacle status | |
void | setMinScale (double min_scale) |
set the minimum valid scale, below this scale the layer will not be labelled | |
double | getMinScale () |
return the minimum valid scale | |
void | setMaxScale (double max_scale) |
set the maximum valid scale, upon this scale the layer will not be labelled | |
double | getMaxScale () |
return the maximum valid scale | |
void | setPriority (double priority) |
\ brief set the layer priority | |
double | getPriority () |
return the layer's priority | |
void | setLabelMode (LabelMode m) |
LabelMode | getLabelMode () const |
void | setMergeConnectedLines (bool m) |
bool | getMergeConnectedLines () const |
void | setRepeatDistance (double distance) |
double | getRepeatDistance () const |
void | setUpsidedownLabels (UpsideDownLabels ud) |
UpsideDownLabels | getUpsidedownLabels () const |
void | setCentroidInside (bool forceInside) |
bool | getCentroidInside () const |
bool | registerFeature (const char *geom_id, PalGeometry *userGeom, double label_x=-1, double label_y=-1, const char *labelText=NULL, double labelPosX=0.0, double labelPosY=0.0, bool fixedPos=false, double angle=0.0, bool fixedAngle=false, int xQuadOffset=0, int yQuadOffset=0, double xOffset=0.0, double yOffset=0.0, bool alwaysShow=false, double repeatDistance=0) |
register a feature in the layer | |
Feature * | getFeature (const char *geom_id) |
return pointer to feature or NULL if doesn't exist | |
void | joinConnectedFeatures () |
join connected features with the same label text | |
void | chopFeaturesAtRepeatDistance () |
chop layer features at the repeat distance |
Protected Member Functions | |
Layer (const char *lyrName, double min_scale, double max_scale, Arrangement arrangement, Units label_unit, double defaultPriority, bool obstacle, bool active, bool toLabel, Pal *pal, bool displayAll=false) | |
Create a new layer. | |
virtual | ~Layer () |
Delete the layer. | |
bool | isScaleValid (double scale) |
check if the scal is in the scale range min_scale -> max_scale | |
void | addFeaturePart (FeaturePart *fpart, const char *labelText=NULL) |
add newly creted feature part into r tree and to the list |
Protected Attributes | |
char * | name |
LinkedList< FeaturePart * > * | featureParts |
list of feature parts | |
LinkedList< Feature * > * | features |
list of features - for deletion | |
Pal * | pal |
double | defaultPriority |
bool | obstacle |
bool | active |
bool | toLabel |
bool | displayAll |
bool | centroidInside |
Units | label_unit |
double | min_scale |
double | max_scale |
Arrangement | arrangement |
optional flags used for some placement methods | |
unsigned long | arrangementFlags |
LabelMode | mode |
bool | mergeLines |
double | repeatDistance |
UpsideDownLabels | upsidedownLabels |
RTree< FeaturePart *, double, 2, double, 8, 4 > * | rtree |
HashTable< Feature * > * | hashtable |
HashTable< LinkedList < FeaturePart * > * > * | connectedHashtable |
LinkedList< char * > * | connectedTexts |
SimpleMutex * | modMutex |
Friends | |
class | Pal |
class | FeaturePart |
class | Problem |
class | LabelPosition |
bool | extractFeatCallback (FeaturePart *ft_ptr, void *ctx) |
void | toSVGPath (int nbPoints, double *x, double *y, int dpi, Layer *layer, int type, char *uid, std::ostream &out, double scale, int xmin, int ymax, bool exportInfo, char *color) |
A layer of spacial entites.
a layer is a bog of feature with some data which influence the labelling process
|
protected |
Create a new layer.
lyrName | layer's name |
min_scale | bellow this scale: no labeling |
max_scale | above this scale: no labeling |
arrangement | Arrangement mode : how to place candidates |
label_unit | Unit for labels sizes |
defaultPriority | layer's prioriry (0 is the best, 1 the worst) |
obstacle | 'true' will discourage other label to be placed above features of this layer |
active | is the layer is active (currently displayed) |
toLabel | the layer will be labeled whether toLablel is true |
pal | pointer to the pal object |
displayAll | if true, all features will be labelled even though overlaps occur |
|
protectedvirtual |
Delete the layer.
|
protected |
add newly creted feature part into r tree and to the list
void pal::Layer::chopFeaturesAtRepeatDistance | ( | ) |
chop layer features at the repeat distance
Arrangement pal::Layer::getArrangement | ( | ) |
get arrangement policy
|
inline |
|
inline |
|
inline |
Feature * pal::Layer::getFeature | ( | const char * | geom_id | ) |
return pointer to feature or NULL if doesn't exist
|
inline |
Units pal::Layer::getLabelUnit | ( | ) |
get units for label size
double pal::Layer::getMaxScale | ( | ) |
return the maximum valid scale
|
inline |
double pal::Layer::getMinScale | ( | ) |
return the minimum valid scale
const char * pal::Layer::getName | ( | ) |
get layer's name
int pal::Layer::getNbFeatures | ( | ) |
get the number of features into layer
double pal::Layer::getPriority | ( | ) |
return the layer's priority
|
inline |
|
inline |
bool pal::Layer::isActive | ( | ) |
return the layer's activity status
bool pal::Layer::isObstacle | ( | ) |
return the obstacle status
|
protected |
check if the scal is in the scale range min_scale -> max_scale
scale | the scale to check |
bool pal::Layer::isToLabel | ( | ) |
return if the layer will be labelled or not
void pal::Layer::joinConnectedFeatures | ( | ) |
join connected features with the same label text
bool pal::Layer::registerFeature | ( | const char * | geom_id, |
PalGeometry * | userGeom, | ||
double | label_x = -1 , |
||
double | label_y = -1 , |
||
const char * | labelText = NULL , |
||
double | labelPosX = 0.0 , |
||
double | labelPosY = 0.0 , |
||
bool | fixedPos = false , |
||
double | angle = 0.0 , |
||
bool | fixedAngle = false , |
||
int | xQuadOffset = 0 , |
||
int | yQuadOffset = 0 , |
||
double | xOffset = 0.0 , |
||
double | yOffset = 0.0 , |
||
bool | alwaysShow = false , |
||
double | repeatDistance = 0 |
||
) |
register a feature in the layer
geom_id | unique identifier |
userGeom | user's geometry that implements the PalGeometry interface |
label_x | label width |
label_y | label height |
labelText | label text |
labelPosX | x position of the label (in case of fixed label position) |
labelPosY | y position of the label (in case of fixed label position) |
fixedPos | true if a single fixed position for this label is needed |
angle | fixed angle (in radians) to rotate the label |
fixedAngle | whether to use provided fixed angle |
xQuadOffset | move label to quadrant: left, don't move, right (-1, 0, 1) |
yQuadOffset | move label to quadrant: down, don't move, up (-1, 0, 1) |
xOffset | map unit (+/-) to x-offset the label |
yOffset | map unit (+/-) to y-offset the label |
alwaysShow | whether to skip priority and always show the label (causes overlapping) |
repeatDistance | distance for repeating the label |
PalException::FeatureExists |
void pal::Layer::setActive | ( | bool | active | ) |
activate or desactivate the layer
active means "is currently display". When active is false feature of this layer will never be used (neither for labelling nor as obstacles)
active | turn the layer active (true) or inactive (false) |
void pal::Layer::setArrangement | ( | Arrangement | arrangement | ) |
set arrangement policy
arrangement | arrangement policy |
|
inline |
|
inline |
|
inline |
void pal::Layer::setLabelUnit | ( | Units | label_unit | ) |
set unit for label size
void pal::Layer::setMaxScale | ( | double | max_scale | ) |
set the maximum valid scale, upon this scale the layer will not be labelled
use -1 to disable
|
inline |
void pal::Layer::setMinScale | ( | double | min_scale | ) |
set the minimum valid scale, below this scale the layer will not be labelled
Use -1 to disable
void pal::Layer::setObstacle | ( | bool | obstacle | ) |
mark layer's features as obstacles
Avoid putting labels over obstalces. isActive must also be true to consider feature as obstacles, otherwise they will be ignored
void pal::Layer::setPriority | ( | double | priority | ) |
\ brief set the layer priority
The best priority is 0, the worst is 1 Should be links with a slider in a nice gui
|
inline |
void pal::Layer::setToLabel | ( | bool | toLabel | ) |
tell pal whether the layer has to be labelled.
The layer will be labelled if and only if toLabel and isActive were set to true
toLabel | set to false disable lbelling this layer |
|
inline |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
optional flags used for some placement methods
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
list of feature parts
|
protected |
list of features - for deletion
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |