#include <qgspallabeling.h>
Public Types | |
enum | Search { Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain, Falp } |
Public Member Functions | |
QgsPalLabeling () | |
~QgsPalLabeling () | |
QgsPalLayerSettings & | layer (const char *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 | |
virtual bool | willUseLayer (QgsVectorLayer *layer) |
called to find out whether the layer is used for labeling | |
virtual int | prepareLayer (QgsVectorLayer *layer, QSet< int > &attrIndices, QgsRenderContext &ctx) |
hook called when drawing layer before issuing select() | |
virtual void | registerFeature (QgsVectorLayer *layer, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext()) |
hook called when drawing for every feature in a layer | |
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 QgsLabelingEngineInterface * | clone () |
called when passing engine among map renderers | |
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 | |
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 |
QgsPalLayerSettings | mInvalidLayerSettings |
QgsMapRenderer * | mMapRenderer |
int | mCandPoint |
int | mCandLine |
int | mCandPolygon |
Search | mSearch |
pal::Pal * | mPal |
QList< QgsLabelCandidate > | mCandidates |
bool | mShowingCandidates |
bool | mShowingAllLabels |
Definition at line 165 of file qgspallabeling.h.
Definition at line 176 of file qgspallabeling.h.
QgsPalLabeling::QgsPalLabeling | ( | ) |
Definition at line 597 of file qgspallabeling.cpp.
References Chain, Falp, mCandLine, mCandPoint, mCandPolygon, mSearch, mShowingAllLabels, mShowingCandidates, Popmusic_Chain, Popmusic_Tabu, and Popmusic_Tabu_Chain.
Referenced by clone().
QgsPalLabeling::~QgsPalLabeling | ( | ) |
QgsPalLayerSettings & QgsPalLabeling::layer | ( | const char * | layerName | ) |
Definition at line 764 of file qgspallabeling.cpp.
References mActiveLayers, mInvalidLayerSettings, and QgsPalLayerSettings::palLayer.
Referenced by drawLabel(), and drawLabeling().
void QgsPalLabeling::numCandidatePositions | ( | int & | candPoint, | |
int & | candLine, | |||
int & | candPolygon | |||
) |
Definition at line 939 of file qgspallabeling.cpp.
References mCandLine, mCandPoint, and mCandPolygon.
void QgsPalLabeling::setNumCandidatePositions | ( | int | candPoint, | |
int | candLine, | |||
int | candPolygon | |||
) |
Definition at line 946 of file qgspallabeling.cpp.
References mCandLine, mCandPoint, and mCandPolygon.
void QgsPalLabeling::setSearchMethod | ( | QgsPalLabeling::Search | s | ) |
QgsPalLabeling::Search QgsPalLabeling::searchMethod | ( | ) | const |
bool QgsPalLabeling::isShowingCandidates | ( | ) | const [inline] |
Definition at line 181 of file qgspallabeling.h.
void QgsPalLabeling::setShowingCandidates | ( | bool | showing | ) | [inline] |
Definition at line 182 of file qgspallabeling.h.
const QList<QgsLabelCandidate>& QgsPalLabeling::candidates | ( | ) | [inline] |
Definition at line 183 of file qgspallabeling.h.
bool QgsPalLabeling::isShowingAllLabels | ( | ) | const [inline] |
Definition at line 185 of file qgspallabeling.h.
void QgsPalLabeling::setShowingAllLabels | ( | bool | showing | ) | [inline] |
Definition at line 186 of file qgspallabeling.h.
void QgsPalLabeling::init | ( | QgsMapRenderer * | mr | ) | [virtual] |
called when we're going to start with rendering
Implements QgsLabelingEngineInterface.
Definition at line 729 of file qgspallabeling.cpp.
References Chain, Falp, mCandLine, mCandPoint, mCandPolygon, mMapRenderer, mPal, mSearch, Popmusic_Chain, Popmusic_Tabu, and Popmusic_Tabu_Chain.
bool QgsPalLabeling::willUseLayer | ( | QgsVectorLayer * | layer | ) | [virtual] |
called to find out whether the layer is used for labeling
Implements QgsLabelingEngineInterface.
Definition at line 628 of file qgspallabeling.cpp.
References QgsPalLayerSettings::enabled, and QgsPalLayerSettings::readFromLayer().
int QgsPalLabeling::prepareLayer | ( | QgsVectorLayer * | layer, | |
QSet< int > & | attrIndices, | |||
QgsRenderContext & | ctx | |||
) | [virtual] |
hook called when drawing layer before issuing select()
Implements QgsLabelingEngineInterface.
Definition at line 635 of file qgspallabeling.cpp.
References QgsPalLayerSettings::AroundPoint, QgsMapRenderer::coordinateTransform(), QgsPalLayerSettings::ct, QgsPalLayerSettings::Curved, QgsPalLayerSettings::dataDefinedProperties, QgsMapRenderer::destinationSrs(), QgsPalLayerSettings::enabled, QgsPalLayerSettings::fieldIndex, QgsPalLayerSettings::fieldName, QgsVectorLayer::fieldNameIndex(), QgsPalLayerSettings::fontMetrics, QgsPalLayerSettings::Free, QgsMapLayer::getLayerID(), QgsMapRenderer::hasCrsTransformEnabled(), QgsPalLayerSettings::Horizontal, QgsPalLayerSettings::labelPerPart, QgsPalLayerSettings::Line, mActiveLayers, QgsPalLayerSettings::mergeLines, mMapRenderer, mPal, QgsPalLayerSettings::obstacle, QgsPalLayerSettings::OverPoint, QgsPalLayerSettings::palLayer, QgsPalLayerSettings::placement, QgsPalLayerSettings::placementFlags, QgsPalLayerSettings::priority, QgsPalLayerSettings::ptOne, QgsPalLayerSettings::ptZero, QgsPalLayerSettings::rasterCompressFactor, QgsRenderContext::rasterScaleFactor(), QgsPalLayerSettings::readFromLayer(), QgsRenderContext::scaleFactor(), QgsPalLayerSettings::scaleMax, QgsPalLayerSettings::scaleMin, QgsPalLayerSettings::sizeToPixel(), QgsMapLayer::srs(), QgsPalLayerSettings::textFont, QgsMapToPixel::toMapCoordinates(), QgsPalLayerSettings::vectorScaleFactor, and QgsPalLayerSettings::xform.
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 722 of file qgspallabeling.cpp.
References mActiveLayers, and QgsPalLayerSettings::registerFeature().
void QgsPalLabeling::drawLabeling | ( | QgsRenderContext & | context | ) | [virtual] |
called when the map is drawn and labels should be placed
Implements QgsLabelingEngineInterface.
Definition at line 777 of file qgspallabeling.cpp.
References QgsPalLayerSettings::Bold, QgsPalLayerSettings::BufferColor, QgsPalLayerSettings::bufferColor, QgsPalLayerSettings::BufferSize, QgsPalLayerSettings::bufferSize, QgsPalLayerSettings::Color, QgsMapRenderer::coordinateTransform(), QgsPalGeometry::dataDefinedValues(), drawLabel(), drawLabelCandidateRect(), QgsRenderContext::extent(), QgsPalLayerSettings::Family, QgsPalLayerSettings::geometries, QgsPalLayerSettings::Italic, layer(), mActiveLayers, mCandidates, mMapRenderer, mPal, mShowingAllLabels, mShowingCandidates, QgsRenderContext::painter(), QgsDebugMsg, QgsMapRenderer::scale(), QgsPalLayerSettings::Size, QgsPalLayerSettings::sizeToPixel(), QgsPalLayerSettings::Strikeout, QgsPalLayerSettings::textColor, QgsPalLayerSettings::textFont, QgsPalLayerSettings::Underline, QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
void QgsPalLabeling::exit | ( | ) | [virtual] |
called when we're done with rendering
Implements QgsLabelingEngineInterface.
Definition at line 757 of file qgspallabeling.cpp.
References mMapRenderer, and mPal.
Referenced by ~QgsPalLabeling().
QgsLabelingEngineInterface * QgsPalLabeling::clone | ( | ) | [virtual] |
called when passing engine among map renderers
Implements QgsLabelingEngineInterface.
Definition at line 1075 of file qgspallabeling.cpp.
References mShowingAllLabels, mShowingCandidates, and QgsPalLabeling().
void QgsPalLabeling::drawLabelCandidateRect | ( | pal::LabelPosition * | lp, | |
QPainter * | painter, | |||
const QgsMapToPixel * | xform | |||
) |
Definition at line 963 of file qgspallabeling.cpp.
References M_PI, mCandidates, QgsMapToPixel::transform(), QgsPoint::x(), and QgsPoint::y().
Referenced by drawLabeling().
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 | |||
) |
drawLabel
Definition at line 984 of file qgspallabeling.cpp.
References QgsPalLayerSettings::addDirectionSymbol, drawLabelBuffer(), QgsPalLayerSettings::fontMetrics, layer(), QgsPalLayerSettings::Line, M_PI, QgsPalLayerSettings::multiLineLabels, QgsPalLayerSettings::placement, QgsPalLayerSettings::rasterCompressFactor, QgsMapToPixel::transform(), QgsPalLayerSettings::vectorScaleFactor, QgsPoint::x(), and QgsPoint::y().
Referenced by drawLabeling().
void QgsPalLabeling::drawLabelBuffer | ( | QPainter * | p, | |
QString | text, | |||
const QFont & | font, | |||
double | size, | |||
QColor | color | |||
) | [static] |
void QgsPalLabeling::initPal | ( | ) | [protected] |
QHash<QgsVectorLayer*, QgsPalLayerSettings> QgsPalLabeling::mActiveLayers [protected] |
Definition at line 218 of file qgspallabeling.h.
Referenced by drawLabeling(), layer(), prepareLayer(), and registerFeature().
QgsMapRenderer* QgsPalLabeling::mMapRenderer [protected] |
Definition at line 221 of file qgspallabeling.h.
Referenced by drawLabeling(), exit(), init(), and prepareLayer().
int QgsPalLabeling::mCandPoint [protected] |
Definition at line 222 of file qgspallabeling.h.
Referenced by init(), numCandidatePositions(), QgsPalLabeling(), and setNumCandidatePositions().
int QgsPalLabeling::mCandLine [protected] |
Definition at line 222 of file qgspallabeling.h.
Referenced by init(), numCandidatePositions(), QgsPalLabeling(), and setNumCandidatePositions().
int QgsPalLabeling::mCandPolygon [protected] |
Definition at line 222 of file qgspallabeling.h.
Referenced by init(), numCandidatePositions(), QgsPalLabeling(), and setNumCandidatePositions().
Search QgsPalLabeling::mSearch [protected] |
Definition at line 223 of file qgspallabeling.h.
Referenced by init(), QgsPalLabeling(), searchMethod(), and setSearchMethod().
pal::Pal* QgsPalLabeling::mPal [protected] |
Definition at line 225 of file qgspallabeling.h.
Referenced by drawLabeling(), exit(), init(), and prepareLayer().
QList<QgsLabelCandidate> QgsPalLabeling::mCandidates [protected] |
Definition at line 228 of file qgspallabeling.h.
Referenced by drawLabelCandidateRect(), and drawLabeling().
bool QgsPalLabeling::mShowingCandidates [protected] |
Definition at line 229 of file qgspallabeling.h.
Referenced by clone(), drawLabeling(), and QgsPalLabeling().
bool QgsPalLabeling::mShowingAllLabels [protected] |
Definition at line 231 of file qgspallabeling.h.
Referenced by clone(), drawLabeling(), and QgsPalLabeling().