#include <qgscentralpointpositionmanager.h>


Public Member Functions | |
| QgsCentralPointPositionManager () | |
| ~QgsCentralPointPositionManager () | |
| void | addLayer (QgsVectorLayer *vl, QList< QgsVectorOverlay * > &overlays) |
| Adds a layer that may contain * overlays to the position manager. | |
| void | removeLayers () |
| Removes all the overlays. | |
| void | findObjectPositions (const QgsRenderContext &context, QGis::UnitType unitType) |
| Calculate positions for the overlay objects. | |
Private Member Functions | |
| int | findObjectPosition (const unsigned char *wkb, QgsPoint &position) const |
| Calculates the central point for points/lines/polygons. | |
| int | calculatePolygonCentroid (double x[], double y[], int numberOfPoints, double ¢roidX, double ¢roidY) const |
| Calculates the polygon centroid with the algorithm from Graphics gems IV: Centroid of a polygon. | |
Private Attributes | |
| QList< QgsVectorOverlay * > | mOverlays |
| Stores all the overlay objects to retrieve all objects when positioning. | |
It does not consider conflicts in case of several overlay layers
Definition at line 30 of file qgscentralpointpositionmanager.h.
| QgsCentralPointPositionManager::QgsCentralPointPositionManager | ( | ) |
Definition at line 24 of file qgscentralpointpositionmanager.cpp.
| QgsCentralPointPositionManager::~QgsCentralPointPositionManager | ( | ) |
Definition at line 29 of file qgscentralpointpositionmanager.cpp.
| void QgsCentralPointPositionManager::addLayer | ( | QgsVectorLayer * | vl, | |
| QList< QgsVectorOverlay * > & | overlays | |||
| ) | [virtual] |
Adds a layer that may contain * overlays to the position manager.
The overlay objects contained in the overlays will then be considered in label placement
Implements QgsOverlayObjectPositionManager.
Definition at line 34 of file qgscentralpointpositionmanager.cpp.
References mOverlays.
| void QgsCentralPointPositionManager::removeLayers | ( | ) | [virtual] |
Removes all the overlays.
Implements QgsOverlayObjectPositionManager.
Definition at line 39 of file qgscentralpointpositionmanager.cpp.
References mOverlays.
| void QgsCentralPointPositionManager::findObjectPositions | ( | const QgsRenderContext & | context, | |
| QGis::UnitType | unitType | |||
| ) | [virtual] |
Calculate positions for the overlay objects.
| context | Context of rendering operation (Painter, scale factor) | |
| unitType | meters, feet, degrees |
Implements QgsOverlayObjectPositionManager.
Definition at line 44 of file qgscentralpointpositionmanager.cpp.
References findObjectPosition(), mOverlays, and QgsVectorOverlay::overlayObjects().
| int QgsCentralPointPositionManager::findObjectPosition | ( | const unsigned char * | wkb, | |
| QgsPoint & | position | |||
| ) | const [private] |
Calculates the central point for points/lines/polygons.
Returns 0 in case of success
Definition at line 75 of file qgscentralpointpositionmanager.cpp.
References calculatePolygonCentroid(), QgsPoint::setX(), QgsPoint::setY(), QGis::WKBLineString, QGis::WKBLineString25D, QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, QGis::WKBMultiPoint, QGis::WKBMultiPoint25D, QGis::WKBMultiPolygon, QGis::WKBMultiPolygon25D, QGis::WKBPoint, QGis::WKBPoint25D, QGis::WKBPolygon, and QGis::WKBPolygon25D.
Referenced by findObjectPositions().
| int QgsCentralPointPositionManager::calculatePolygonCentroid | ( | double | x[], | |
| double | y[], | |||
| int | numberOfPoints, | |||
| double & | centroidX, | |||
| double & | centroidY | |||
| ) | const [private] |
Calculates the polygon centroid with the algorithm from Graphics gems IV: Centroid of a polygon.
Definition at line 221 of file qgscentralpointpositionmanager.cpp.
Referenced by findObjectPosition().
QList<QgsVectorOverlay*> QgsCentralPointPositionManager::mOverlays [private] |
Stores all the overlay objects to retrieve all objects when positioning.
Definition at line 48 of file qgscentralpointpositionmanager.h.
Referenced by addLayer(), findObjectPositions(), and removeLayers().
1.5.6