QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
QgsLabelSearchTree Class Reference

A class to query the labeling structure at a given point (small wraper around pal RTree class) More...

#include <qgslabelsearchtree.h>

Collaboration diagram for QgsLabelSearchTree:
Collaboration graph
[legend]

Public Member Functions

 QgsLabelSearchTree ()
 
 ~QgsLabelSearchTree ()
 
void clear ()
 Removes and deletes all the entries. More...
 
void label (const QgsPoint &p, QList< QgsLabelPosition * > &posList) const
 Returns label position(s) at a given point. More...
 
void labelsInRect (const QgsRectangle &r, QList< QgsLabelPosition * > &posList) const
 Returns label position(s) in given rectangle. More...
 
bool insertLabel (LabelPosition *labelPos, int featureId, const QString &layerName, const QString &labeltext, const QFont &labelfont, bool diagram=false, bool pinned=false)
 Inserts label position. More...
 

Private Attributes

RTree< QgsLabelPosition
*, double, 2, double > 
mSpatialIndex
 

Detailed Description

A class to query the labeling structure at a given point (small wraper around pal RTree class)

Definition at line 33 of file qgslabelsearchtree.h.

Constructor & Destructor Documentation

QgsLabelSearchTree::QgsLabelSearchTree ( )

Definition at line 25 of file qgslabelsearchtree.cpp.

QgsLabelSearchTree::~QgsLabelSearchTree ( )

Definition at line 29 of file qgslabelsearchtree.cpp.

References clear().

Member Function Documentation

void QgsLabelSearchTree::clear ( )

Removes and deletes all the entries.

Definition at line 92 of file qgslabelsearchtree.cpp.

References mSpatialIndex.

Referenced by ~QgsLabelSearchTree().

bool QgsLabelSearchTree::insertLabel ( LabelPosition labelPos,
int  featureId,
const QString &  layerName,
const QString &  labeltext,
const QFont &  labelfont,
bool  diagram = false,
bool  pinned = false 
)

Inserts label position.

Does not take ownership of labelPos

Returns
true in case of success
Note
not available in python bindings

Definition at line 70 of file qgslabelsearchtree.cpp.

References pal::LabelPosition::getAlpha(), pal::LabelPosition::getBoundingBox(), pal::LabelPosition::getHeight(), pal::LabelPosition::getUpsideDown(), pal::LabelPosition::getWidth(), pal::LabelPosition::getX(), pal::LabelPosition::getY(), and mSpatialIndex.

Referenced by QgsPalLabeling::drawLabeling().

void QgsLabelSearchTree::label ( const QgsPoint p,
QList< QgsLabelPosition * > &  posList 
) const

Returns label position(s) at a given point.

QgsLabelSearchTree keeps ownership, don't delete the LabelPositions

Note
not available in python bindings TODO: why does this break bindings with QList<QgsLabelPosition>?

Definition at line 34 of file qgslabelsearchtree.cpp.

References mSpatialIndex, searchCallback(), QgsPoint::x(), and QgsPoint::y().

Referenced by QgsLabelingResults::labelsAtPosition().

void QgsLabelSearchTree::labelsInRect ( const QgsRectangle r,
QList< QgsLabelPosition * > &  posList 
) const

Returns label position(s) in given rectangle.

QgsLabelSearchTree keeps ownership, don't delete the LabelPositions

Note
not available in python bindings TODO: why does this break bindings with QList<QgsLabelPosition>?

Definition at line 54 of file qgslabelsearchtree.cpp.

References mSpatialIndex, searchCallback(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().

Referenced by QgsLabelingResults::labelsWithinRect().

Member Data Documentation

RTree<QgsLabelPosition*, double, 2, double> QgsLabelSearchTree::mSpatialIndex
mutableprivate

Definition at line 62 of file qgslabelsearchtree.h.

Referenced by clear(), insertLabel(), label(), and labelsInRect().


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