Quantum GIS API Documentation
1.8
|
#include <qgspallabeling.h>
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 | |
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 int | addDiagramLayer (QgsVectorLayer *layer, QgsDiagramLayerSettings *s) |
adds a diagram layer to the labeling engine | |
virtual void | registerFeature (QgsVectorLayer *layer, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext()) |
hook called when drawing for every feature in a layer | |
virtual void | registerDiagramFeature (QgsVectorLayer *layer, 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 QList< QgsLabelPosition > | labelsAtPosition (const QgsPoint &p) |
return infos about labels at a given (map) position | |
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 |
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 |
Definition at line 185 of file qgspallabeling.h.
Definition at line 196 of file qgspallabeling.h.
Definition at line 729 of file qgspallabeling.cpp.
References Chain, Falp, mCandLine, mCandPoint, mCandPolygon, mLabelSearchTree, mSearch, mShowingAllLabels, mShowingCandidates, Popmusic_Chain, Popmusic_Tabu, and Popmusic_Tabu_Chain.
Referenced by clone().
Definition at line 755 of file qgspallabeling.cpp.
References exit(), and mLabelSearchTree.
int QgsPalLabeling::addDiagramLayer | ( | QgsVectorLayer * | layer, |
QgsDiagramLayerSettings * | s | ||
) | [virtual] |
adds a diagram layer to the labeling engine
Reimplemented from QgsLabelingEngineInterface.
Definition at line 879 of file qgspallabeling.cpp.
References QgsMapRenderer::coordinateTransform(), QgsMapLayer::crs(), QgsDiagramLayerSettings::ct, QgsMapRenderer::destinationCrs(), QgsMapRenderer::hasCrsTransformEnabled(), QgsMapLayer::id(), mActiveDiagramLayers, mMapRenderer, mPal, QgsDiagramLayerSettings::obstacle, QgsDiagramLayerSettings::palLayer, QgsDiagramLayerSettings::placement, QgsDiagramLayerSettings::placementFlags, QgsDiagramLayerSettings::priority, and QgsDiagramLayerSettings::xform.
const QList<QgsLabelCandidate>& QgsPalLabeling::candidates | ( | ) | [inline] |
Definition at line 203 of file qgspallabeling.h.
QgsLabelingEngineInterface * QgsPalLabeling::clone | ( | ) | [virtual] |
called when passing engine among map renderers
Implements QgsLabelingEngineInterface.
Definition at line 1400 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 |
||
) |
drawLabel
Definition at line 1322 of file qgspallabeling.cpp.
References QgsPalLayerSettings::addDirectionSymbol, drawLabelBuffer(), QgsPalLayerSettings::fontMetrics, layer(), QgsPalLayerSettings::Line, M_PI, QgsPalLayerSettings::placement, QgsPalLayerSettings::rasterCompressFactor, QgsMapToPixel::transform(), QgsPalLayerSettings::vectorScaleFactor, QgsPalLayerSettings::wrapChar, QgsPoint::x(), and QgsPoint::y().
Referenced by drawLabeling().
void QgsPalLabeling::drawLabelBuffer | ( | QPainter * | p, |
QString | text, | ||
const QFont & | font, | ||
double | size, | ||
QColor | color | ||
) | [static] |
Definition at line 1389 of file qgspallabeling.cpp.
Referenced by drawLabel().
void QgsPalLabeling::drawLabelCandidateRect | ( | pal::LabelPosition * | lp, |
QPainter * | painter, | ||
const QgsMapToPixel * | xform | ||
) |
Definition at line 1301 of file qgspallabeling.cpp.
References M_PI, mCandidates, QgsMapToPixel::transform(), QgsPoint::x(), and QgsPoint::y().
Referenced by drawLabeling().
void QgsPalLabeling::drawLabeling | ( | QgsRenderContext & | context | ) | [virtual] |
called when the map is drawn and labels should be placed
Implements QgsLabelingEngineInterface.
Definition at line 1051 of file qgspallabeling.cpp.
References QgsPalLayerSettings::Bold, QgsPalLayerSettings::BufferColor, QgsPalLayerSettings::bufferColor, QgsPalLayerSettings::BufferSize, QgsPalLayerSettings::bufferSize, QgsLabelSearchTree::clear(), QgsPalLayerSettings::Color, QgsMapRenderer::coordinateTransform(), QgsPalGeometry::dataDefinedValues(), QgsPalGeometry::diagramAttributes(), drawLabel(), drawLabelCandidateRect(), QgsRenderContext::extent(), QgsPalLayerSettings::Family, QgsDiagramLayerSettings::geometries, QgsPalLayerSettings::geometries, QgsLabelSearchTree::insertLabel(), QgsPalGeometry::isDiagram(), QgsPalLayerSettings::Italic, layer(), mActiveDiagramLayers, mActiveLayers, mCandidates, mLabelSearchTree, mMapRenderer, mPal, mShowingAllLabels, mShowingCandidates, QgsRenderContext::painter(), QgsDebugMsg, QgsMapRenderer::scale(), QgsPalLayerSettings::Size, QgsPalLayerSettings::sizeToPixel(), QgsPalGeometry::strId(), QgsPalLayerSettings::Strikeout, QgsPalLayerSettings::textColor, QgsPalLayerSettings::textFont, QgsMapToPixel::transform(), QgsPalLayerSettings::Underline, QgsPoint::x(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsPoint::y(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
void QgsPalLabeling::exit | ( | ) | [virtual] |
called when we're done with rendering
Implements QgsLabelingEngineInterface.
Definition at line 1030 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 999 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 205 of file qgspallabeling.h.
bool QgsPalLabeling::isShowingCandidates | ( | ) | const [inline] |
Definition at line 201 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 1259 of file qgspallabeling.cpp.
References QgsLabelSearchTree::label(), and mLabelSearchTree.
QgsPalLayerSettings & QgsPalLabeling::layer | ( | const QString & | layerName | ) |
Definition at line 1037 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 1277 of file qgspallabeling.cpp.
References mCandLine, mCandPoint, and mCandPolygon.
int QgsPalLabeling::prepareLayer | ( | QgsVectorLayer * | layer, |
QSet< int > & | attrIndices, | ||
QgsRenderContext & | ctx | ||
) | [virtual] |
hook called when drawing layer before issuing select()
Implements QgsLabelingEngineInterface.
Definition at line 771 of file qgspallabeling.cpp.
References QgsPalLayerSettings::AroundPoint, QgsMapRenderer::coordinateTransform(), QgsMapLayer::crs(), QgsPalLayerSettings::ct, QgsPalLayerSettings::Curved, QgsPalLayerSettings::dataDefinedProperties, QgsMapRenderer::destinationCrs(), QgsPalLayerSettings::enabled, QgsMapRenderer::extent(), QgsPalLayerSettings::extentGeom, QgsPalLayerSettings::fieldIndex, QgsPalLayerSettings::fieldName, QgsVectorLayer::fieldNameIndex(), QgsPalLayerSettings::fontMetrics, QgsPalLayerSettings::Free, QgsGeometry::fromRect(), QgsMapRenderer::hasCrsTransformEnabled(), QgsPalLayerSettings::Horizontal, QgsMapLayer::id(), QgsPalLayerSettings::isExpression, QgsPalLayerSettings::labelPerPart, layer(), QgsPalLayerSettings::Line, mActiveLayers, QgsPalLayerSettings::mergeLines, mMapRenderer, mPal, QgsPalLayerSettings::obstacle, QgsPalLayerSettings::OverPoint, QgsPalLayerSettings::palLayer, QgsPalLayerSettings::placement, QgsPalLayerSettings::placementFlags, QgsPalLayerSettings::priority, QgsPalLayerSettings::ptOne, QgsPalLayerSettings::ptZero, QgsDebugMsg, QgsPalLayerSettings::rasterCompressFactor, QgsRenderContext::rasterScaleFactor(), QgsPalLayerSettings::readFromLayer(), QgsExpression::referencedColumns(), QgsRenderContext::scaleFactor(), QgsPalLayerSettings::scaleMax, QgsPalLayerSettings::scaleMin, QgsPalLayerSettings::sizeToPixel(), QgsPalLayerSettings::textFont, QgsMapToPixel::toMapCoordinates(), QgsPalLayerSettings::vectorScaleFactor, and QgsPalLayerSettings::xform.
void QgsPalLabeling::registerDiagramFeature | ( | QgsVectorLayer * | layer, |
QgsFeature & | feat, | ||
const QgsRenderContext & | context = QgsRenderContext() |
||
) | [virtual] |
called for every diagram feature
Reimplemented from QgsLabelingEngineInterface.
Definition at line 900 of file qgspallabeling.cpp.
References QgsPalGeometry::addDiagramAttribute(), QgsGeometry::asGeos(), QgsFeature::attributeMap(), QgsDiagramRendererV2::diagramAttributes(), QgsFeature::geometry(), QgsFeature::id(), mActiveDiagramLayers, QgsDebugMsg, QgsPalGeometry::setIsDiagram(), QgsDiagramRendererV2::sizeMapUnits(), QgsPalGeometry::strId(), QgsGeometry::transform(), QgsCoordinateTransform::transformInPlace(), willUseLayer(), and QgsPoint::x().
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 894 of file qgspallabeling.cpp.
References layer(), mActiveLayers, and QgsPalLayerSettings::registerFeature().
Definition at line 1296 of file qgspallabeling.cpp.
References mSearch.
void QgsPalLabeling::setNumCandidatePositions | ( | int | candPoint, |
int | candLine, | ||
int | candPolygon | ||
) |
Definition at line 1284 of file qgspallabeling.cpp.
References mCandLine, mCandPoint, and mCandPolygon.
Definition at line 1291 of file qgspallabeling.cpp.
References mSearch.
void QgsPalLabeling::setShowingAllLabels | ( | bool | showing | ) | [inline] |
Definition at line 206 of file qgspallabeling.h.
void QgsPalLabeling::setShowingCandidates | ( | bool | showing | ) | [inline] |
Definition at line 202 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 764 of file qgspallabeling.cpp.
References QgsPalLayerSettings::enabled, and QgsPalLayerSettings::readFromLayer().
Referenced by registerDiagramFeature().
QHash<QgsVectorLayer*, QgsDiagramLayerSettings> QgsPalLabeling::mActiveDiagramLayers [protected] |
Definition at line 245 of file qgspallabeling.h.
Referenced by addDiagramLayer(), drawLabeling(), init(), and registerDiagramFeature().
QHash<QgsVectorLayer*, QgsPalLayerSettings> QgsPalLabeling::mActiveLayers [protected] |
Definition at line 243 of file qgspallabeling.h.
Referenced by drawLabeling(), init(), layer(), prepareLayer(), and registerFeature().
QList<QgsLabelCandidate> QgsPalLabeling::mCandidates [protected] |
Definition at line 255 of file qgspallabeling.h.
Referenced by drawLabelCandidateRect(), and drawLabeling().
int QgsPalLabeling::mCandLine [protected] |
Definition at line 249 of file qgspallabeling.h.
Referenced by init(), numCandidatePositions(), QgsPalLabeling(), and setNumCandidatePositions().
int QgsPalLabeling::mCandPoint [protected] |
Definition at line 249 of file qgspallabeling.h.
Referenced by init(), numCandidatePositions(), QgsPalLabeling(), and setNumCandidatePositions().
int QgsPalLabeling::mCandPolygon [protected] |
Definition at line 249 of file qgspallabeling.h.
Referenced by init(), numCandidatePositions(), QgsPalLabeling(), and setNumCandidatePositions().
Definition at line 246 of file qgspallabeling.h.
Referenced by layer().
QgsLabelSearchTree* QgsPalLabeling::mLabelSearchTree [protected] |
Definition at line 260 of file qgspallabeling.h.
Referenced by drawLabeling(), labelsAtPosition(), QgsPalLabeling(), and ~QgsPalLabeling().
QgsMapRenderer* QgsPalLabeling::mMapRenderer [protected] |
Definition at line 248 of file qgspallabeling.h.
Referenced by addDiagramLayer(), drawLabeling(), exit(), init(), and prepareLayer().
pal::Pal* QgsPalLabeling::mPal [protected] |
Definition at line 252 of file qgspallabeling.h.
Referenced by addDiagramLayer(), drawLabeling(), exit(), init(), and prepareLayer().
Search QgsPalLabeling::mSearch [protected] |
Definition at line 250 of file qgspallabeling.h.
Referenced by init(), QgsPalLabeling(), searchMethod(), and setSearchMethod().
bool QgsPalLabeling::mShowingAllLabels [protected] |
Definition at line 258 of file qgspallabeling.h.
Referenced by clone(), drawLabeling(), and QgsPalLabeling().
bool QgsPalLabeling::mShowingCandidates [protected] |
Definition at line 256 of file qgspallabeling.h.
Referenced by clone(), drawLabeling(), and QgsPalLabeling().