Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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]
Collaboration diagram for QgsPalLabeling:
Collaboration graph
[legend]

Public Types

enum  Search {
  Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain,
  Falp
}
 

Public Member Functions

 QgsPalLabeling ()
 
 ~QgsPalLabeling ()
 
QgsPalLayerSettings & layer (const QString &layerName)
 
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 isShowingAllLabels () const
 
void setShowingAllLabels (bool showing)
 
virtual void init (QgsMapRenderer *mr)
 called when we're going to start with rendering More...
 
virtual bool willUseLayer (QgsVectorLayer *layer)
 called to find out whether the layer is used for labeling More...
 
virtual int prepareLayer (QgsVectorLayer *layer, QSet< int > &attrIndices, QgsRenderContext &ctx)
 hook called when drawing layer before issuing select() More...
 
virtual int addDiagramLayer (QgsVectorLayer *layer, QgsDiagramLayerSettings *s)
 adds a diagram layer to the labeling engine More...
 
virtual void registerFeature (QgsVectorLayer *layer, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())
 hook called when drawing for every feature in a layer More...
 
virtual void registerDiagramFeature (QgsVectorLayer *layer, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())
 called for every diagram feature More...
 
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 QList< QgsLabelPosition > labelsAtPosition (const QgsPoint &p)
 return infos about labels at a given (map) position More...
 
virtual
QgsLabelingEngineInterface * 
clone ()
 called when passing engine among map renderers More...
 
void drawLabelCandidateRect (pal::LabelPosition *lp, QPainter *painter, const QgsMapToPixel *xform)
 
void drawLabel (pal::LabelPosition *label, QPainter *painter, const QFont &f, const QColor &c, const QgsMapToPixel *xform, double bufferSize=-1, const QColor &bufferColor=QColor(255, 255, 255), bool drawBuffer=false)
 drawLabel More...
 
- Public Member Functions inherited from QgsLabelingEngineInterface
virtual ~QgsLabelingEngineInterface ()
 

Static Public Member Functions

static void drawLabelBuffer (QPainter *p, QString text, const QFont &font, double size, QColor color)
 

Protected Member Functions

void initPal ()
 

Protected Attributes

QHash< QgsVectorLayer
*, QgsPalLayerSettings > 
mActiveLayers
 
QHash< QgsVectorLayer
*, QgsDiagramLayerSettings > 
mActiveDiagramLayers
 
QgsPalLayerSettings mInvalidLayerSettings
 
QgsMapRenderer * mMapRenderer
 
int mCandPoint
 
int mCandLine
 
int mCandPolygon
 
Search mSearch
 
pal::Pal * mPal
 
QList< QgsLabelCandidate > mCandidates
 
bool mShowingCandidates
 
bool mShowingAllLabels
 
QgsLabelSearchTree * mLabelSearchTree
 

Detailed Description

Definition at line 171 of file qgspallabeling.h.

Member Enumeration Documentation

Enumerator
Chain 
Popmusic_Tabu 
Popmusic_Chain 
Popmusic_Tabu_Chain 
Falp 

Definition at line 182 of file qgspallabeling.h.

Constructor & Destructor Documentation

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

Definition at line 662 of file qgspallabeling.cpp.

References exit(), and mLabelSearchTree.

Member Function Documentation

int QgsPalLabeling::addDiagramLayer ( QgsVectorLayer *  layer,
QgsDiagramLayerSettings *  s 
)
virtual
const QList<QgsLabelCandidate>& QgsPalLabeling::candidates ( )
inline

Definition at line 189 of file qgspallabeling.h.

QgsLabelingEngineInterface * QgsPalLabeling::clone ( )
virtual

called when passing engine among map renderers

Implements QgsLabelingEngineInterface.

Definition at line 1288 of file qgspallabeling.cpp.

References mShowingAllLabels, mShowingCandidates, and QgsPalLabeling().

void QgsPalLabeling::drawLabel ( pal::LabelPosition *  label,
QPainter *  painter,
const QFont &  f,
const QColor &  c,
const QgsMapToPixel *  xform,
double  bufferSize = -1,
const QColor &  bufferColor = QColor( 255, 255, 255 ),
bool  drawBuffer = false 
)
void QgsPalLabeling::drawLabelBuffer ( QPainter *  p,
QString  text,
const QFont &  font,
double  size,
QColor  color 
)
static

Definition at line 1277 of file qgspallabeling.cpp.

Referenced by drawLabel().

void QgsPalLabeling::drawLabelCandidateRect ( pal::LabelPosition *  lp,
QPainter *  painter,
const QgsMapToPixel *  xform 
)

Definition at line 1184 of file qgspallabeling.cpp.

References M_PI, mCandidates, QgsMapToPixel::transform(), QgsPoint::x(), and QgsPoint::y().

Referenced by drawLabeling().

void QgsPalLabeling::drawLabeling ( QgsRenderContext &  context)
virtual
void QgsPalLabeling::exit ( )
virtual

called when we're done with rendering

Implements QgsLabelingEngineInterface.

Definition at line 914 of file qgspallabeling.cpp.

References mMapRenderer, and mPal.

Referenced by ~QgsPalLabeling().

void QgsPalLabeling::init ( QgsMapRenderer *  mr)
virtual

called when we're going to start with rendering

Implements QgsLabelingEngineInterface.

