QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsPalLabeling Class Reference

#include <qgspallabeling.h>

Inheritance diagram for QgsPalLabeling:
Inheritance graph
[legend]

Public Types

enum  DrawLabelType {
  LabelText = 0, LabelBuffer, LabelShape, LabelSVG,
  LabelShadow
}
 
enum  Search {
  Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain,
  Falp
}
 

Public Member Functions

 QgsPalLabeling ()
 
 ~QgsPalLabeling ()
 
virtual int addDiagramLayer (QgsVectorLayer *layer, const QgsDiagramLayerSettings *s)
 adds a diagram layer to the labeling engine More...
 
const QList< QgsLabelCandidate > & candidates ()
 
virtual void clearActiveLayer (const QString &layerID)
 clears data defined objects from PAL layer settings for a registered layer More...
 
virtual void clearActiveLayers ()
 clears all PAL layer settings for registered layers More...
 
void clearEngineSettings ()
 
virtual
QgsLabelingEngineInterface
clone ()
 called when passing engine among map renderers More...
 
virtual void drawLabel (pal::LabelPosition *label, QgsRenderContext &context, QgsPalLayerSettings &tmpLyr, DrawLabelType drawType, double dpiRatio=1.0)
 drawLabel More...
 
void drawLabelCandidateRect (pal::LabelPosition *lp, QPainter *painter, const QgsMapToPixel *xform)
 
virtual void drawLabeling (QgsRenderContext &context)
 called when the map is drawn and labels should be placed More...
 
virtual void exit ()
 called when we're done with rendering More...
 
virtual Q_DECL_DEPRECATED void init (QgsMapRenderer *mr)
 called when we're going to start with rendering More...
 
virtual void init (const QgsMapSettings &mapSettings)
 called when we're going to start with rendering More...
 
bool isDrawingOutlineLabels () const
 
bool isShowingAllLabels () const
 
bool isShowingCandidates () const
 
bool isShowingPartialsLabels () const
 
bool isShowingShadowRectangles () const
 
Q_DECL_DEPRECATED bool isStoredWithProject () const
 
virtual Q_DECL_DEPRECATED
QList< QgsLabelPosition
labelsAtPosition (const QgsPoint &p)
 return infos about labels at a given (map) position More...
 
virtual Q_DECL_DEPRECATED
QList< QgsLabelPosition
labelsWithinRect (const QgsRectangle &r)
 return infos about labels within a given (map) rectangle More...
 
QgsPalLayerSettingslayer (const QString &layerName)
 returns PAL layer settings for a registered layer More...
 
void loadEngineSettings ()
 load/save engine settings to project file More...
 
void numCandidatePositions (int &candPoint, int &candLine, int &candPolygon)
 
virtual int prepareLayer (QgsVectorLayer *layer, QStringList &attrNames, QgsRenderContext &ctx)
 hook called when drawing layer before issuing select() More...
 
virtual void registerDiagramFeature (const QString &layerID, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())
 called for every diagram feature More...
 
virtual void registerFeature (const QString &layerID, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext(), QString dxfLayer=QString::null)
 hook called when drawing for every feature in a layer More...
 
void saveEngineSettings ()
 
Search searchMethod () const
 
void setDrawingOutlineLabels (bool outline)
 
void setNumCandidatePositions (int candPoint, int candLine, int candPolygon)
 
void setSearchMethod (Search s)
 
void setShowingAllLabels (bool showing)
 
void setShowingCandidates (bool showing)
 
void setShowingPartialsLabels (bool showing)
 
void setShowingShadowRectangles (bool showing)
 
Q_DECL_DEPRECATED void setStoredWithProject (bool store)
 
QgsLabelingResultstakeResults ()
 Return pointer to recently computed results (in drawLabeling()) and pass the ownership of results to the caller. More...
 
virtual bool willUseLayer (QgsVectorLayer *layer)
 called to find out whether the layer is used for labeling More...
 
- Public Member Functions inherited from QgsLabelingEngineInterface
virtual ~QgsLabelingEngineInterface ()
 

Static Public Member Functions

static void drawLabelBackground (QgsRenderContext &context, QgsLabelComponent component, const QgsPalLayerSettings &tmpLyr)
 
static void drawLabelBuffer (QgsRenderContext &context, QgsLabelComponent component, const QgsPalLayerSettings &tmpLyr)
 
static void drawLabelShadow (QgsRenderContext &context, QgsLabelComponent component, const QgsPalLayerSettings &tmpLyr)
 
static bool staticWillUseLayer (QgsVectorLayer *layer)
 called to find out whether the layer is used for labeling More...
 
