|
Quantum GIS API Documentation
1.7.5-Wroclaw
|
A simple position manager implementation which positions the overlay objects on the center point of a feature. More...
#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. | |
Public Member Functions inherited from QgsOverlayObjectPositionManager | |
| virtual | ~QgsOverlayObjectPositionManager () |
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. | |
A simple position manager implementation which positions the overlay objects on the center point of a feature.
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.
|
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.
|
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().
|
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().
|
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().
|
virtual |
Removes all the overlays.
Implements QgsOverlayObjectPositionManager.
Definition at line 39 of file qgscentralpointpositionmanager.cpp.
References 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.8.1