QgsNorthArrowPlugin Class Reference

#include <plugin.h>

Inheritance diagram for QgsNorthArrowPlugin:

Inheritance graph
[legend]
Collaboration diagram for QgsNorthArrowPlugin:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 36 of file plugin.h.

Public Slots

virtual void initGui ()
 init the gui
void projectRead ()
 set values on the gui when a project is read or the gui first loaded
void run ()
 Show the dialog box.
void renderNorthArrow (QPainter *)
void rotationChanged (int)
 Run when the user has set a new rotation.
void refreshCanvas ()
 Refresh the map display using the mapcanvas exported via the plugin interface.
void unload ()
 unload the plugin
void help ()
 show the help document
void setPlacement (int)
 set north arrow placement
void setEnabled (bool)
 enable or disable north arrow
void setAutomatic (bool)
 enable or disable the automatic setting of the arrow direction
bool calculateNorthDirection ()
 try to calculate the direction for the north arrow. Sets the

Public Member Functions

 QgsNorthArrowPlugin (QgisInterface *)
 Constructor for a plugin.
virtual ~QgsNorthArrowPlugin ()
 Destructor.

Private Attributes

int mRotationInt
int pluginType
bool mEnable
bool mAutomatic
 enable or disable the automatic setting of the arrow direction
int mPlacementIndex
QStringList mPlacementLabels
QgisInterfaceqGisInterface
 Pointer to the QGIS interface object.
QAction * myQActionPointer
 Pointer to the QAction object used in the menu and toolbar.

Static Private Attributes

static const double PI
static const double TOL


Constructor & Destructor Documentation

QgsNorthArrowPlugin::QgsNorthArrowPlugin ( QgisInterface  ) 

Constructor for a plugin.

The QgisInterface pointer is passed by QGIS when it attempts to instantiate the plugin.

Parameters:
qI Pointer to the QgisInterface object.

Definition at line 74 of file plugin.cpp.

References mAutomatic, mPlacementLabels, and mRotationInt.

QgsNorthArrowPlugin::~QgsNorthArrowPlugin (  )  [virtual]

Destructor.

Definition at line 84 of file plugin.cpp.


Member Function Documentation

void QgsNorthArrowPlugin::initGui (  )  [virtual, slot]

init the gui

Implements QgisPlugin.

Definition at line 91 of file plugin.cpp.

References QgisInterface::addPluginToMenu(), QgisInterface::addToolBarIcon(), QgisInterface::mainWindow(), QgisInterface::mapCanvas(), myQActionPointer, projectRead(), qGisInterface, refreshCanvas(), renderNorthArrow(), and run().

void QgsNorthArrowPlugin::projectRead (  )  [slot]

set values on the gui when a project is read or the gui first loaded

Definition at line 111 of file plugin.cpp.

References QgsProject::instance(), mAutomatic, mEnable, mPlacementIndex, mRotationInt, QgsProject::readBoolEntry(), and QgsProject::readNumEntry().

Referenced by initGui().

void QgsNorthArrowPlugin::run (  )  [slot]

Show the dialog box.

Definition at line 128 of file plugin.cpp.

References QgisInterface::mainWindow(), mAutomatic, mEnable, QgisGui::ModalDialogFlags, mPlacementIndex, mPlacementLabels, mRotationInt, qGisInterface, refreshCanvas(), rotationChanged(), setAutomatic(), QgsNorthArrowPluginGui::setAutomatic(), setEnabled(), QgsNorthArrowPluginGui::setEnabled(), setPlacement(), QgsNorthArrowPluginGui::setPlacement(), QgsNorthArrowPluginGui::setPlacementLabels(), and QgsNorthArrowPluginGui::setRotation().

Referenced by initGui().

void QgsNorthArrowPlugin::renderNorthArrow ( QPainter *   )  [slot]

Definition at line 154 of file plugin.cpp.

References calculateNorthDirection(), mAutomatic, mEnable, mPlacementIndex, mRotationInt, PI, and QgsApplication::pkgDataPath().

Referenced by initGui(), and unload().

void QgsNorthArrowPlugin::rotationChanged ( int   )  [slot]

Run when the user has set a new rotation.

Definition at line 265 of file plugin.cpp.

References QgsProject::instance(), mRotationInt, and QgsProject::writeEntry().

Referenced by run().

void QgsNorthArrowPlugin::refreshCanvas (  )  [slot]

