Skip to content

Commit 2169249

Browse files
author
mhugent
committed
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
1 parent 7a1f807 commit 2169249

12 files changed

Lines changed: 1361 additions & 0 deletions

‎src/plugins/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ SUBDIRS (copyright_label
33
interpolation
44
north_arrow
55
scale_bar
6+
oracle_raster
67
)
78

89
IF (POSTGRES_FOUND)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
########################################################
3+
# Files
4+
5+
SET (ORACLE_SRCS
6+
qgsoracle_plugin.cpp
7+
qgsselectgeoraster_ui.cpp
8+
qgsoracleconnect_ui.cpp
9+
)
10+
11+
SET (ORACLE_UIS
12+
qgsselectgeorasterbase.ui
13+
qgsoracleconnectbase.ui
14+
)
15+
16+
SET (ORACLE_MOC_HDRS
17+
qgsoracle_plugin.h
18+
qgsselectgeoraster_ui.h
19+
qgsoracleconnect_ui.h
20+
)
21+
22+
SET (ORACLE_RCCS oracleplugin.qrc)
23+
24+
########################################################
25+
# Build
26+
27+
QT4_WRAP_UI (ORACLE_UIS_H ${ORACLE_UIS})
28+
29+
QT4_WRAP_CPP (ORACLE_MOC_SRCS ${ORACLE_MOC_HDRS})
30+
31+
QT4_ADD_RESOURCES(ORACLE_RCC_SRCS ${ORACLE_RCCS})
32+
33+
ADD_LIBRARY (oracleplugin MODULE ${ORACLE_SRCS} ${ORACLE_MOC_SRCS} ${ORACLE_RCC_SRCS} ${ORACLE_UIS_H})
34+
35+
INCLUDE_DIRECTORIES(
36+
${CMAKE_CURRENT_BINARY_DIR}
37+
${GDAL_INCLUDE_DIR}
38+
../../core ../../core/raster ../../core/renderer ../../core/symbology
39+
../../gui
40+
..
41+
)
42+
43+
TARGET_LINK_LIBRARIES(oracleplugin
44+
qgis_core
45+
qgis_gui
46+
)
47+
48+
49+
########################################################
50+
# Install
51+
52+
INSTALL(TARGETS oracleplugin
53+
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
54+
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
55+
1.09 KB
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<RCC>
2+
<qresource prefix="/oracleplugin/" >
3+
<file>oracleplugin.png</file>
4+
</qresource>
5+
</RCC>
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/***************************************************************************
2+
oracleplugin.cpp Access Oracle Spatial Plugin
3+
-------------------
4+
begin : Oracle Spatial Plugin
5+
copyright : (C) Ivan Lucena
6+
email : ivan.lucena@pmldnet.com
7+
/***************************************************************************
8+
* *
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. *
13+
* *
14+
***************************************************************************/
15+
/* $Id$ */
16+
17+
#include "qgsoracle_plugin.h"
18+
#include "qgsselectgeoraster_ui.h"
19+
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;
25+
26+
//////////////////////////////////////////////////////////////////////
27+
//
28+
// THE FOLLOWING METHODS ARE MANDATORY FOR ALL PLUGINS
29+
//
30+
//////////////////////////////////////////////////////////////////////
31+
32+
/**
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
36+
*/
37+
QgsOraclePlugin::QgsOraclePlugin(QgisInterface * theQgisInterface) :
38+
QgisPlugin(sName, sDescription, sPluginVersion, sPluginType),
39+
mQGisIface(theQgisInterface)
40+
{
41+
}
42+
43+
QgsOraclePlugin::~QgsOraclePlugin()
44+
{
45+
46+
}
47+
48+
/*
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.
51+
*/
52+
void QgsOraclePlugin::initGui()
53+
{
54+
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);
64+
65+
}
66+
//method defined in interface
67+
68+
void QgsOraclePlugin::help()
69+
{
70+
//implement me!
71+
}
72+
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
76+
// not be enough
77+
78+
void QgsOraclePlugin::run()
79+
{
80+
QgsOracleSelectGeoraster *myPluginGui = new QgsOracleSelectGeoraster(mQGisIface->mainWindow(), mQGisIface, QgisGui::ModalDialogFlags);
81+
myPluginGui->setAttribute(Qt::WA_DeleteOnClose);
82+
83+
myPluginGui->show();
84+
}
85+
86+
// Unload the plugin by cleaning up the GUI
87+
88+
void QgsOraclePlugin::unload()
89+
{
90+
// remove the GUI
91+
mQGisIface->removePluginMenu("&Oracle Spatial", mQActionPointer);
92+
mQGisIface->removeToolBarIcon(mQActionPointer);
93+
delete mQActionPointer;
94+
}
95+
96+
97+
//////////////////////////////////////////////////////////////////////////
98+
//
99+
//
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
103+
//
104+
//
105+
//////////////////////////////////////////////////////////////////////////
106+
107+
108+
/**
109+
* Required extern functions needed for every plugin
110+
* These functions can be called prior to creating an instance
111+
* of the plugin class
112+
*/
113+
// Class factory to return a new instance of the plugin class
114+
115+
QGISEXTERN QgisPlugin * classFactory(QgisInterface * theQgisInterfacePointer)
116+
{
117+
return new QgsOraclePlugin(theQgisInterfacePointer);
118+
}
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.
121+
122+
QGISEXTERN QString name()
123+
{
124+
return sName;
125+
}
126+
127+
// Return the description
128+
129+
QGISEXTERN QString description()
130+
{
131+
return sDescription;
132+
}
133+
134+
// Return the type (either UI or MapLayer plugin)
135+
136+
QGISEXTERN int type()
137+
{
138+
return sPluginType;
139+
}
140+
141+
// Return the version number for the plugin
142+
143+
QGISEXTERN QString version()
144+
{
145+
return sPluginVersion;
146+
}
147+
148+
// Delete ourself
149+
150+
QGISEXTERN void unload(QgisPlugin * thePluginPointer)
151+
{
152+
delete thePluginPointer;
153+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/***************************************************************************
2+
oracleplugin.h
3+
-------------------
4+
begin : Oracle Spatial Plugin
5+
copyright : (C) Ivan Lucena
6+
email : ivan.lucena@pmldnet.com
7+
/***************************************************************************
8+
* *
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. *
13+
* *
14+
***************************************************************************/
15+
/* $Id$ */
16+
17+
#ifndef OraclePlugin_H
18+
#define OraclePlugin_H
19+
20+
// Qt Includes
21+
#include <QObject>
22+
#include <QAction>
23+
24+
// QGIS Includes
25+
#include <qgisplugin.h>
26+
#include <qgisinterface.h>
27+
#include <qgisgui.h>
28+
29+
class QgsOraclePlugin : public QObject, public QgisPlugin
30+
{
31+
Q_OBJECT
32+
33+
public:
34+
35+
/**
36+
* Constructor for a plugin. The QgisInterface pointer is passed by
37+
* QGIS when it attempts to instantiate the plugin.
38+
* @param theInterface Pointer to the QgisInterface object.
39+
*/
40+
QgsOraclePlugin(QgisInterface * theInterface);
41+
//! Destructor
42+
virtual ~QgsOraclePlugin();
43+
44+
public slots:
45+
46+
//! init the gui
47+
virtual void initGui();
48+
//! Show the dialog box
49+
void run();
50+
//! unload the plugin
51+
void unload();
52+
//! show the help document
53+
void help();
54+
55+
private:
56+
57+
int mPluginType;
58+
//! Pointer to the QGIS interface object
59+
QgisInterface *mQGisIface;
60+
//!pointer to the qaction for this plugin
61+
QAction * mQActionPointer;
62+
63+
};
64+
65+
#endif //OraclePlugin_H
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/***************************************************************************
2+
oracleconnectgui.cpp
3+
-------------------
4+
begin : Oracle Spatial Plugin
5+
copyright : (C) Ivan Lucena
6+
email : ivan.lucena@pmldnet.com
7+
/***************************************************************************
8+
* *
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. *
13+
* *
14+
***************************************************************************/
15+
/* $Id$ */
16+
17+
#include "qgsoracleconnect_ui.h"
18+
19+
// Qt Includes
20+
#include <QSettings>
21+
#include <QMessageBox>
22+
23+
QgsOracleConnect::QgsOracleConnect(QWidget* parent,
24+
const QString& connName,
25+
Qt::WFlags fl) : QDialog(parent, fl)
26+
{
27+
setupUi(this);
28+
29+
if ( ! connName.isEmpty() )
30+
{
31+
// populate the dialog with the information stored for the connection
32+
// populate the fields with the stored setting parameters
33+
34+
QSettings settings;
35+
36+
QString key = "/Oracle/connections/" + connName;
37+
38+
txtDatabase->setText( settings.value( key + "/database" ).toString() );
39+
txtUsername->setText( settings.value( key + "/username" ).toString() );
40+
41+
if ( settings.value( key + "/savepass" ).toString() == "true" )
42+
{
43+
txtPassword->setText( settings.value( key + "/password" ).toString() );
44+
chkStorePassword->setChecked( true );
45+
}
46+
txtName->setText( connName );
47+
}
48+
}
49+
50+
QgsOracleConnect::~QgsOracleConnect()
51+
{
52+
}
53+
54+
void QgsOracleConnect::on_btnCancel_clicked()
55+
{
56+
helpInfo();
57+
}
58+
59+
void QgsOracleConnect::on_btnOk_clicked()
60+
{
61+
saveConnection();
62+
}
63+
64+
void QgsOracleConnect::saveConnection()
65+
{
66+
QSettings settings;
67+
68+
QString baseKey = "/Oracle/connections/";
69+
70+
settings.setValue( baseKey + "selected", txtName->text() );
71+
baseKey += txtName->text();
72+
settings.setValue( baseKey + "/database", txtDatabase->text() );
73+
settings.setValue( baseKey + "/username", txtUsername->text() );
74+
settings.setValue( baseKey + "/password", txtPassword->text() );
75+
settings.setValue( baseKey + "/savepass", chkStorePassword->isChecked() ? "true" : "false" );
76+
settings.setValue( baseKey + "/subdtset", "GEOR:" +
77+
txtUsername->text() + "/" +
78+
txtPassword->text() + "@" +
79+
txtDatabase->text() );
80+
81+
accept();
82+
}
83+
84+
void QgsOracleConnect::helpInfo()
85+
{
86+
// QgsContextHelp::run( context_id );
87+
}
88+

0 commit comments

Comments
 (0)