static bool staticWillUseLayer (const QString &layerID)
 

Protected Member Functions

void dataDefinedDropShadow (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &ddValues)
 
void dataDefinedShapeBackground (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &ddValues)
 
void dataDefinedTextBuffer (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &ddValues)
 
void dataDefinedTextFormatting (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &ddValues)
 
void dataDefinedTextStyle (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &ddValues)
 
void deleteTemporaryData ()
 

Protected Attributes

QHash< QString,
QgsDiagramLayerSettings
mActiveDiagramLayers
 
QHash< QString,
QgsPalLayerSettings
mActiveLayers
 
QList< QgsLabelCandidatemCandidates
 
int mCandLine
 
int mCandPoint
 
int mCandPolygon
 
bool mDrawOutlineLabels
 
QgsPalLayerSettings mInvalidLayerSettings
 
const QgsMapSettingsmMapSettings
 
pal::PalmPal
 
QgsLabelingResultsmResults
 
Search mSearch
 
bool mShowingAllLabels
 
bool mShowingCandidates
 
bool mShowingPartialsLabels
 
bool mShowingShadowRects
 

Detailed Description

Definition at line 704 of file qgspallabeling.h.

Member Enumeration Documentation

Enumerator
LabelText 
LabelBuffer 
LabelShape 
LabelSVG 
LabelShadow 

Definition at line 707 of file qgspallabeling.h.

Enumerator
Chain 
Popmusic_Tabu 
Popmusic_Chain 
Popmusic_Tabu_Chain 
Falp 

Definition at line 724 of file qgspallabeling.h.

Constructor & Destructor Documentation

QgsPalLabeling::QgsPalLabeling ( )

Definition at line 3054 of file qgspallabeling.cpp.

QgsPalLabeling::~QgsPalLabeling ( )

Definition at line 3081 of file qgspallabeling.cpp.

Member Function Documentation

int QgsPalLabeling::addDiagramLayer ( QgsVectorLayer layer,
const QgsDiagramLayerSettings s 
)
virtual

adds a diagram layer to the labeling engine

Reimplemented from QgsLabelingEngineInterface.

Definition at line 3343 of file qgspallabeling.cpp.

const QList<QgsLabelCandidate>& QgsPalLabeling::candidates ( )
inline

Definition at line 731 of file qgspallabeling.h.

void QgsPalLabeling::clearActiveLayer ( const QString &  layerID)
virtual

clears data defined objects from PAL layer settings for a registered layer

Implements QgsLabelingEngineInterface.

Definition at line 3127 of file qgspallabeling.cpp.

void QgsPalLabeling::clearActiveLayers ( )
virtual

clears all PAL layer settings for registered layers

Implements QgsLabelingEngineInterface.

Definition at line 3117 of file qgspallabeling.cpp.

void QgsPalLabeling::clearEngineSettings ( )

Definition at line 4946 of file qgspallabeling.cpp.

QgsLabelingEngineInterface * QgsPalLabeling::clone ( )
virtual

called when passing engine among map renderers

Implements QgsLabelingEngineInterface.

Definition at line 4959 of file qgspallabeling.cpp.

void QgsPalLabeling::dataDefinedDropShadow ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  ddValues 
)
protected

Definition at line 3770 of file qgspallabeling.cpp.

void QgsPalLabeling::dataDefinedShapeBackground ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  ddValues 
)
protected

Definition at line 3659 of file qgspallabeling.cpp.

void QgsPalLabeling::dataDefinedTextBuffer ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  ddValues 
)
protected

Definition at line 3602 of file qgspallabeling.cpp.

void QgsPalLabeling::dataDefinedTextFormatting ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  ddValues 
)
protected

Definition at line 3549 of file qgspallabeling.cpp.

void QgsPalLabeling::dataDefinedTextStyle ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  ddValues 
)
protected

Definition at line 3524 of file qgspallabeling.cpp.

void QgsPalLabeling::deleteTemporaryData ( )
protected

Definition at line 4043 of file qgspallabeling.cpp.

void QgsPalLabeling::drawLabel ( pal::LabelPosition label,
QgsRenderContext context,
QgsPalLayerSettings tmpLyr,
DrawLabelType  drawType,
double  dpiRatio = 1.0 
)
virtual

drawLabel

Note
not available in python bindings

Reimplemented in QgsDxfPalLabeling.

Definition at line 4167 of file qgspallabeling.cpp.

void QgsPalLabeling::drawLabelBackground ( QgsRenderContext context,
QgsLabelComponent  component,
const QgsPalLayerSettings tmpLyr 
)
static