Definition at line 883 of file qgspallabeling.cpp.

References Chain, Falp, mActiveDiagramLayers, mActiveLayers, mCandLine, mCandPoint, mCandPolygon, mMapRenderer, mPal, mSearch, Popmusic_Chain, Popmusic_Tabu, and Popmusic_Tabu_Chain.

void QgsPalLabeling::initPal ( )
protected
bool QgsPalLabeling::isShowingAllLabels ( ) const
inline

Definition at line 191 of file qgspallabeling.h.

bool QgsPalLabeling::isShowingCandidates ( ) const
inline

Definition at line 187 of file qgspallabeling.h.

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

return infos about labels at a given (map) position

Implements QgsLabelingEngineInterface.

Definition at line 1142 of file qgspallabeling.cpp.

References QgsLabelSearchTree::label(), and mLabelSearchTree.

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

Definition at line 921 of file qgspallabeling.cpp.

References mActiveLayers, and mInvalidLayerSettings.

Referenced by drawLabel(), drawLabeling(), prepareLayer(), and registerFeature().

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

Definition at line 1160 of file qgspallabeling.cpp.

References mCandLine, mCandPoint, and mCandPolygon.

int QgsPalLabeling::prepareLayer ( QgsVectorLayer *  layer,
QSet< int > &  attrIndices,
QgsRenderContext &  ctx 
)
virtual
void QgsPalLabeling::registerDiagramFeature ( QgsVectorLayer *  layer,
QgsFeature &  feat,
const QgsRenderContext &  context = QgsRenderContext() 
)
virtual
void QgsPalLabeling::registerFeature ( QgsVectorLayer *  layer,
QgsFeature &  feat,
const QgsRenderContext &  context = QgsRenderContext() 
)
virtual

hook called when drawing for every feature in a layer

Implements QgsLabelingEngineInterface.

Definition at line 779 of file qgspallabeling.cpp.

References layer(), mActiveLayers, and QgsPalLayerSettings::registerFeature().

QgsPalLabeling::Search QgsPalLabeling::searchMethod ( ) const

Definition at line 1179 of file qgspallabeling.cpp.

References mSearch.

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

Definition at line 1167 of file qgspallabeling.cpp.

References mCandLine, mCandPoint, and mCandPolygon.

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

Definition at line 1174 of file qgspallabeling.cpp.

References mSearch.

void QgsPalLabeling::setShowingAllLabels ( bool  showing)
inline

Definition at line 192 of file qgspallabeling.h.

void QgsPalLabeling::setShowingCandidates ( bool  showing)
inline

Definition at line 188 of file qgspallabeling.h.

bool QgsPalLabeling::willUseLayer ( QgsVectorLayer *  layer)
virtual

called to find out whether the layer is used for labeling

Implements QgsLabelingEngineInterface.

Definition at line 671 of file qgspallabeling.cpp.

References QgsPalLayerSettings::enabled, and QgsPalLayerSettings::readFromLayer().

Referenced by registerDiagramFeature().

Member Data Documentation

QHash<QgsVectorLayer*, QgsDiagramLayerSettings> QgsPalLabeling::mActiveDiagramLayers
protected

Definition at line 231 of file qgspallabeling.h.

Referenced by addDiagramLayer(), drawLabeling(), init(), and registerDiagramFeature().

QHash<QgsVectorLayer*, QgsPalLayerSettings> QgsPalLabeling::mActiveLayers
protected

Definition at line 229 of file qgspallabeling.h.

Referenced by drawLabeling(), init(), layer(), prepareLayer(), and registerFeature().

QList<QgsLabelCandidate> QgsPalLabeling::mCandidates
protected

Definition at line 241 of file qgspallabeling.h.

Referenced by drawLabelCandidateRect(), and drawLabeling().

int QgsPalLabeling::mCandLine
protected
int QgsPalLabeling::mCandPoint
protected
int QgsPalLabeling::mCandPolygon
protected
QgsPalLayerSettings QgsPalLabeling::mInvalidLayerSettings
protected

Definition at line 232 of file qgspallabeling.h.

Referenced by layer().

QgsLabelSearchTree* QgsPalLabeling::mLabelSearchTree
protected

Definition at line 246 of file qgspallabeling.h.

Referenced by drawLabeling(), labelsAtPosition(), QgsPalLabeling(), and ~QgsPalLabeling().

QgsMapRenderer* QgsPalLabeling::mMapRenderer
protected

Definition at line 234 of file qgspallabeling.h.

Referenced by addDiagramLayer(), drawLabeling(), exit(), init(), and prepareLayer().

pal::Pal* QgsPalLabeling::mPal
protected

Definition at line 238 of file qgspallabeling.h.

Referenced by addDiagramLayer(), drawLabeling(), exit(), init(), and prepareLayer().

Search QgsPalLabeling::mSearch
protected

Definition at line 236 of file qgspallabeling.h.

Referenced by init(), QgsPalLabeling(), searchMethod(), and setSearchMethod().

bool QgsPalLabeling::mShowingAllLabels
protected

Definition at line 244 of file qgspallabeling.h.

Referenced by clone(), drawLabeling(), and QgsPalLabeling().

bool QgsPalLabeling::mShowingCandidates
protected

Definition at line 242 of file qgspallabeling.h.

Referenced by clone(), drawLabeling(), and QgsPalLabeling().


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