Data binding on ellipsod and projection controls in custom projection dialog

git-svn-id: http://svn.osgeo.org/qgis/trunk@3131 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2005-04-12 00:16:42 +00:00
parent b037e4a7b3
commit 111640322b
3 changed files with 13 additions and 33 deletions

View File

@ -2,12 +2,15 @@
------------------------------------------------------------------------------
Version 0.6 'Simon' .... development version
QGIS Change Log
2005-04-10 [timlinux] 0.6devel11
** Data binding on projection and ellipsoid selector on custom projection
dialog
2005-04-11 [ges] 0.6.0devel10
** Applied patches from Markus Neteler to allow compilation on Qt 3.2
2005-04-11 [ges]
** Fixed default projection (WGS 84) so it is now selected when the
project properties dialog is opened and no projection has been set.
2005-04-10 [timlinux]
2005-04-10 [timlinux] 0.6devel9
** Added custom projection maker dialog to main app menu. Dialog is still
under construction.
2005-04-09 [ges] 0.6.0devel8

View File

@ -26,7 +26,7 @@ dnl ---------------------------------------------------------------------------
MAJOR_VERSION=0
MINOR_VERSION=6
MICRO_VERSION=0
EXTRA_VERSION=10
EXTRA_VERSION=11
if test $EXTRA_VERSION -eq 0; then
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
else

View File

@ -92,10 +92,12 @@ QgsCustomProjectionDialog::QgsCustomProjectionDialog( QWidget* parent , const ch
//
// Populate the projection combo
//
// open the database containing the spatial reference data
sqlite3 *myDatabase;
char *myErrorMessage = 0;
int myResult;
sqlite3 *myDatabase;
char *myErrorMessage = 0;
const char *myTail;
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QString(myQGisSettingsDir+"user_projections.db").latin1(), &myDatabase);
if(myResult)
{
@ -104,44 +106,19 @@ QgsCustomProjectionDialog::QgsCustomProjectionDialog( QWidget* parent , const ch
// database if it does not exist.
assert(myResult == 0);
}
// prepare the sql statement
const char *myTail;
sqlite3_stmt *myPreparedStatement;
// get total count of records in the projection table
QString mySql = "select count(*) from tbl_projection";
myResult = sqlite3_prepare(myDatabase, mySql, mySql.length(), &myPreparedStatement, &myTail);
assert(myResult == SQLITE_OK);
sqlite3_step(myPreparedStatement);
// Set the max for the progress dialog to the number of entries in the srs_name table
int myEntriesCount = sqlite3_column_int(myPreparedStatement, 0);
sqlite3_finalize(myPreparedStatement);
// Set up the query to retreive the projection information needed to populate the PROJECTION list
mySql = "select * from tbl_projection order by name";
QString mySql = "select * from tbl_projection order by name";
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)
{
// set up the progress dialog
int myProgress = 1;
QProgressDialog myProgressBar( "Building Projections List...", 0, myEntriesCount,
this, "progress", TRUE );
// set initial value to 1
myProgressBar.setProgress(myProgress);
while(sqlite3_step(myPreparedStatement) == SQLITE_ROW)
{
// only update the progress dialog every 10 records
if((myProgress++ % 10) == 0)
{
myProgressBar.setProgress(myProgress++);
}
cboProjectionFamily->insertItem((char *)sqlite3_column_text(myPreparedStatement,1));
}
// update the progress bar to 100% -- just for eye candy purposes (some people hate to
// see a progress dialog end at 99%)
myProgressBar.setProgress(myEntriesCount);
}
sqlite3_finalize(myPreparedStatement);
// Set up the query to retreive the projection information needed to populate the ELLIPSOID list
mySql = "select * from tbl_ellipsoid order by name";
myResult = sqlite3_prepare(myDatabase, (const char *)mySql, mySql.length(), &myPreparedStatement, &myTail);