Definition at line 4463 of file qgspallabeling.cpp.

void QgsPalLabeling::drawLabelBuffer ( QgsRenderContext context,
QgsLabelComponent  component,
const QgsPalLayerSettings tmpLyr 
)
static

Definition at line 4408 of file qgspallabeling.cpp.

void QgsPalLabeling::drawLabelCandidateRect ( pal::LabelPosition lp,
QPainter *  painter,
const QgsMapToPixel xform 
)
Note
not available in python bindings

Definition at line 4121 of file qgspallabeling.cpp.

void QgsPalLabeling::drawLabeling ( QgsRenderContext context)
virtual

called when the map is drawn and labels should be placed

Implements QgsLabelingEngineInterface.

Definition at line 3843 of file qgspallabeling.cpp.

void QgsPalLabeling::drawLabelShadow ( QgsRenderContext context,
QgsLabelComponent  component,
const QgsPalLayerSettings tmpLyr 
)
static

Definition at line 4760 of file qgspallabeling.cpp.

void QgsPalLabeling::exit ( )
virtual

called when we're done with rendering

Implements QgsLabelingEngineInterface.

Definition at line 3504 of file qgspallabeling.cpp.

void QgsPalLabeling::init ( QgsMapRenderer mr)
virtual

called when we're going to start with rendering

Deprecated:
since 2.4 - use override with QgsMapSettings

Implements QgsLabelingEngineInterface.

Definition at line 3466 of file qgspallabeling.cpp.

void QgsPalLabeling::init ( const QgsMapSettings mapSettings)
virtual

called when we're going to start with rendering

Implements QgsLabelingEngineInterface.

Definition at line 3471 of file qgspallabeling.cpp.

bool QgsPalLabeling::isDrawingOutlineLabels ( ) const
inline
Note
added in 2.4

Definition at line 743 of file qgspallabeling.h.

bool QgsPalLabeling::isShowingAllLabels ( ) const
inline

Definition at line 736 of file qgspallabeling.h.

bool QgsPalLabeling::isShowingCandidates ( ) const
inline

Definition at line 729 of file qgspallabeling.h.

bool QgsPalLabeling::isShowingPartialsLabels ( ) const
inline

Definition at line 739 of file qgspallabeling.h.

bool QgsPalLabeling::isShowingShadowRectangles ( ) const
inline

Definition at line 733 of file qgspallabeling.h.

Q_DECL_DEPRECATED bool QgsPalLabeling::isStoredWithProject ( ) const
inline
Deprecated:
since 2.4 - settings are always stored in project

Definition at line 814 of file qgspallabeling.h.

QList< QgsLabelPosition > QgsPalLabeling::labelsAtPosition ( const QgsPoint p)
virtual

return infos about labels at a given (map) position

Deprecated:
since 2.4 - use takeResults() and methods of QgsLabelingResults

Implements QgsLabelingEngineInterface.

Definition at line 4075 of file qgspallabeling.cpp.

QList< QgsLabelPosition > QgsPalLabeling::labelsWithinRect ( const QgsRectangle r)
virtual

return infos about labels within a given (map) rectangle

Deprecated:
since 2.4 - use takeResults() and methods of QgsLabelingResults

Implements QgsLabelingEngineInterface.

Definition at line 4080 of file qgspallabeling.cpp.

QgsPalLayerSettings & QgsPalLabeling::layer ( const QString &  layerName)
virtual

returns PAL layer settings for a registered layer

Implements QgsLabelingEngineInterface.

Definition at line 3511 of file qgspallabeling.cpp.

void QgsPalLabeling::loadEngineSettings ( )

load/save engine settings to project file

Definition at line 4908 of file qgspallabeling.cpp.

void QgsPalLabeling::numCandidatePositions ( int &  candPoint,
int &  candLine,
int &  candPolygon 
)

Definition at line 4097 of file qgspallabeling.cpp.

int QgsPalLabeling::prepareLayer ( QgsVectorLayer layer,
QStringList &  attrNames,
QgsRenderContext ctx 
)
virtual

hook called when drawing layer before issuing select()

Implements QgsLabelingEngineInterface.

Definition at line 3141 of file qgspallabeling.cpp.

void QgsPalLabeling::registerDiagramFeature ( const QString &  layerID,
QgsFeature feat,
const QgsRenderContext context = QgsRenderContext() 
)
virtual

called for every diagram feature

Reimplemented from QgsLabelingEngineInterface.

Definition at line 3372 of file qgspallabeling.cpp.

void QgsPalLabeling::registerFeature ( const QString &  layerID,
QgsFeature feat,
const QgsRenderContext context = QgsRenderContext(),
QString  dxfLayer = QString::null 
)
virtual

