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

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

Member Enumeration Documentation

Enumerator:
LabelText 
LabelBuffer 
LabelShape 
LabelSVG 
LabelShadow 
Enumerator:
Chain 
Popmusic_Tabu 
Popmusic_Chain 
Popmusic_Tabu_Chain 
Falp 

Constructor & Destructor Documentation

QgsPalLabeling::QgsPalLabeling ( )
QgsPalLabeling::~QgsPalLabeling ( )

Member Function Documentation

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

adds a diagram layer to the labeling engine

Reimplemented from QgsLabelingEngineInterface.

const QList<QgsLabelCandidate>& QgsPalLabeling::candidates ( )
inline
void QgsPalLabeling::clearActiveLayer ( const QString &  layerID)
virtual

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

Implements QgsLabelingEngineInterface.

void QgsPalLabeling::clearActiveLayers ( )
virtual

clears all PAL layer settings for registered layers

Implements QgsLabelingEngineInterface.

void QgsPalLabeling::clearEngineSettings ( )
QgsLabelingEngineInterface * QgsPalLabeling::clone ( )
virtual

called when passing engine among map renderers

Implements QgsLabelingEngineInterface.

void QgsPalLabeling::dataDefinedDropShadow ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  ddValues 
)
protected
void QgsPalLabeling::dataDefinedShapeBackground ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  ddValues 
)
protected
void QgsPalLabeling::dataDefinedTextBuffer ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  ddValues 
)
protected
void QgsPalLabeling::dataDefinedTextFormatting ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  ddValues 
)
protected
void QgsPalLabeling::dataDefinedTextStyle ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  ddValues 
)
protected
void QgsPalLabeling::deleteTemporaryData ( )
protected
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.

void QgsPalLabeling::drawLabelBackground ( QgsRenderContext context,
QgsLabelComponent  component,
const QgsPalLayerSettings tmpLyr 
)
static
void QgsPalLabeling::drawLabelBuffer ( QgsRenderContext context,
QgsLabelComponent  component,
const QgsPalLayerSettings tmpLyr 
)
static
void QgsPalLabeling::drawLabelCandidateRect ( pal::LabelPosition lp,
QPainter *  painter,
const QgsMapToPixel xform 
)
Note
not available in python bindings
void QgsPalLabeling::drawLabeling ( QgsRenderContext context)
virtual

called when the map is drawn and labels should be placed

Implements QgsLabelingEngineInterface.

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

called when we're done with rendering

Implements QgsLabelingEngineInterface.

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.

void QgsPalLabeling::init ( const QgsMapSettings mapSettings)
virtual

called when we're going to start with rendering

Implements QgsLabelingEngineInterface.

bool QgsPalLabeling::isDrawingOutlineLabels ( ) const
inline
Note
added in 2.4
bool QgsPalLabeling::isShowingAllLabels ( ) const
inline
bool QgsPalLabeling::isShowingCandidates ( ) const
inline
bool QgsPalLabeling::isShowingPartialsLabels ( ) const
inline
bool QgsPalLabeling::isShowingShadowRectangles ( ) const
inline
Q_DECL_DEPRECATED bool QgsPalLabeling::isStoredWithProject ( ) const
inline
Deprecated:
since 2.4 - settings are always stored in project
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.

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.

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

returns PAL layer settings for a registered layer

Implements QgsLabelingEngineInterface.

void QgsPalLabeling::loadEngineSettings ( )

load/save engine settings to project file

void QgsPalLabeling::numCandidatePositions ( int &  candPoint,
int &  candLine,
int &  candPolygon 
)
int QgsPalLabeling::prepareLayer ( QgsVectorLayer layer,
QStringList &  attrNames,
QgsRenderContext ctx 
)
virtual

hook called when drawing layer before issuing select()

Implements QgsLabelingEngineInterface.

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

called for every diagram feature

Reimplemented from QgsLabelingEngineInterface.

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.

void QgsPalLabeling::saveEngineSettings ( )
QgsPalLabeling::Search QgsPalLabeling::searchMethod ( ) const
void QgsPalLabeling::setDrawingOutlineLabels ( bool  outline)
inline
void QgsPalLabeling::setNumCandidatePositions ( int  candPoint,
int  candLine,
int  candPolygon 
)
void QgsPalLabeling::setSearchMethod ( QgsPalLabeling::Search  s)
void QgsPalLabeling::setShowingAllLabels ( bool  showing)
inline
void QgsPalLabeling::setShowingCandidates ( bool  showing)
inline
void QgsPalLabeling::setShowingPartialsLabels ( bool  showing)
inline
void QgsPalLabeling::setShowingShadowRectangles ( bool  showing)
inline
Q_DECL_DEPRECATED void QgsPalLabeling::setStoredWithProject ( bool  store)
inline
Deprecated:
since 2.4 - settings are always stored in project
bool QgsPalLabeling::staticWillUseLayer ( QgsVectorLayer layer)
static

called to find out whether the layer is used for labeling

Note
added in 2.4
bool QgsPalLabeling::staticWillUseLayer ( const QString &  layerID)
static
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
bool QgsPalLabeling::willUseLayer ( QgsVectorLayer layer)
virtual

called to find out whether the layer is used for labeling

Implements QgsLabelingEngineInterface.

Member Data Documentation

QHash<QString, QgsDiagramLayerSettings> QgsPalLabeling::mActiveDiagramLayers
protected
QHash<QString, QgsPalLayerSettings> QgsPalLabeling::mActiveLayers
protected
QList<QgsLabelCandidate> QgsPalLabeling::mCandidates
protected
int QgsPalLabeling::mCandLine
protected
int QgsPalLabeling::mCandPoint
protected
int QgsPalLabeling::mCandPolygon
protected
bool QgsPalLabeling::mDrawOutlineLabels
protected
QgsPalLayerSettings QgsPalLabeling::mInvalidLayerSettings
protected
const QgsMapSettings* QgsPalLabeling::mMapSettings
protected
pal::Pal* QgsPalLabeling::mPal
protected
QgsLabelingResults* QgsPalLabeling::mResults
protected
Search QgsPalLabeling::mSearch
protected
bool QgsPalLabeling::mShowingAllLabels
protected
bool QgsPalLabeling::mShowingCandidates
protected
bool QgsPalLabeling::mShowingPartialsLabels
protected
bool QgsPalLabeling::mShowingShadowRects
protected

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