mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
*** empty log message ***
git-svn-id: http://svn.osgeo.org/qgis/trunk@16 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
2882749886
commit
7a4d54278d
@ -58,20 +58,21 @@ QgisApp::QgisApp(QWidget *parent, const char * name, WFlags fl ) : QgisAppBase(p
|
||||
QgisApp::~QgisApp(){
|
||||
}
|
||||
void QgisApp::addLayer(){
|
||||
QStringList list = qApp->libraryPaths();
|
||||
QString msg;
|
||||
QStringList::Iterator it = list.begin();
|
||||
while( it != list.end() ) {
|
||||
msg += "\n" + *it;
|
||||
++it;
|
||||
}
|
||||
|
||||
// QMessageBox::information(this,"Search Paths",msg);
|
||||
|
||||
// show the postgis dialog
|
||||
QgsDbSourceSelect *dbs = new QgsDbSourceSelect();
|
||||
if(dbs->exec()){
|
||||
// add files to the map canvas
|
||||
QStringList tables = dbs->selectedTables();
|
||||
QString connInfo = dbs->connInfo();
|
||||
// for each selected table, connect to the datbase, parse the WKT geometry,
|
||||
// and build a cavnasitem for it
|
||||
QStringList::Iterator it = tables.begin();
|
||||
while( it != tables.end() ) {
|
||||
|
||||
|
||||
++it;
|
||||
}
|
||||
|
||||
}
|
||||
// show the file dialog
|
||||
/*
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "qgsdatabaselayer.h"
|
||||
|
||||
QgsDatabaseLayer::QgsDatabaseLayer(){
|
||||
dataSource = "foo";
|
||||
}
|
||||
QgsDatabaseLayer::~QgsDatabaseLayer(){
|
||||
}
|
||||
|
@ -28,6 +28,13 @@ class QgsDatabaseLayer : public QgsMapLayer {
|
||||
public:
|
||||
QgsDatabaseLayer();
|
||||
~QgsDatabaseLayer();
|
||||
private:
|
||||
|
||||
QString type; // maps to one of the OGIS Simple geometry types
|
||||
QString database;
|
||||
QString tableName;
|
||||
QString geometryColumn;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@ class QgsDataSource {
|
||||
public:
|
||||
QgsDataSource();
|
||||
~QgsDataSource();
|
||||
private:
|
||||
protected:
|
||||
//! Path or uri of the datasource
|
||||
QString dataSource;
|
||||
};
|
||||
|
@ -43,7 +43,13 @@ void QgsDbSourceSelect::editConnection(){
|
||||
if(nc->exec()){
|
||||
}
|
||||
}
|
||||
|
||||
void QgsDbSourceSelect::addTables(){
|
||||
//store the table info
|
||||
for(int idx=0; idx <lstTables->numRows(); idx++){
|
||||
if(lstTables->isSelected(idx))
|
||||
m_selectedTables += lstTables->text(idx);
|
||||
}
|
||||
}
|
||||
void QgsDbSourceSelect::dbConnect(){
|
||||
// populate the table list
|
||||
QSettings settings;
|
||||
@ -53,8 +59,8 @@ void QgsDbSourceSelect::dbConnect(){
|
||||
QString database = "dbname="+settings.readEntry(key+"/database");
|
||||
QString username = "user="+settings.readEntry(key+"/username");
|
||||
QString password = "password="+settings.readEntry(key+"/password");
|
||||
QString conninfo = host +" " + database + " " + username + " " + password;
|
||||
PgDatabase *pd = new PgDatabase((const char *)conninfo);
|
||||
m_connInfo = host +" " + database + " " + username + " " + password;
|
||||
PgDatabase *pd = new PgDatabase((const char *)m_connInfo);
|
||||
cout << pd->ErrorMessage();
|
||||
if(pd->Status()==CONNECTION_OK){
|
||||
// create the pixmaps for the layer types
|
||||
@ -98,3 +104,9 @@ void QgsDbSourceSelect::dbConnect(){
|
||||
qDebug( "Connection failed");
|
||||
}
|
||||
}
|
||||
QStringList QgsDbSourceSelect::selectedTables(){
|
||||
return m_selectedTables;
|
||||
}
|
||||
QString QgsDbSourceSelect::connInfo(){
|
||||
return m_connInfo;
|
||||
}
|
||||
|
@ -9,7 +9,13 @@ class QgsDbSourceSelect : public QgsDbSourceSelectBase
|
||||
~QgsDbSourceSelect();
|
||||
void addNewConnection();
|
||||
void editConnection();
|
||||
void addTables();
|
||||
void dbConnect();
|
||||
QStringList selectedTables();
|
||||
QString connInfo();
|
||||
private:
|
||||
QString m_connInfo;
|
||||
QStringList m_selectedTables;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user