1
/***************************************************************************
2
oracleplugin.cpp Access Oracle Spatial Plugin
4
begin : Oracle Spatial Plugin
5
copyright : (C) Ivan Lucena
6
email : ivan.lucena@pmldnet.com
7
***************************************************************************
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
14
***************************************************************************/
17
#include "qgsoracle_plugin.h"
18
#include "qgsselectgeoraster_ui.h"
20
static const char * const sIdent = "$Id: oracleplugin.cpp $";
21
static const QString sName = QObject::tr( "Oracle Spatial GeoRaster" );
22
static const QString sDescription = QObject::tr( "Access Oracle Spatial GeoRaster" );
23
static const QString sPluginVersion = QObject::tr( "Version 0.1" );
24
static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
26
//////////////////////////////////////////////////////////////////////
28
// THE FOLLOWING METHODS ARE MANDATORY FOR ALL PLUGINS
30
//////////////////////////////////////////////////////////////////////
33
* Constructor for the plugin. The plugin is passed a pointer
34
* an interface object that provides access to exposed functions in QGIS.
35
* @param theQGisInterface - Pointer to the QGIS interface object
37
QgsOraclePlugin::QgsOraclePlugin( QgisInterface * theQgisInterface ) :
38
QgisPlugin( sName, sDescription, sPluginVersion, sPluginType ),
39
mQGisIface( theQgisInterface )
43
QgsOraclePlugin::~QgsOraclePlugin()
49
* Initialize the GUI interface for the plugin - this is only called once when the plugin is
50
* added to the plugin registry in the QGIS application.
52
void QgsOraclePlugin::initGui()
55
// Create the action for tool
56
mQActionPointer = new QAction( QIcon( ":/oracleplugin/oracleplugin.png" ), tr( "Select GeoRaster" ), this );
57
// Set the what's this text
58
mQActionPointer->setWhatsThis( tr( "Open a Oracle Spatial GeoRaster" ) );
59
// Connect the action to the run
60
connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
61
// Add the icon to the toolbar
62
mQGisIface->addToolBarIcon( mQActionPointer );
63
mQGisIface->addPluginToMenu( tr( "&Oracle Spatial" ), mQActionPointer );
66
//method defined in interface
68
void QgsOraclePlugin::help()
73
// Slot called when the menu item is triggered
74
// If you created more menu items / toolbar buttons in initiGui, you should
75
// create a separate handler for each action - this single run() method will
78
void QgsOraclePlugin::run()
80
QgsOracleSelectGeoraster *myPluginGui = new QgsOracleSelectGeoraster( mQGisIface->mainWindow(), mQGisIface, QgisGui::ModalDialogFlags );
81
myPluginGui->setAttribute( Qt::WA_DeleteOnClose );
86
// Unload the plugin by cleaning up the GUI
88
void QgsOraclePlugin::unload()
91
mQGisIface->removePluginMenu( "&Oracle Spatial", mQActionPointer );
92
mQGisIface->removeToolBarIcon( mQActionPointer );
93
delete mQActionPointer;
97
//////////////////////////////////////////////////////////////////////////
100
// THE FOLLOWING CODE IS AUTOGENERATED BY THE PLUGIN BUILDER SCRIPT
101
// YOU WOULD NORMALLY NOT NEED TO MODIFY THIS, AND YOUR PLUGIN
102
// MAY NOT WORK PROPERLY IF YOU MODIFY THIS INCORRECTLY
105
//////////////////////////////////////////////////////////////////////////
109
* Required extern functions needed for every plugin
110
* These functions can be called prior to creating an instance
111
* of the plugin class
113
// Class factory to return a new instance of the plugin class
115
QGISEXTERN QgisPlugin * classFactory( QgisInterface * theQgisInterfacePointer )
117
return new QgsOraclePlugin( theQgisInterfacePointer );
119
// Return the name of the plugin - note that we do not user class members as
120
// the class may not yet be insantiated when this method is called.
122
QGISEXTERN QString name()
127
// Return the description
129
QGISEXTERN QString description()
134
// Return the type (either UI or MapLayer plugin)
136
QGISEXTERN int type()
141
// Return the version number for the plugin
143
QGISEXTERN QString version()
145
return sPluginVersion;
150
QGISEXTERN void unload( QgisPlugin * thePluginPointer )
152
delete thePluginPointer;