QgsCentralPointPositionManager Class Reference

A simple position manager implementation which positions the overlay objects on the center point of a feature. More...

#include <qgscentralpointpositionmanager.h>

Inheritance diagram for QgsCentralPointPositionManager:

Inheritance graph
[legend]
Collaboration diagram for QgsCentralPointPositionManager:

Collaboration graph
[legend]

List of all members.

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 &centroidX, double &centroidY) 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.


Detailed Description

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

Note:
This class has been added in version 1.1

Definition at line 30 of file qgscentralpointpositionmanager.h.


Constructor & Destructor Documentation

QgsCentralPointPositionManager::QgsCentralPointPositionManager (  ) 

Definition at line 24 of file qgscentralpointpositionmanager.cpp.

QgsCentralPointPositionManager::~QgsCentralPointPositionManager (  ) 

Definition at line 29 of file qgscentralpointpositionmanager.cpp.


Member Function Documentation

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.

Parameters:
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]

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.

Returns:
0 in case of success

Definition at line 221 of file qgscentralpointpositionmanager.cpp.

Referenced by findObjectPosition().


Member Data Documentation

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().


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

Generated on Sat Feb 4 19:17:24 2012 for Quantum GIS API Documentation by  doxygen 1.5.6