hook called when drawing for every feature in a layer

Implements QgsLabelingEngineInterface.

Definition at line 3366 of file qgspallabeling.cpp.

void QgsPalLabeling::saveEngineSettings ( )

Definition at line 4933 of file qgspallabeling.cpp.

QgsPalLabeling::Search QgsPalLabeling::searchMethod ( ) const

Definition at line 4116 of file qgspallabeling.cpp.

void QgsPalLabeling::setDrawingOutlineLabels ( bool  outline)
inline

Definition at line 744 of file qgspallabeling.h.

void QgsPalLabeling::setNumCandidatePositions ( int  candPoint,
int  candLine,
int  candPolygon 
)

Definition at line 4104 of file qgspallabeling.cpp.

void QgsPalLabeling::setSearchMethod ( QgsPalLabeling::Search  s)

Definition at line 4111 of file qgspallabeling.cpp.

void QgsPalLabeling::setShowingAllLabels ( bool  showing)
inline

Definition at line 737 of file qgspallabeling.h.

void QgsPalLabeling::setShowingCandidates ( bool  showing)
inline

Definition at line 730 of file qgspallabeling.h.

void QgsPalLabeling::setShowingPartialsLabels ( bool  showing)
inline

Definition at line 740 of file qgspallabeling.h.

void QgsPalLabeling::setShowingShadowRectangles ( bool  showing)
inline

Definition at line 734 of file qgspallabeling.h.

Q_DECL_DEPRECATED void QgsPalLabeling::setStoredWithProject ( bool  store)
inline
Deprecated:
since 2.4 - settings are always stored in project

Definition at line 816 of file qgspallabeling.h.

bool QgsPalLabeling::staticWillUseLayer ( QgsVectorLayer layer)
static

called to find out whether the layer is used for labeling

Note
added in 2.4

Definition at line 3106 of file qgspallabeling.cpp.

bool QgsPalLabeling::staticWillUseLayer ( const QString &  layerID)
static

Definition at line 3097 of file qgspallabeling.cpp.

QgsLabelingResults * QgsPalLabeling::takeResults ( )

Return pointer to recently computed results (in drawLabeling()) and pass the ownership of results to the caller.

Note
added in 2.4

Definition at line 4085 of file qgspallabeling.cpp.

bool QgsPalLabeling::willUseLayer ( QgsVectorLayer layer)
virtual

called to find out whether the layer is used for labeling

Implements QgsLabelingEngineInterface.

Definition at line 3092 of file qgspallabeling.cpp.

Member Data Documentation

QHash<QString, QgsDiagramLayerSettings> QgsPalLabeling::mActiveDiagramLayers
protected

Definition at line 844 of file qgspallabeling.h.

QHash<QString, QgsPalLayerSettings> QgsPalLabeling::mActiveLayers
protected

Definition at line 842 of file qgspallabeling.h.

QList<QgsLabelCandidate> QgsPalLabeling::mCandidates
protected

Definition at line 854 of file qgspallabeling.h.

int QgsPalLabeling::mCandLine
protected

Definition at line 848 of file qgspallabeling.h.

int QgsPalLabeling::mCandPoint
protected

Definition at line 848 of file qgspallabeling.h.

int QgsPalLabeling::mCandPolygon
protected

Definition at line 848 of file qgspallabeling.h.

bool QgsPalLabeling::mDrawOutlineLabels
protected

Definition at line 859 of file qgspallabeling.h.

QgsPalLayerSettings QgsPalLabeling::mInvalidLayerSettings
protected

Definition at line 845 of file qgspallabeling.h.

const QgsMapSettings* QgsPalLabeling::mMapSettings
protected

Definition at line 847 of file qgspallabeling.h.

pal::Pal* QgsPalLabeling::mPal
protected

Definition at line 851 of file qgspallabeling.h.

QgsLabelingResults* QgsPalLabeling::mResults
protected

Definition at line 861 of file qgspallabeling.h.

Search QgsPalLabeling::mSearch
protected

Definition at line 849 of file qgspallabeling.h.

bool QgsPalLabeling::mShowingAllLabels
protected

Definition at line 856 of file qgspallabeling.h.

bool QgsPalLabeling::mShowingCandidates
protected

Definition at line 855 of file qgspallabeling.h.

bool QgsPalLabeling::mShowingPartialsLabels
protected

Definition at line 858 of file qgspallabeling.h.

bool QgsPalLabeling::mShowingShadowRects
protected

Definition at line 857 of file qgspallabeling.h.


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