Refresh the map display using the mapcanvas exported via the plugin interface.

Definition at line 149 of file plugin.cpp.

References QgisInterface::mapCanvas(), qGisInterface, and QgsMapCanvas::refresh().

Referenced by initGui(), run(), and unload().

void QgsNorthArrowPlugin::unload (  )  [virtual, slot]

unload the plugin

Implements QgisPlugin.

Definition at line 251 of file plugin.cpp.

References QgisInterface::mapCanvas(), myQActionPointer, qGisInterface, refreshCanvas(), QgisInterface::removePluginMenu(), QgisInterface::removeToolBarIcon(), and renderNorthArrow().

void QgsNorthArrowPlugin::help (  )  [slot]

show the help document

Definition at line 122 of file plugin.cpp.

void QgsNorthArrowPlugin::setPlacement ( int   )  [slot]

set north arrow placement

Definition at line 272 of file plugin.cpp.

References QgsProject::instance(), mPlacementIndex, and QgsProject::writeEntry().

Referenced by run().

void QgsNorthArrowPlugin::setEnabled ( bool   )  [slot]

enable or disable north arrow

Definition at line 278 of file plugin.cpp.

References QgsProject::instance(), mEnable, and QgsProject::writeEntry().

Referenced by run().

void QgsNorthArrowPlugin::setAutomatic ( bool   )  [slot]

enable or disable the automatic setting of the arrow direction

Definition at line 284 of file plugin.cpp.

References calculateNorthDirection(), QgsProject::instance(), mAutomatic, and QgsProject::writeEntry().

Referenced by run().

bool QgsNorthArrowPlugin::calculateNorthDirection (  )  [slot]

try to calculate the direction for the north arrow. Sets the

Definition at line 292 of file plugin.cpp.

References MathUtils::angle(), QgsRect::center(), QgsCoordinateReferenceSystem::createFromProj4(), QgsMapRenderer::destinationSrs(), QgsMapCanvas::extent(), QgsRect::height(), QgsCoordinateReferenceSystem::isValid(), QgsMapCanvas::layerCount(), QgisInterface::mapCanvas(), QgsMapCanvas::mapRenderer(), mRotationInt, PI, qGisInterface, QgsDebugMsg, and TOL.

Referenced by renderNorthArrow(), and setAutomatic().


Member Data Documentation

const double QgsNorthArrowPlugin::PI [static, private]

Definition at line 78 of file plugin.h.

Referenced by calculateNorthDirection(), and renderNorthArrow().

const double QgsNorthArrowPlugin::TOL [static, private]

Definition at line 80 of file plugin.h.

Referenced by calculateNorthDirection().

int QgsNorthArrowPlugin::mRotationInt [private]

Definition at line 83 of file plugin.h.

Referenced by calculateNorthDirection(), projectRead(), QgsNorthArrowPlugin(), renderNorthArrow(), rotationChanged(), and run().

int QgsNorthArrowPlugin::pluginType [private]

Definition at line 84 of file plugin.h.

bool QgsNorthArrowPlugin::mEnable [private]

Definition at line 86 of file plugin.h.

Referenced by projectRead(), renderNorthArrow(), run(), and setEnabled().

bool QgsNorthArrowPlugin::mAutomatic [private]

enable or disable the automatic setting of the arrow direction

Definition at line 88 of file plugin.h.

Referenced by projectRead(), QgsNorthArrowPlugin(), renderNorthArrow(), run(), and setAutomatic().

int QgsNorthArrowPlugin::mPlacementIndex [private]

Definition at line 90 of file plugin.h.

Referenced by projectRead(), renderNorthArrow(), run(), and setPlacement().

QStringList QgsNorthArrowPlugin::mPlacementLabels [private]

Definition at line 91 of file plugin.h.

Referenced by QgsNorthArrowPlugin(), and run().

QgisInterface* QgsNorthArrowPlugin::qGisInterface [private]

Pointer to the QGIS interface object.

Definition at line 93 of file plugin.h.

Referenced by calculateNorthDirection(), initGui(), refreshCanvas(), run(), and unload().

QAction* QgsNorthArrowPlugin::myQActionPointer [private]

Pointer to the QAction object used in the menu and toolbar.

Definition at line 95 of file plugin.h.

Referenced by initGui(), and unload().


The documentation for this class was generated from the following files:
Generated on Tue Oct 28 16:52:01 2008 for Quantum GIS API Documentation by  doxygen 1.5.1