-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added oracle spatial raster plugin provided by Ivan Lucena
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10566 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
mhugent
committed
Apr 15, 2009
1 parent
7a1f807
commit 2169249
Showing
12 changed files
with
1,361 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ SUBDIRS (copyright_label | |
interpolation | ||
north_arrow | ||
scale_bar | ||
oracle_raster | ||
) | ||
|
||
IF (POSTGRES_FOUND) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
######################################################## | ||
# Files | ||
|
||
SET (ORACLE_SRCS | ||
qgsoracle_plugin.cpp | ||
qgsselectgeoraster_ui.cpp | ||
qgsoracleconnect_ui.cpp | ||
) | ||
|
||
SET (ORACLE_UIS | ||
qgsselectgeorasterbase.ui | ||
qgsoracleconnectbase.ui | ||
) | ||
|
||
SET (ORACLE_MOC_HDRS | ||
qgsoracle_plugin.h | ||
qgsselectgeoraster_ui.h | ||
qgsoracleconnect_ui.h | ||
) | ||
|
||
SET (ORACLE_RCCS oracleplugin.qrc) | ||
|
||
######################################################## | ||
# Build | ||
|
||
QT4_WRAP_UI (ORACLE_UIS_H ${ORACLE_UIS}) | ||
|
||
QT4_WRAP_CPP (ORACLE_MOC_SRCS ${ORACLE_MOC_HDRS}) | ||
|
||
QT4_ADD_RESOURCES(ORACLE_RCC_SRCS ${ORACLE_RCCS}) | ||
|
||
ADD_LIBRARY (oracleplugin MODULE ${ORACLE_SRCS} ${ORACLE_MOC_SRCS} ${ORACLE_RCC_SRCS} ${ORACLE_UIS_H}) | ||
|
||
INCLUDE_DIRECTORIES( | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${GDAL_INCLUDE_DIR} | ||
../../core ../../core/raster ../../core/renderer ../../core/symbology | ||
../../gui | ||
.. | ||
) | ||
|
||
TARGET_LINK_LIBRARIES(oracleplugin | ||
qgis_core | ||
qgis_gui | ||
) | ||
|
||
|
||
######################################################## | ||
# Install | ||
|
||
INSTALL(TARGETS oracleplugin | ||
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR} | ||
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}) | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<RCC> | ||
<qresource prefix="/oracleplugin/" > | ||
<file>oracleplugin.png</file> | ||
</qresource> | ||
</RCC> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
/*************************************************************************** | ||
oracleplugin.cpp Access Oracle Spatial Plugin | ||
------------------- | ||
begin : Oracle Spatial Plugin | ||
copyright : (C) Ivan Lucena | ||
email : ivan.lucena@pmldnet.com | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id$ */ | ||
|
||
#include "qgsoracle_plugin.h" | ||
#include "qgsselectgeoraster_ui.h" | ||
|
||
static const char * const sIdent = "$Id: oracleplugin.cpp $"; | ||
static const QString sName = QObject::tr("Oracle Spatial GeoRaster"); | ||
static const QString sDescription = QObject::tr("Access Oracle Spatial GeoRaster"); | ||
static const QString sPluginVersion = QObject::tr("Version 0.1"); | ||
static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI; | ||
|
||
////////////////////////////////////////////////////////////////////// | ||
// | ||
// THE FOLLOWING METHODS ARE MANDATORY FOR ALL PLUGINS | ||
// | ||
////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* Constructor for the plugin. The plugin is passed a pointer | ||
* an interface object that provides access to exposed functions in QGIS. | ||
* @param theQGisInterface - Pointer to the QGIS interface object | ||
*/ | ||
QgsOraclePlugin::QgsOraclePlugin(QgisInterface * theQgisInterface) : | ||
QgisPlugin(sName, sDescription, sPluginVersion, sPluginType), | ||
mQGisIface(theQgisInterface) | ||
{ | ||
} | ||
|
||
QgsOraclePlugin::~QgsOraclePlugin() | ||
{ | ||
|
||
} | ||
|
||
/* | ||
* Initialize the GUI interface for the plugin - this is only called once when the plugin is | ||
* added to the plugin registry in the QGIS application. | ||
*/ | ||
void QgsOraclePlugin::initGui() | ||
{ | ||
|
||
// Create the action for tool | ||
mQActionPointer = new QAction(QIcon(":/oracleplugin/oracleplugin.png"), tr("Select GeoRaster"), this); | ||
// Set the what's this text | ||
mQActionPointer->setWhatsThis(tr("Open a Oracle Spatial GeoRaster")); | ||
// Connect the action to the run | ||
connect(mQActionPointer, SIGNAL(triggered()), this, SLOT(run())); | ||
// Add the icon to the toolbar | ||
mQGisIface->addToolBarIcon(mQActionPointer); | ||
mQGisIface->addPluginToMenu(tr("&Oracle Spatial"), mQActionPointer); | ||
|
||
} | ||
//method defined in interface | ||
|
||
void QgsOraclePlugin::help() | ||
{ | ||
//implement me! | ||
} | ||
|
||
// Slot called when the menu item is triggered | ||
// If you created more menu items / toolbar buttons in initiGui, you should | ||
// create a separate handler for each action - this single run() method will | ||
// not be enough | ||
|
||
void QgsOraclePlugin::run() | ||
{ | ||
QgsOracleSelectGeoraster *myPluginGui = new QgsOracleSelectGeoraster(mQGisIface->mainWindow(), mQGisIface, QgisGui::ModalDialogFlags); | ||
myPluginGui->setAttribute(Qt::WA_DeleteOnClose); | ||
|
||
myPluginGui->show(); | ||
} | ||
|
||
// Unload the plugin by cleaning up the GUI | ||
|
||
void QgsOraclePlugin::unload() | ||
{ | ||
// remove the GUI | ||
mQGisIface->removePluginMenu("&Oracle Spatial", mQActionPointer); | ||
mQGisIface->removeToolBarIcon(mQActionPointer); | ||
delete mQActionPointer; | ||
} | ||
|
||
|
||
////////////////////////////////////////////////////////////////////////// | ||
// | ||
// | ||
// THE FOLLOWING CODE IS AUTOGENERATED BY THE PLUGIN BUILDER SCRIPT | ||
// YOU WOULD NORMALLY NOT NEED TO MODIFY THIS, AND YOUR PLUGIN | ||
// MAY NOT WORK PROPERLY IF YOU MODIFY THIS INCORRECTLY | ||
// | ||
// | ||
////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
/** | ||
* Required extern functions needed for every plugin | ||
* These functions can be called prior to creating an instance | ||
* of the plugin class | ||
*/ | ||
// Class factory to return a new instance of the plugin class | ||
|
||
QGISEXTERN QgisPlugin * classFactory(QgisInterface * theQgisInterfacePointer) | ||
{ | ||
return new QgsOraclePlugin(theQgisInterfacePointer); | ||
} | ||
// 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. | ||
|
||
QGISEXTERN QString name() | ||
{ | ||
return sName; | ||
} | ||
|
||
// Return the description | ||
|
||
QGISEXTERN QString description() | ||
{ | ||
return sDescription; | ||
} | ||
|
||
// Return the type (either UI or MapLayer plugin) | ||
|
||
QGISEXTERN int type() | ||
{ | ||
return sPluginType; | ||
} | ||
|
||
// Return the version number for the plugin | ||
|
||
QGISEXTERN QString version() | ||
{ | ||
return sPluginVersion; | ||
} | ||
|
||
// Delete ourself | ||
|
||
QGISEXTERN void unload(QgisPlugin * thePluginPointer) | ||
{ | ||
delete thePluginPointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/*************************************************************************** | ||
oracleplugin.h | ||
------------------- | ||
begin : Oracle Spatial Plugin | ||
copyright : (C) Ivan Lucena | ||
email : ivan.lucena@pmldnet.com | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id$ */ | ||
|
||
#ifndef OraclePlugin_H | ||
#define OraclePlugin_H | ||
|
||
// Qt Includes | ||
#include <QObject> | ||
#include <QAction> | ||
|
||
// QGIS Includes | ||
#include <qgisplugin.h> | ||
#include <qgisinterface.h> | ||
#include <qgisgui.h> | ||
|
||
class QgsOraclePlugin : public QObject, public QgisPlugin | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
/** | ||
* Constructor for a plugin. The QgisInterface pointer is passed by | ||
* QGIS when it attempts to instantiate the plugin. | ||
* @param theInterface Pointer to the QgisInterface object. | ||
*/ | ||
QgsOraclePlugin(QgisInterface * theInterface); | ||
//! Destructor | ||
virtual ~QgsOraclePlugin(); | ||
|
||
public slots: | ||
|
||
//! init the gui | ||
virtual void initGui(); | ||
//! Show the dialog box | ||
void run(); | ||
//! unload the plugin | ||
void unload(); | ||
//! show the help document | ||
void help(); | ||
|
||
private: | ||
|
||
int mPluginType; | ||
//! Pointer to the QGIS interface object | ||
QgisInterface *mQGisIface; | ||
//!pointer to the qaction for this plugin | ||
QAction * mQActionPointer; | ||
|
||
}; | ||
|
||
#endif //OraclePlugin_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/*************************************************************************** | ||
oracleconnectgui.cpp | ||
------------------- | ||
begin : Oracle Spatial Plugin | ||
copyright : (C) Ivan Lucena | ||
email : ivan.lucena@pmldnet.com | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id$ */ | ||
|
||
#include "qgsoracleconnect_ui.h" | ||
|
||
// Qt Includes | ||
#include <QSettings> | ||
#include <QMessageBox> | ||
|
||
QgsOracleConnect::QgsOracleConnect(QWidget* parent, | ||
const QString& connName, | ||
Qt::WFlags fl) : QDialog(parent, fl) | ||
{ | ||
setupUi(this); | ||
|
||
if ( ! connName.isEmpty() ) | ||
{ | ||
// populate the dialog with the information stored for the connection | ||
// populate the fields with the stored setting parameters | ||
|
||
QSettings settings; | ||
|
||
QString key = "/Oracle/connections/" + connName; | ||
|
||
txtDatabase->setText( settings.value( key + "/database" ).toString() ); | ||
txtUsername->setText( settings.value( key + "/username" ).toString() ); | ||
|
||
if ( settings.value( key + "/savepass" ).toString() == "true" ) | ||
{ | ||
txtPassword->setText( settings.value( key + "/password" ).toString() ); | ||
chkStorePassword->setChecked( true ); | ||
} | ||
txtName->setText( connName ); | ||
} | ||
} | ||
|
||
QgsOracleConnect::~QgsOracleConnect() | ||
{ | ||
} | ||
|
||
void QgsOracleConnect::on_btnCancel_clicked() | ||
{ | ||
helpInfo(); | ||
} | ||
|
||
void QgsOracleConnect::on_btnOk_clicked() | ||
{ | ||
saveConnection(); | ||
} | ||
|
||
void QgsOracleConnect::saveConnection() | ||
{ | ||
QSettings settings; | ||
|
||
QString baseKey = "/Oracle/connections/"; | ||
|
||
settings.setValue( baseKey + "selected", txtName->text() ); | ||
baseKey += txtName->text(); | ||
settings.setValue( baseKey + "/database", txtDatabase->text() ); | ||
settings.setValue( baseKey + "/username", txtUsername->text() ); | ||
settings.setValue( baseKey + "/password", txtPassword->text() ); | ||
settings.setValue( baseKey + "/savepass", chkStorePassword->isChecked() ? "true" : "false" ); | ||
settings.setValue( baseKey + "/subdtset", "GEOR:" + | ||
txtUsername->text() + "/" + | ||
txtPassword->text() + "@" + | ||
txtDatabase->text() ); | ||
|
||
accept(); | ||
} | ||
|
||
void QgsOracleConnect::helpInfo() | ||
{ | ||
// QgsContextHelp::run( context_id ); | ||
} | ||
|
Oops, something went wrong.