mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-24 00:47:57 -05:00
Gui enhancements for search by srid or epsg
git-svn-id: http://svn.osgeo.org/qgis/trunk@3328 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
40b1314fa9
commit
5a71ab27d9
@ -33,7 +33,7 @@
|
||||
#include <qdir.h>
|
||||
#include <qtextstream.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include <qradiobutton.h>
|
||||
//gdal and ogr includes
|
||||
// XXX DO WE NEED THESE?
|
||||
#include <ogr_api.h>
|
||||
@ -548,11 +548,11 @@ void QgsProjectionSelector::coordinateSystemSelected( QListViewItem * theItem )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsProjectionSelector::pbnFindSRID_clicked()
|
||||
void QgsProjectionSelector::pbnFind_clicked()
|
||||
{
|
||||
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "pbnFindSRID_clicked..." << std::endl;
|
||||
std::cout << "pbnFind..." << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
@ -574,9 +574,17 @@ void QgsProjectionSelector::pbnFindSRID_clicked()
|
||||
}
|
||||
|
||||
// Set up the query to retreive the projection information needed to populate the list
|
||||
QString mySql = "select srs_id from tbl_srs where srid=" + leSRID->text();
|
||||
QString mySql;
|
||||
if (radSRID->isChecked())
|
||||
{
|
||||
mySql= "select srs_id from tbl_srs where srid=" + leSearch->text();
|
||||
}
|
||||
else
|
||||
{
|
||||
mySql= "select srs_id from tbl_srs where epsg=" + leSearch->text();
|
||||
}
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "SRID Search sql" << mySql << std::endl;
|
||||
std::cout << " Search sql" << mySql << std::endl;
|
||||
#endif
|
||||
myResult = sqlite3_prepare(myDatabase, (const char *)mySql, mySql.length(), &myPreparedStatement, &myTail);
|
||||
// XXX Need to free memory from the error msg if one is set
|
||||
@ -593,44 +601,3 @@ void QgsProjectionSelector::pbnFindSRID_clicked()
|
||||
}
|
||||
|
||||
|
||||
void QgsProjectionSelector::pbnFindEPSG_clicked()
|
||||
{
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "pbnFindEPSG_clicked..." << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
sqlite3 *myDatabase;
|
||||
char *myErrorMessage = 0;
|
||||
const char *myTail;
|
||||
sqlite3_stmt *myPreparedStatement;
|
||||
int myResult;
|
||||
//check the db is available
|
||||
myResult = sqlite3_open(mSrsDatabaseFileName, &myDatabase);
|
||||
if(myResult)
|
||||
{
|
||||
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
|
||||
// XXX This will likely never happen since on open, sqlite creates the
|
||||
// database if it does not exist. But we checked earlier for its existance
|
||||
// and aborted in that case. This is because we may be runnig from read only
|
||||
// media such as live cd and dont want to force trying to create a db.
|
||||
assert(myResult == 0);
|
||||
}
|
||||
|
||||
// Set up the query to retreive the projection information needed to populate the list
|
||||
QString mySql = "select srs_id from tbl_srs where epsg=" + leEPSG->text();
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "SRID Search sql" << mySql << std::endl;
|
||||
#endif
|
||||
myResult = sqlite3_prepare(myDatabase, (const char *)mySql, mySql.length(), &myPreparedStatement, &myTail);
|
||||
// XXX Need to free memory from the error msg if one is set
|
||||
if(myResult == SQLITE_OK)
|
||||
{
|
||||
sqlite3_step(myPreparedStatement);
|
||||
QString mySrsId ((char *)sqlite3_column_text(myPreparedStatement, 0));
|
||||
setSelectedSRSID(mySrsId.toLong());
|
||||
}
|
||||
// close the sqlite3 statement
|
||||
sqlite3_finalize(myPreparedStatement);
|
||||
sqlite3_close(myDatabase);
|
||||
}
|
@ -43,8 +43,7 @@ public slots:
|
||||
QString getCurrentProj4String();
|
||||
long getCurrentSRID(); //posgis style projection identifier
|
||||
long getCurrentSRSID();//qgis projection identfier
|
||||
void pbnFindSRID_clicked();
|
||||
void pbnFindEPSG_clicked();
|
||||
void pbnFind_clicked();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QListView" row="0" column="0" rowspan="1" colspan="4">
|
||||
<widget class="QListView" row="0" column="0">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Coordinate Systems</string>
|
||||
@ -66,14 +66,14 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" row="1" column="0" rowspan="2" colspan="1">
|
||||
<widget class="QTextEdit" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>teProjection</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -88,47 +88,67 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="1" column="2">
|
||||
<widget class="QButtonGroup" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>leSRID</cstring>
|
||||
<cstring>buttonGroup2_2</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="3">
|
||||
<property name="name">
|
||||
<cstring>pbnFindSRID</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Find</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabel1</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Postgis SRID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="2" column="2">
|
||||
<property name="name">
|
||||
<cstring>leEPSG</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="2" column="3">
|
||||
<property name="name">
|
||||
<cstring>pbnFindEPSG</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Find</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabel1_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>EPSG ID:</string>
|
||||
<property name="title">
|
||||
<string>Search</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLineEdit" row="0" column="3">
|
||||
<property name="name">
|
||||
<cstring>leSearch</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="0" column="4">
|
||||
<property name="name">
|
||||
<cstring>pbnFind</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Find</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>radSRID</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Postgis SRID</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>radEPSGID</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>EPSG ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>spacer1</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>81</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</grid>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
@ -147,16 +167,10 @@
|
||||
<slot>coordinateSystemSelected(QListViewItem*)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pbnFindSRID</sender>
|
||||
<sender>pbnFind</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QgsProjectionSelectorBase</receiver>
|
||||
<slot>pbnFindSRID_clicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pbnFindEPSG</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QgsProjectionSelectorBase</receiver>
|
||||
<slot>pbnFindEPSG_clicked()</slot>
|
||||
<slot>pbnFind_clicked()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<includes>
|
||||
@ -165,8 +179,7 @@
|
||||
<slots>
|
||||
<slot>projectionChanged( const QString & )</slot>
|
||||
<slot>coordinateSystemSelected( QListViewItem * )</slot>
|
||||
<slot>pbnFindSRID_clicked()</slot>
|
||||
<slot>pbnFindEPSG_clicked()</slot>
|
||||
<slot>pbnFind_clicked()</slot>
|
||||
</slots>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
||||
|
@ -24,13 +24,7 @@ void QgsProjectionSelectorBase::coordinateSystemSelected( QListViewItem * )
|
||||
}
|
||||
|
||||
|
||||
void QgsProjectionSelectorBase::pbnFindSRID_clicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void QgsProjectionSelectorBase::pbnFindEPSG_clicked()
|
||||
void QgsProjectionSelectorBase::pbnFind_clicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user