mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
Fix for bug 1077196 (plugin icons incorrect on first load). A tricky one.
git-svn-id: http://svn.osgeo.org/qgis/trunk@3198 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
3f519be7fc
commit
e3f307e610
@ -69,14 +69,15 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
|
|||||||
* @param theQGisApp - Pointer to the QGIS main window
|
* @param theQGisApp - Pointer to the QGIS main window
|
||||||
* @param theQGisInterface - Pointer to the QGIS interface object
|
* @param theQGisInterface - Pointer to the QGIS interface object
|
||||||
*/
|
*/
|
||||||
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterface):
|
QgsCommunityRegPlugin::QgsCommunityRegPlugin(QgisApp * theQGisApp,
|
||||||
|
QgisIface * theQgisInterface):
|
||||||
mQGisApp(theQGisApp),
|
mQGisApp(theQGisApp),
|
||||||
mQGisIface(theQgisInterface),
|
mQGisIface(theQgisInterface),
|
||||||
QgisPlugin(sName,sDescription,sPluginVersion,sPluginType)
|
QgisPlugin(sName,sDescription,sPluginVersion,sPluginType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin::~Plugin()
|
QgsCommunityRegPlugin::~QgsCommunityRegPlugin()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -84,7 +85,7 @@ Plugin::~Plugin()
|
|||||||
/*
|
/*
|
||||||
* Initialize the GUI interface for the plugin
|
* Initialize the GUI interface for the plugin
|
||||||
*/
|
*/
|
||||||
void Plugin::initGui()
|
void QgsCommunityRegPlugin::initGui()
|
||||||
{
|
{
|
||||||
QPopupMenu *pluginMenu = new QPopupMenu(mQGisApp);
|
QPopupMenu *pluginMenu = new QPopupMenu(mQGisApp);
|
||||||
pluginMenu->insertItem(QIconSet(icon),"&Community Register", this, SLOT(run()));
|
pluginMenu->insertItem(QIconSet(icon),"&Community Register", this, SLOT(run()));
|
||||||
@ -102,13 +103,13 @@ void Plugin::initGui()
|
|||||||
|
|
||||||
}
|
}
|
||||||
//method defined in interface
|
//method defined in interface
|
||||||
void Plugin::help()
|
void QgsCommunityRegPlugin::help()
|
||||||
{
|
{
|
||||||
//implement me!
|
//implement me!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slot called when the buffer menu item is activated
|
// Slot called when the buffer menu item is activated
|
||||||
void Plugin::run()
|
void QgsCommunityRegPlugin::run()
|
||||||
{
|
{
|
||||||
PluginGui *myPluginGui=new PluginGui(mQGisApp,"Community Register",true,0);
|
PluginGui *myPluginGui=new PluginGui(mQGisApp,"Community Register",true,0);
|
||||||
//listen for when the layer has been made so we can draw it
|
//listen for when the layer has been made so we can draw it
|
||||||
@ -118,7 +119,7 @@ void Plugin::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unload the plugin by cleaning up the GUI
|
// Unload the plugin by cleaning up the GUI
|
||||||
void Plugin::unload()
|
void QgsCommunityRegPlugin::unload()
|
||||||
{
|
{
|
||||||
// remove the GUI
|
// remove the GUI
|
||||||
mMenuBarPointer->removeItem(mMenuId);
|
mMenuBarPointer->removeItem(mMenuId);
|
||||||
@ -140,7 +141,7 @@ void Plugin::unload()
|
|||||||
|
|
||||||
//!draw a raster layer in the qui - intended to respond to signal sent by diolog when it as finished creating
|
//!draw a raster layer in the qui - intended to respond to signal sent by diolog when it as finished creating
|
||||||
//layer
|
//layer
|
||||||
void Plugin::drawRasterLayer(QString theQString)
|
void QgsCommunityRegPlugin::drawRasterLayer(QString theQString)
|
||||||
{
|
{
|
||||||
mQGisIface->addRasterLayer(theQString);
|
mQGisIface->addRasterLayer(theQString);
|
||||||
}
|
}
|
||||||
@ -148,7 +149,7 @@ void Plugin::drawRasterLayer(QString theQString)
|
|||||||
//!draw a vector layer in the qui - intended to respond to signal sent by
|
//!draw a vector layer in the qui - intended to respond to signal sent by
|
||||||
// dialog when it as finished creating a layer. It needs to be given
|
// dialog when it as finished creating a layer. It needs to be given
|
||||||
// vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
|
// vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
|
||||||
void Plugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
|
void QgsCommunityRegPlugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
|
||||||
{
|
{
|
||||||
mQGisIface->addVectorLayer( thePathNameQString, theBaseNameQString, theProviderQString);
|
mQGisIface->addVectorLayer( thePathNameQString, theBaseNameQString, theProviderQString);
|
||||||
}
|
}
|
||||||
@ -173,7 +174,7 @@ void Plugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQStr
|
|||||||
// Class factory to return a new instance of the plugin class
|
// Class factory to return a new instance of the plugin class
|
||||||
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
||||||
{
|
{
|
||||||
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
|
return new QgsCommunityRegPlugin(theQGisAppPointer, theQgisInterfacePointer);
|
||||||
}
|
}
|
||||||
// Return the name of the plugin - note that we do not user class members as
|
// Return the name of the plugin - note that we do not user class members as
|
||||||
// the class may not yet be insantiated when this method is called.
|
// the class may not yet be insantiated when this method is called.
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
* DON'T: separate variable names using underscores: my_variable_name (NO!)
|
* DON'T: separate variable names using underscores: my_variable_name (NO!)
|
||||||
*
|
*
|
||||||
* **************************************************************************/
|
* **************************************************************************/
|
||||||
#ifndef PLUGIN
|
#ifndef QGSCOMMUNITYREGPLUGIN
|
||||||
#define PLUGIN
|
#define QGSCOMMUNITYREGPLUGIN
|
||||||
#include "../qgisplugin.h"
|
#include "../qgisplugin.h"
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
|
|
||||||
@ -47,7 +47,7 @@
|
|||||||
* \brief [name] plugin for QGIS
|
* \brief [name] plugin for QGIS
|
||||||
* [description]
|
* [description]
|
||||||
*/
|
*/
|
||||||
class Plugin:public QObject, public QgisPlugin
|
class QgsCommunityRegPlugin:public QObject, public QgisPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT public:
|
Q_OBJECT public:
|
||||||
|
|
||||||
@ -63,9 +63,9 @@ class Plugin:public QObject, public QgisPlugin
|
|||||||
* @param Pointer to the QgisApp object
|
* @param Pointer to the QgisApp object
|
||||||
* @param Pointer to the QgisIface object.
|
* @param Pointer to the QgisIface object.
|
||||||
*/
|
*/
|
||||||
Plugin(QgisApp * , QgisIface * );
|
QgsCommunityRegPlugin(QgisApp * , QgisIface * );
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~ Plugin();
|
virtual ~ QgsCommunityRegPlugin();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! init the gui
|
//! init the gui
|
||||||
|
@ -74,19 +74,20 @@ static const QgisPlugin::PLUGINTYPE type_ = QgisPlugin::UI;
|
|||||||
* @param qgis Pointer to the QGIS main window
|
* @param qgis Pointer to the QGIS main window
|
||||||
* @param _qI Pointer to the QGIS interface object
|
* @param _qI Pointer to the QGIS interface object
|
||||||
*/
|
*/
|
||||||
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
|
QgsCopyrightLabelPlugin::QgsCopyrightLabelPlugin(QgisApp * theQGisApp,
|
||||||
|
QgisIface * theQgisInterFace):
|
||||||
qgisMainWindowPointer(theQGisApp),
|
qgisMainWindowPointer(theQGisApp),
|
||||||
qGisInterface(theQgisInterFace),
|
qGisInterface(theQgisInterFace),
|
||||||
QgisPlugin(name_,description_,version_,type_)
|
QgisPlugin(name_,description_,version_,type_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Plugin::~Plugin()
|
QgsCopyrightLabelPlugin::~QgsCopyrightLabelPlugin()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the GUI interface for the plugin
|
* Initialize the GUI interface for the plugin
|
||||||
*/
|
*/
|
||||||
void Plugin::initGui()
|
void QgsCopyrightLabelPlugin::initGui()
|
||||||
{
|
{
|
||||||
// add a menu with 2 items
|
// add a menu with 2 items
|
||||||
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
|
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
|
||||||
@ -112,7 +113,7 @@ void Plugin::initGui()
|
|||||||
projectRead();
|
projectRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::projectRead()
|
void QgsCopyrightLabelPlugin::projectRead()
|
||||||
{
|
{
|
||||||
#ifdef QGISDEBUG
|
#ifdef QGISDEBUG
|
||||||
std::cout << "+++++++++ Copyright plugin - project read slot called...." << std::endl;
|
std::cout << "+++++++++ Copyright plugin - project read slot called...." << std::endl;
|
||||||
@ -128,13 +129,13 @@ void Plugin::projectRead()
|
|||||||
mLabelQColor = QColor(Qt::black);
|
mLabelQColor = QColor(Qt::black);
|
||||||
}
|
}
|
||||||
//method defined in interface
|
//method defined in interface
|
||||||
void Plugin::help()
|
void QgsCopyrightLabelPlugin::help()
|
||||||
{
|
{
|
||||||
//implement me!
|
//implement me!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slot called when the buffer menu item is activated
|
// Slot called when the buffer menu item is activated
|
||||||
void Plugin::run()
|
void QgsCopyrightLabelPlugin::run()
|
||||||
{
|
{
|
||||||
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"Copyright Label",true,0);
|
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"Copyright Label",true,0);
|
||||||
//listen for when the layer has been made so we can draw it
|
//listen for when the layer has been made so we can draw it
|
||||||
@ -152,12 +153,12 @@ void Plugin::run()
|
|||||||
myPluginGui->show();
|
myPluginGui->show();
|
||||||
}
|
}
|
||||||
//! Refresh the map display using the mapcanvas exported via the plugin interface
|
//! Refresh the map display using the mapcanvas exported via the plugin interface
|
||||||
void Plugin::refreshCanvas()
|
void QgsCopyrightLabelPlugin::refreshCanvas()
|
||||||
{
|
{
|
||||||
qGisInterface->getMapCanvas()->refresh();
|
qGisInterface->getMapCanvas()->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::renderLabel(QPainter * theQPainter)
|
void QgsCopyrightLabelPlugin::renderLabel(QPainter * theQPainter)
|
||||||
{
|
{
|
||||||
//Large IF statement to enable/disable copyright label
|
//Large IF statement to enable/disable copyright label
|
||||||
if (mEnable)
|
if (mEnable)
|
||||||
@ -213,7 +214,7 @@ void Plugin::renderLabel(QPainter * theQPainter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Unload the plugin by cleaning up the GUI
|
// Unload the plugin by cleaning up the GUI
|
||||||
void Plugin::unload()
|
void QgsCopyrightLabelPlugin::unload()
|
||||||
{
|
{
|
||||||
// remove the GUI
|
// remove the GUI
|
||||||
menuBarPointer->removeItem(menuIdInt);
|
menuBarPointer->removeItem(menuIdInt);
|
||||||
@ -223,7 +224,7 @@ void Plugin::unload()
|
|||||||
|
|
||||||
|
|
||||||
//! change the copyright font
|
//! change the copyright font
|
||||||
void Plugin::setFont(QFont theQFont)
|
void QgsCopyrightLabelPlugin::setFont(QFont theQFont)
|
||||||
{
|
{
|
||||||
mQFont = theQFont;
|
mQFont = theQFont;
|
||||||
//save state to the project file.....
|
//save state to the project file.....
|
||||||
@ -233,14 +234,14 @@ void Plugin::setFont(QFont theQFont)
|
|||||||
refreshCanvas();
|
refreshCanvas();
|
||||||
}
|
}
|
||||||
//! change the copyright text
|
//! change the copyright text
|
||||||
void Plugin::setLabel(QString theLabelQString)
|
void QgsCopyrightLabelPlugin::setLabel(QString theLabelQString)
|
||||||
{
|
{
|
||||||
mLabelQString = theLabelQString;
|
mLabelQString = theLabelQString;
|
||||||
QgsProject::instance()->writeEntry("CopyrightLabel","/Label", mLabelQString );
|
QgsProject::instance()->writeEntry("CopyrightLabel","/Label", mLabelQString );
|
||||||
refreshCanvas();
|
refreshCanvas();
|
||||||
}
|
}
|
||||||
//! change the copyright text colour
|
//! change the copyright text colour
|
||||||
void Plugin::setColor(QColor theQColor)
|
void QgsCopyrightLabelPlugin::setColor(QColor theQColor)
|
||||||
{
|
{
|
||||||
mLabelQColor = theQColor;
|
mLabelQColor = theQColor;
|
||||||
QgsProject::instance()->writeEntry("CopyrightLabel","/ColorRedPart", mLabelQColor.red());
|
QgsProject::instance()->writeEntry("CopyrightLabel","/ColorRedPart", mLabelQColor.red());
|
||||||
@ -250,7 +251,7 @@ void Plugin::setColor(QColor theQColor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! set placement of copyright label
|
//! set placement of copyright label
|
||||||
void Plugin::setPlacement(QString theQString)
|
void QgsCopyrightLabelPlugin::setPlacement(QString theQString)
|
||||||
{
|
{
|
||||||
mPlacement = theQString;
|
mPlacement = theQString;
|
||||||
QgsProject::instance()->writeEntry("CopyrightLabel","/Placement", mPlacement);
|
QgsProject::instance()->writeEntry("CopyrightLabel","/Placement", mPlacement);
|
||||||
@ -258,7 +259,7 @@ void Plugin::setPlacement(QString theQString)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! set whether copyright label is enabled
|
//! set whether copyright label is enabled
|
||||||
void Plugin::setEnable(bool theBool)
|
void QgsCopyrightLabelPlugin::setEnable(bool theBool)
|
||||||
{
|
{
|
||||||
mEnable = theBool;
|
mEnable = theBool;
|
||||||
QgsProject::instance()->writeEntry("CopyrightLabel","/Enabled", mEnable );
|
QgsProject::instance()->writeEntry("CopyrightLabel","/Enabled", mEnable );
|
||||||
@ -277,7 +278,7 @@ void Plugin::setEnable(bool theBool)
|
|||||||
// Class factory to return a new instance of the plugin class
|
// Class factory to return a new instance of the plugin class
|
||||||
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
||||||
{
|
{
|
||||||
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
|
return new QgsCopyrightLabelPlugin(theQGisAppPointer, theQgisInterfacePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the name of the plugin - note that we do not user class members as
|
// Return the name of the plugin - note that we do not user class members as
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
#ifndef PLUGIN
|
#ifndef QGSCOPYRIGHTLABELPLUGIN
|
||||||
#define PLUGIN
|
#define QGSCOPYRIGHTLABELPLUGIN
|
||||||
#include "../qgisplugin.h"
|
#include "../qgisplugin.h"
|
||||||
#include "../../src/qgisapp.h"
|
#include "../../src/qgisapp.h"
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
@ -31,7 +31,7 @@
|
|||||||
* \brief OpenModeller plugin for QGIS
|
* \brief OpenModeller plugin for QGIS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Plugin:public QObject, public QgisPlugin
|
class QgsCopyrightLabelPlugin:public QObject, public QgisPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT public:
|
Q_OBJECT public:
|
||||||
/**
|
/**
|
||||||
@ -40,9 +40,9 @@ class Plugin:public QObject, public QgisPlugin
|
|||||||
* @param qgis Pointer to the QgisApp object
|
* @param qgis Pointer to the QgisApp object
|
||||||
* @param qI Pointer to the QgisIface object.
|
* @param qI Pointer to the QgisIface object.
|
||||||
*/
|
*/
|
||||||
Plugin(QgisApp * , QgisIface * );
|
QgsCopyrightLabelPlugin(QgisApp * , QgisIface * );
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~ Plugin();
|
virtual ~ QgsCopyrightLabelPlugin();
|
||||||
void writeEntry(QString theScope, QString theProperty, QVariant theValue);
|
void writeEntry(QString theScope, QString theProperty, QVariant theValue);
|
||||||
public slots:
|
public slots:
|
||||||
//! init the gui
|
//! init the gui
|
||||||
|
@ -64,37 +64,38 @@ static const QgisPlugin::PLUGINTYPE type_ = QgisPlugin::UI;
|
|||||||
* @param qgis Pointer to the QGIS main window
|
* @param qgis Pointer to the QGIS main window
|
||||||
* @param _qI Pointer to the QGIS interface object
|
* @param _qI Pointer to the QGIS interface object
|
||||||
*/
|
*/
|
||||||
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
|
QgsGridMakerPlugin::QgsGridMakerPlugin(QgisApp * theQGisApp,
|
||||||
|
QgisIface * theQgisInterFace):
|
||||||
qgisMainWindowPointer(theQGisApp),
|
qgisMainWindowPointer(theQGisApp),
|
||||||
qGisInterface(theQgisInterFace),
|
qGisInterface(theQgisInterFace),
|
||||||
QgisPlugin(name_,description_,version_,type_)
|
QgisPlugin(name_,description_,version_,type_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin::~Plugin()
|
QgsGridMakerPlugin::~QgsGridMakerPlugin()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Following functions return name, description, version, and type for the plugin */
|
/* Following functions return name, description, version, and type for the plugin */
|
||||||
QString Plugin::name()
|
QString QgsGridMakerPlugin::name()
|
||||||
{
|
{
|
||||||
return pluginNameQString;
|
return pluginNameQString;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Plugin::version()
|
QString QgsGridMakerPlugin::version()
|
||||||
{
|
{
|
||||||
return pluginVersionQString;
|
return pluginVersionQString;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Plugin::description()
|
QString QgsGridMakerPlugin::description()
|
||||||
{
|
{
|
||||||
return pluginDescriptionQString;
|
return pluginDescriptionQString;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Plugin::type()
|
int QgsGridMakerPlugin::type()
|
||||||
{
|
{
|
||||||
return QgisPlugin::UI;
|
return QgisPlugin::UI;
|
||||||
}
|
}
|
||||||
@ -102,7 +103,7 @@ int Plugin::type()
|
|||||||
/*
|
/*
|
||||||
* Initialize the GUI interface for the plugin
|
* Initialize the GUI interface for the plugin
|
||||||
*/
|
*/
|
||||||
void Plugin::initGui()
|
void QgsGridMakerPlugin::initGui()
|
||||||
{
|
{
|
||||||
// add a menu with 2 items
|
// add a menu with 2 items
|
||||||
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
|
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
|
||||||
@ -123,13 +124,13 @@ void Plugin::initGui()
|
|||||||
|
|
||||||
}
|
}
|
||||||
//method defined in interface
|
//method defined in interface
|
||||||
void Plugin::help()
|
void QgsGridMakerPlugin::help()
|
||||||
{
|
{
|
||||||
//implement me!
|
//implement me!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slot called when the buffer menu item is activated
|
// Slot called when the buffer menu item is activated
|
||||||
void Plugin::run()
|
void QgsGridMakerPlugin::run()
|
||||||
{
|
{
|
||||||
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"Graticule Builder",true,0);
|
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"Graticule Builder",true,0);
|
||||||
//listen for when the layer has been made so we can draw it
|
//listen for when the layer has been made so we can draw it
|
||||||
@ -139,19 +140,19 @@ void Plugin::run()
|
|||||||
}
|
}
|
||||||
//!draw a raster layer in the qui - intended to respond to signal sent by diolog when it as finished creating
|
//!draw a raster layer in the qui - intended to respond to signal sent by diolog when it as finished creating
|
||||||
//layer
|
//layer
|
||||||
void Plugin::drawRasterLayer(QString theQString)
|
void QgsGridMakerPlugin::drawRasterLayer(QString theQString)
|
||||||
{
|
{
|
||||||
qGisInterface->addRasterLayer(theQString);
|
qGisInterface->addRasterLayer(theQString);
|
||||||
}
|
}
|
||||||
//!draw a vector layer in the qui - intended to respond to signal sent by diolog when it as finished creating a layer
|
//!draw a vector layer in the qui - intended to respond to signal sent by diolog when it as finished creating a layer
|
||||||
////needs to be given vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
|
////needs to be given vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
|
||||||
void Plugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
|
void QgsGridMakerPlugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
|
||||||
{
|
{
|
||||||
qGisInterface->addVectorLayer( thePathNameQString, theBaseNameQString, theProviderQString);
|
qGisInterface->addVectorLayer( thePathNameQString, theBaseNameQString, theProviderQString);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unload the plugin by cleaning up the GUI
|
// Unload the plugin by cleaning up the GUI
|
||||||
void Plugin::unload()
|
void QgsGridMakerPlugin::unload()
|
||||||
{
|
{
|
||||||
// remove the GUI
|
// remove the GUI
|
||||||
menuBarPointer->removeItem(menuIdInt);
|
menuBarPointer->removeItem(menuIdInt);
|
||||||
@ -166,7 +167,7 @@ void Plugin::unload()
|
|||||||
// Class factory to return a new instance of the plugin class
|
// Class factory to return a new instance of the plugin class
|
||||||
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
||||||
{
|
{
|
||||||
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
|
return new QgsGridMakerPlugin(theQGisAppPointer, theQgisInterfacePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the name of the plugin - note that we do not user class members as
|
// Return the name of the plugin - note that we do not user class members as
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
#ifndef PLUGIN
|
#ifndef QGSGRIDMAKERPLUGIN
|
||||||
#define PLUGIN
|
#define QGSGRIDMAKERPLUGIN
|
||||||
#include "../qgisplugin.h"
|
#include "../qgisplugin.h"
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
#include <qgisapp.h>
|
#include <qgisapp.h>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
* \brief OpenModeller plugin for QGIS
|
* \brief OpenModeller plugin for QGIS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Plugin:public QObject, public QgisPlugin
|
class QgsGridMakerPlugin:public QObject, public QgisPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT public:
|
Q_OBJECT public:
|
||||||
/**
|
/**
|
||||||
@ -37,7 +37,7 @@ class Plugin:public QObject, public QgisPlugin
|
|||||||
* @param qgis Pointer to the QgisApp object
|
* @param qgis Pointer to the QgisApp object
|
||||||
* @param qI Pointer to the QgisIface object.
|
* @param qI Pointer to the QgisIface object.
|
||||||
*/
|
*/
|
||||||
Plugin(QgisApp * , QgisIface * );
|
QgsGridMakerPlugin(QgisApp * , QgisIface * );
|
||||||
/**
|
/**
|
||||||
* Virtual function to return the name of the plugin. The name will be used when presenting a list
|
* Virtual function to return the name of the plugin. The name will be used when presenting a list
|
||||||
* of installable plugins to the user
|
* of installable plugins to the user
|
||||||
@ -56,7 +56,7 @@ class Plugin:public QObject, public QgisPlugin
|
|||||||
*/
|
*/
|
||||||
virtual int type();
|
virtual int type();
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~ Plugin();
|
virtual ~ QgsGridMakerPlugin();
|
||||||
public slots:
|
public slots:
|
||||||
//! init the gui
|
//! init the gui
|
||||||
virtual void initGui();
|
virtual void initGui();
|
||||||
|
@ -74,7 +74,7 @@ static const QgisPlugin::PLUGINTYPE type_ = QgisPlugin::UI;
|
|||||||
* @param qgis Pointer to the QGIS main window
|
* @param qgis Pointer to the QGIS main window
|
||||||
* @param _qI Pointer to the QGIS interface object
|
* @param _qI Pointer to the QGIS interface object
|
||||||
*/
|
*/
|
||||||
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
|
QgsNorthArrowPlugin::QgsNorthArrowPlugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
|
||||||
qgisMainWindowPointer(theQGisApp),
|
qgisMainWindowPointer(theQGisApp),
|
||||||
qGisInterface(theQgisInterFace),
|
qGisInterface(theQgisInterFace),
|
||||||
QgisPlugin(name_,description_,version_,type_)
|
QgisPlugin(name_,description_,version_,type_)
|
||||||
@ -83,14 +83,14 @@ Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
|
|||||||
mPlacement=tr("Bottom Left");
|
mPlacement=tr("Bottom Left");
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin::~Plugin()
|
QgsNorthArrowPlugin::~QgsNorthArrowPlugin()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the GUI interface for the plugin
|
* Initialize the GUI interface for the plugin
|
||||||
*/
|
*/
|
||||||
void Plugin::initGui()
|
void QgsNorthArrowPlugin::initGui()
|
||||||
{
|
{
|
||||||
// add a menu with 2 items
|
// add a menu with 2 items
|
||||||
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
|
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
|
||||||
@ -116,7 +116,7 @@ void Plugin::initGui()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::projectRead()
|
void QgsNorthArrowPlugin::projectRead()
|
||||||
{
|
{
|
||||||
#ifdef QGISDEBUG
|
#ifdef QGISDEBUG
|
||||||
std::cout << "+++++++++ north arrow plugin - project read slot called...." << std::endl;
|
std::cout << "+++++++++ north arrow plugin - project read slot called...." << std::endl;
|
||||||
@ -129,13 +129,13 @@ void Plugin::projectRead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//method defined in interface
|
//method defined in interface
|
||||||
void Plugin::help()
|
void QgsNorthArrowPlugin::help()
|
||||||
{
|
{
|
||||||
//implement me!
|
//implement me!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slot called when the buffer menu item is activated
|
// Slot called when the buffer menu item is activated
|
||||||
void Plugin::run()
|
void QgsNorthArrowPlugin::run()
|
||||||
{
|
{
|
||||||
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"North Arrow",true,0);
|
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"North Arrow",true,0);
|
||||||
//overides function byt the same name created in .ui
|
//overides function byt the same name created in .ui
|
||||||
@ -151,12 +151,12 @@ void Plugin::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Refresh the map display using the mapcanvas exported via the plugin interface
|
//! Refresh the map display using the mapcanvas exported via the plugin interface
|
||||||
void Plugin::refreshCanvas()
|
void QgsNorthArrowPlugin::refreshCanvas()
|
||||||
{
|
{
|
||||||
qGisInterface->getMapCanvas()->refresh();
|
qGisInterface->getMapCanvas()->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::renderNorthArrow(QPainter * theQPainter)
|
void QgsNorthArrowPlugin::renderNorthArrow(QPainter * theQPainter)
|
||||||
{
|
{
|
||||||
#ifdef QGISDEBUG
|
#ifdef QGISDEBUG
|
||||||
std::cout << "Rendering n-arrow" << std::endl;
|
std::cout << "Rendering n-arrow" << std::endl;
|
||||||
@ -243,7 +243,7 @@ void Plugin::renderNorthArrow(QPainter * theQPainter)
|
|||||||
|
|
||||||
}
|
}
|
||||||
// Unload the plugin by cleaning up the GUI
|
// Unload the plugin by cleaning up the GUI
|
||||||
void Plugin::unload()
|
void QgsNorthArrowPlugin::unload()
|
||||||
{
|
{
|
||||||
// remove the GUI
|
// remove the GUI
|
||||||
menuBarPointer->removeItem(menuIdInt);
|
menuBarPointer->removeItem(menuIdInt);
|
||||||
@ -252,7 +252,7 @@ void Plugin::unload()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Plugin::rotationChanged(int theInt)
|
void QgsNorthArrowPlugin::rotationChanged(int theInt)
|
||||||
{
|
{
|
||||||
mRotationInt = theInt;
|
mRotationInt = theInt;
|
||||||
QgsProject::instance()->writeEntry("NorthArrow","/Rotation", mRotationInt );
|
QgsProject::instance()->writeEntry("NorthArrow","/Rotation", mRotationInt );
|
||||||
@ -260,14 +260,14 @@ void Plugin::rotationChanged(int theInt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! set placement of north arrow
|
//! set placement of north arrow
|
||||||
void Plugin::setPlacement(QString theQString)
|
void QgsNorthArrowPlugin::setPlacement(QString theQString)
|
||||||
{
|
{
|
||||||
mPlacement = theQString;
|
mPlacement = theQString;
|
||||||
QgsProject::instance()->writeEntry("NorthArrow","/Placement", mPlacement);
|
QgsProject::instance()->writeEntry("NorthArrow","/Placement", mPlacement);
|
||||||
refreshCanvas();
|
refreshCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::setEnabled(bool theBool)
|
void QgsNorthArrowPlugin::setEnabled(bool theBool)
|
||||||
{
|
{
|
||||||
mEnable = theBool;
|
mEnable = theBool;
|
||||||
QgsProject::instance()->writeEntry("NorthArrow","/Enabled", mEnable );
|
QgsProject::instance()->writeEntry("NorthArrow","/Enabled", mEnable );
|
||||||
@ -287,7 +287,7 @@ void Plugin::setEnabled(bool theBool)
|
|||||||
// Class factory to return a new instance of the plugin class
|
// Class factory to return a new instance of the plugin class
|
||||||
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
||||||
{
|
{
|
||||||
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
|
return new QgsNorthArrowPlugin(theQGisAppPointer, theQgisInterfacePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the name of the plugin - note that we do not user class members as
|
// Return the name of the plugin - note that we do not user class members as
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
#ifndef PLUGIN
|
#ifndef QGSNORTHARROWPLUGIN
|
||||||
#define PLUGIN
|
#define QGSNORTHARROWPLUGIN
|
||||||
#include "../qgisplugin.h"
|
#include "../qgisplugin.h"
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
#include <qpainter.h>
|
#include <qpainter.h>
|
||||||
@ -31,7 +31,7 @@
|
|||||||
* \brief North Arrow plugin for QGIS
|
* \brief North Arrow plugin for QGIS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Plugin:public QObject, public QgisPlugin
|
class QgsNorthArrowPlugin:public QObject, public QgisPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT public:
|
Q_OBJECT public:
|
||||||
/**
|
/**
|
||||||
@ -40,9 +40,9 @@ class Plugin:public QObject, public QgisPlugin
|
|||||||
* @param qgis Pointer to the QgisApp object
|
* @param qgis Pointer to the QgisApp object
|
||||||
* @param qI Pointer to the QgisIface object.
|
* @param qI Pointer to the QgisIface object.
|
||||||
*/
|
*/
|
||||||
Plugin(QgisApp * , QgisIface * );
|
QgsNorthArrowPlugin(QgisApp * , QgisIface * );
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~ Plugin();
|
virtual ~QgsNorthArrowPlugin();
|
||||||
public slots:
|
public slots:
|
||||||
//! init the gui
|
//! init the gui
|
||||||
virtual void initGui();
|
virtual void initGui();
|
||||||
|
@ -69,14 +69,15 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
|
|||||||
* @param theQGisApp - Pointer to the QGIS main window
|
* @param theQGisApp - Pointer to the QGIS main window
|
||||||
* @param theQGisInterface - Pointer to the QGIS interface object
|
* @param theQGisInterface - Pointer to the QGIS interface object
|
||||||
*/
|
*/
|
||||||
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterface):
|
[pluginname]::[pluginname](QgisApp * theQGisApp,
|
||||||
|
QgisIface * theQgisInterface):
|
||||||
mQGisApp(theQGisApp),
|
mQGisApp(theQGisApp),
|
||||||
mQGisIface(theQgisInterface),
|
mQGisIface(theQgisInterface),
|
||||||
QgisPlugin(sName,sDescription,sPluginVersion,sPluginType)
|
QgisPlugin(sName,sDescription,sPluginVersion,sPluginType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin::~Plugin()
|
[pluginname]::~[pluginname]()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -84,7 +85,7 @@ Plugin::~Plugin()
|
|||||||
/*
|
/*
|
||||||
* Initialize the GUI interface for the plugin
|
* Initialize the GUI interface for the plugin
|
||||||
*/
|
*/
|
||||||
void Plugin::initGui()
|
void [pluginname]::initGui()
|
||||||
{
|
{
|
||||||
QPopupMenu *pluginMenu = new QPopupMenu(mQGisApp);
|
QPopupMenu *pluginMenu = new QPopupMenu(mQGisApp);
|
||||||
pluginMenu->insertItem(QIconSet(icon),"&[menuitemname]", this, SLOT(run()));
|
pluginMenu->insertItem(QIconSet(icon),"&[menuitemname]", this, SLOT(run()));
|
||||||
@ -102,13 +103,13 @@ void Plugin::initGui()
|
|||||||
|
|
||||||
}
|
}
|
||||||
//method defined in interface
|
//method defined in interface
|
||||||
void Plugin::help()
|
void [pluginname]::help()
|
||||||
{
|
{
|
||||||
//implement me!
|
//implement me!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slot called when the buffer menu item is activated
|
// Slot called when the buffer menu item is activated
|
||||||
void Plugin::run()
|
void [pluginname]::run()
|
||||||
{
|
{
|
||||||
PluginGui *myPluginGui=new PluginGui(mQGisApp,"[menuitemname]",true,0);
|
PluginGui *myPluginGui=new PluginGui(mQGisApp,"[menuitemname]",true,0);
|
||||||
//listen for when the layer has been made so we can draw it
|
//listen for when the layer has been made so we can draw it
|
||||||
@ -118,7 +119,7 @@ void Plugin::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unload the plugin by cleaning up the GUI
|
// Unload the plugin by cleaning up the GUI
|
||||||
void Plugin::unload()
|
void [pluginname]::unload()
|
||||||
{
|
{
|
||||||
// remove the GUI
|
// remove the GUI
|
||||||
mMenuBarPointer->removeItem(mMenuId);
|
mMenuBarPointer->removeItem(mMenuId);
|
||||||
@ -140,7 +141,7 @@ void Plugin::unload()
|
|||||||
|
|
||||||
//!draw a raster layer in the qui - intended to respond to signal sent by diolog when it as finished creating
|
//!draw a raster layer in the qui - intended to respond to signal sent by diolog when it as finished creating
|
||||||
//layer
|
//layer
|
||||||
void Plugin::drawRasterLayer(QString theQString)
|
void [pluginname]::drawRasterLayer(QString theQString)
|
||||||
{
|
{
|
||||||
mQGisIface->addRasterLayer(theQString);
|
mQGisIface->addRasterLayer(theQString);
|
||||||
}
|
}
|
||||||
@ -148,7 +149,7 @@ void Plugin::drawRasterLayer(QString theQString)
|
|||||||
//!draw a vector layer in the qui - intended to respond to signal sent by
|
//!draw a vector layer in the qui - intended to respond to signal sent by
|
||||||
// dialog when it as finished creating a layer. It needs to be given
|
// dialog when it as finished creating a layer. It needs to be given
|
||||||
// vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
|
// vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
|
||||||
void Plugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
|
void [pluginname]::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
|
||||||
{
|
{
|
||||||
mQGisIface->addVectorLayer( thePathNameQString, theBaseNameQString, theProviderQString);
|
mQGisIface->addVectorLayer( thePathNameQString, theBaseNameQString, theProviderQString);
|
||||||
}
|
}
|
||||||
@ -173,7 +174,7 @@ void Plugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQStr
|
|||||||
// Class factory to return a new instance of the plugin class
|
// Class factory to return a new instance of the plugin class
|
||||||
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
||||||
{
|
{
|
||||||
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
|
return new [pluginname](theQGisAppPointer, theQgisInterfacePointer);
|
||||||
}
|
}
|
||||||
// Return the name of the plugin - note that we do not user class members as
|
// Return the name of the plugin - note that we do not user class members as
|
||||||
// the class may not yet be insantiated when this method is called.
|
// the class may not yet be insantiated when this method is called.
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
* DON'T: separate variable names using underscores: my_variable_name (NO!)
|
* DON'T: separate variable names using underscores: my_variable_name (NO!)
|
||||||
*
|
*
|
||||||
* **************************************************************************/
|
* **************************************************************************/
|
||||||
#ifndef PLUGIN
|
#ifndef [pluginname]
|
||||||
#define PLUGIN
|
#define [pluginname]
|
||||||
#include "../qgisplugin.h"
|
#include "../qgisplugin.h"
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
|
|
||||||
@ -47,7 +47,7 @@
|
|||||||
* \brief [name] plugin for QGIS
|
* \brief [name] plugin for QGIS
|
||||||
* [description]
|
* [description]
|
||||||
*/
|
*/
|
||||||
class Plugin:public QObject, public QgisPlugin
|
class [pluginname]:public QObject, public QgisPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT public:
|
Q_OBJECT public:
|
||||||
|
|
||||||
@ -63,9 +63,9 @@ class Plugin:public QObject, public QgisPlugin
|
|||||||
* @param Pointer to the QgisApp object
|
* @param Pointer to the QgisApp object
|
||||||
* @param Pointer to the QgisIface object.
|
* @param Pointer to the QgisIface object.
|
||||||
*/
|
*/
|
||||||
Plugin(QgisApp * , QgisIface * );
|
[pluginname](QgisApp * , QgisIface * );
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~ Plugin();
|
virtual ~ [pluginname]();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! init the gui
|
//! init the gui
|
||||||
|
@ -49,7 +49,7 @@ class QgisPlugin
|
|||||||
*/
|
*/
|
||||||
typedef enum PLUGINTYPE
|
typedef enum PLUGINTYPE
|
||||||
{
|
{
|
||||||
UI, /* user interface plug-in */
|
UI = 1, /* user interface plug-in */
|
||||||
MAPLAYER /* map layer plug-in */
|
MAPLAYER /* map layer plug-in */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ static const QgisPlugin::PLUGINTYPE type_ = QgisPlugin::UI;
|
|||||||
* @param qgis Pointer to the QGIS main window
|
* @param qgis Pointer to the QGIS main window
|
||||||
* @param _qI Pointer to the QGIS interface object
|
* @param _qI Pointer to the QGIS interface object
|
||||||
*/
|
*/
|
||||||
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
|
QgsScaleBarPlugin::QgsScaleBarPlugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
|
||||||
qgisMainWindowPointer(theQGisApp),
|
qgisMainWindowPointer(theQGisApp),
|
||||||
qGisInterface(theQgisInterFace),
|
qGisInterface(theQgisInterFace),
|
||||||
QgisPlugin(name_,description_,version_,type_)
|
QgisPlugin(name_,description_,version_,type_)
|
||||||
@ -93,7 +93,7 @@ QgisPlugin(name_,description_,version_,type_)
|
|||||||
mSnapping = true;
|
mSnapping = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin::~Plugin()
|
QgsScaleBarPlugin::~QgsScaleBarPlugin()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ Plugin::~Plugin()
|
|||||||
/*
|
/*
|
||||||
* Initialize the GUI interface for the plugin
|
* Initialize the GUI interface for the plugin
|
||||||
*/
|
*/
|
||||||
void Plugin::initGui()
|
void QgsScaleBarPlugin::initGui()
|
||||||
{
|
{
|
||||||
// add a menu with 2 items
|
// add a menu with 2 items
|
||||||
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
|
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
|
||||||
@ -124,7 +124,7 @@ void Plugin::initGui()
|
|||||||
qGisInterface->addToolBarIcon(myQActionPointer);
|
qGisInterface->addToolBarIcon(myQActionPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::projectRead()
|
void QgsScaleBarPlugin::projectRead()
|
||||||
{
|
{
|
||||||
#ifdef QGISDEBUG
|
#ifdef QGISDEBUG
|
||||||
std::cout << "+++++++++ scalebar plugin - project read slot called...." << std::endl;
|
std::cout << "+++++++++ scalebar plugin - project read slot called...." << std::endl;
|
||||||
@ -142,13 +142,13 @@ void Plugin::projectRead()
|
|||||||
mColour = QColor(myRedInt,myGreenInt,myBlueInt);
|
mColour = QColor(myRedInt,myGreenInt,myBlueInt);
|
||||||
}
|
}
|
||||||
//method defined in interface
|
//method defined in interface
|
||||||
void Plugin::help()
|
void QgsScaleBarPlugin::help()
|
||||||
{
|
{
|
||||||
//implement me!
|
//implement me!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slot called when the menu item is activated
|
// Slot called when the menu item is activated
|
||||||
void Plugin::run()
|
void QgsScaleBarPlugin::run()
|
||||||
{
|
{
|
||||||
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"Scale Bar",true,0);
|
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"Scale Bar",true,0);
|
||||||
myPluginGui->setPreferredSize(mPreferredSize);
|
myPluginGui->setPreferredSize(mPreferredSize);
|
||||||
@ -178,7 +178,7 @@ void Plugin::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Plugin::refreshCanvas()
|
void QgsScaleBarPlugin::refreshCanvas()
|
||||||
{
|
{
|
||||||
qGisInterface->getMapCanvas()->refresh();
|
qGisInterface->getMapCanvas()->refresh();
|
||||||
}
|
}
|
||||||
@ -186,7 +186,7 @@ void Plugin::refreshCanvas()
|
|||||||
|
|
||||||
|
|
||||||
// Actual drawing of Scale Bar
|
// Actual drawing of Scale Bar
|
||||||
void Plugin::renderScaleBar(QPainter * theQPainter)
|
void QgsScaleBarPlugin::renderScaleBar(QPainter * theQPainter)
|
||||||
{
|
{
|
||||||
int myBufferSize=1; //softcode this later
|
int myBufferSize=1; //softcode this later
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ void Plugin::renderScaleBar(QPainter * theQPainter)
|
|||||||
|
|
||||||
|
|
||||||
// Unload the plugin by cleaning up the GUI
|
// Unload the plugin by cleaning up the GUI
|
||||||
void Plugin::unload()
|
void QgsScaleBarPlugin::unload()
|
||||||
{
|
{
|
||||||
// remove the GUI
|
// remove the GUI
|
||||||
menuBarPointer->removeItem(menuIdInt);
|
menuBarPointer->removeItem(menuIdInt);
|
||||||
@ -492,40 +492,40 @@ void Plugin::unload()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! set placement of scale bar
|
//! set placement of scale bar
|
||||||
void Plugin::setPlacement(QString theQString)
|
void QgsScaleBarPlugin::setPlacement(QString theQString)
|
||||||
{
|
{
|
||||||
mPlacement = theQString;
|
mPlacement = theQString;
|
||||||
QgsProject::instance()->writeEntry("ScaleBar","/Placement",mPlacement);
|
QgsProject::instance()->writeEntry("ScaleBar","/Placement",mPlacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! set preferred size of scale bar
|
//! set preferred size of scale bar
|
||||||
void Plugin::setPreferredSize(int thePreferredSize)
|
void QgsScaleBarPlugin::setPreferredSize(int thePreferredSize)
|
||||||
{
|
{
|
||||||
mPreferredSize = thePreferredSize;
|
mPreferredSize = thePreferredSize;
|
||||||
QgsProject::instance()->writeEntry("ScaleBar","/PreferredSize",mPreferredSize);
|
QgsProject::instance()->writeEntry("ScaleBar","/PreferredSize",mPreferredSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! set whether the scale bar length should snap to the closes A*10^B
|
//! set whether the scale bar length should snap to the closes A*10^B
|
||||||
void Plugin::setSnapping(bool theSnapping)
|
void QgsScaleBarPlugin::setSnapping(bool theSnapping)
|
||||||
{
|
{
|
||||||
mSnapping = theSnapping;
|
mSnapping = theSnapping;
|
||||||
QgsProject::instance()->writeEntry("ScaleBar","/Snapping",mSnapping);
|
QgsProject::instance()->writeEntry("ScaleBar","/Snapping",mSnapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! set scale bar enable
|
//! set scale bar enable
|
||||||
void Plugin::setEnabled(bool theBool)
|
void QgsScaleBarPlugin::setEnabled(bool theBool)
|
||||||
{
|
{
|
||||||
mEnabled = theBool;
|
mEnabled = theBool;
|
||||||
QgsProject::instance()->writeEntry("ScaleBar","/Enabled",mEnabled);
|
QgsProject::instance()->writeEntry("ScaleBar","/Enabled",mEnabled);
|
||||||
}
|
}
|
||||||
//! set scale bar enable
|
//! set scale bar enable
|
||||||
void Plugin::setStyle(QString theStyleQString)
|
void QgsScaleBarPlugin::setStyle(QString theStyleQString)
|
||||||
{
|
{
|
||||||
mStyle = theStyleQString;
|
mStyle = theStyleQString;
|
||||||
QgsProject::instance()->writeEntry("ScaleBar","/Style",mStyle);
|
QgsProject::instance()->writeEntry("ScaleBar","/Style",mStyle);
|
||||||
}
|
}
|
||||||
//! set the scale bar colour
|
//! set the scale bar colour
|
||||||
void Plugin::setColour(QColor theQColor)
|
void QgsScaleBarPlugin::setColour(QColor theQColor)
|
||||||
{
|
{
|
||||||
mColour = theQColor;
|
mColour = theQColor;
|
||||||
QgsProject::instance()->writeEntry("ScaleBar","/ColorRedPart", mColour.red());
|
QgsProject::instance()->writeEntry("ScaleBar","/ColorRedPart", mColour.red());
|
||||||
@ -542,7 +542,7 @@ void Plugin::setColour(QColor theQColor)
|
|||||||
// Class factory to return a new instance of the plugin class
|
// Class factory to return a new instance of the plugin class
|
||||||
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
|
||||||
{
|
{
|
||||||
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
|
return new QgsScaleBarPlugin(theQGisAppPointer, theQgisInterfacePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the name of the plugin - note that we do not user class members as
|
// Return the name of the plugin - note that we do not user class members as
|
||||||
|
@ -19,8 +19,8 @@ email : sbr00pwb@users.sourceforge.net
|
|||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
#ifndef PLUGIN
|
#ifndef QGSCALEBARPLUGIN
|
||||||
#define PLUGIN
|
#define QGSCALEBARPLUGIN
|
||||||
#include "../qgisplugin.h"
|
#include "../qgisplugin.h"
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
#include <qpainter.h>
|
#include <qpainter.h>
|
||||||
@ -34,7 +34,7 @@ email : sbr00pwb@users.sourceforge.net
|
|||||||
* \brief OpenModeller plugin for QGIS
|
* \brief OpenModeller plugin for QGIS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Plugin:public QObject, public QgisPlugin
|
class QgsScaleBarPlugin:public QObject, public QgisPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT public:
|
Q_OBJECT public:
|
||||||
/**
|
/**
|
||||||
@ -43,12 +43,12 @@ class Plugin:public QObject, public QgisPlugin
|
|||||||
* @param qgis Pointer to the QgisApp object
|
* @param qgis Pointer to the QgisApp object
|
||||||
* @param qI Pointer to the QgisIface object.
|
* @param qI Pointer to the QgisIface object.
|
||||||
*/
|
*/
|
||||||
Plugin(QgisApp * , QgisIface * );
|
QgsScaleBarPlugin(QgisApp * , QgisIface * );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~ Plugin();
|
virtual ~ QgsScaleBarPlugin();
|
||||||
public slots:
|
public slots:
|
||||||
//! init the gui
|
//! init the gui
|
||||||
virtual void initGui();
|
virtual void initGui();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user