Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Show proj params when selecting one in combo box
git-svn-id: http://svn.osgeo.org/qgis/trunk@3150 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Apr 13, 2005
1 parent 955d35e commit 6263852
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 25 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -2,6 +2,8 @@
------------------------------------------------------------------------------
Version 0.6 'Simon' .... development version
QGIS Change Log
2005-04-13 [timlinux] 0.6devel13
** Show params on proj designer widget when a projection is sleected
2005-04-12 [ges] 0.6.0devel12
** Applied patches from Markus Neteler to allow compilation on Qt 3.1
2005-04-12 [timlinux] 0.6devel12
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Expand Up @@ -26,7 +26,7 @@ dnl ---------------------------------------------------------------------------
MAJOR_VERSION=0
MINOR_VERSION=6
MICRO_VERSION=0
EXTRA_VERSION=12
EXTRA_VERSION=13
if test $EXTRA_VERSION -eq 0; then
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
else
Expand Down
38 changes: 18 additions & 20 deletions qgis.kdevelop
Expand Up @@ -9,7 +9,7 @@
<ignoreparts/>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
<description></description>
<description/>
</general>
<kdevautoproject>
<general>
Expand All @@ -20,7 +20,7 @@
<mainprogram>/home/gsherman/development/qgis07_dev/debug/src/qgis</mainprogram>
<directoryradio>custom</directoryradio>
<customdirectory>/</customdirectory>
<programargs></programargs>
<programargs/>
<terminal>false</terminal>
<autocompile>true</autocompile>
<envvars/>
Expand All @@ -41,14 +41,14 @@
<f77compiler>kdevpgf77options</f77compiler>
<cxxflags>-O0 -g3</cxxflags>
<envvars/>
<topsourcedir></topsourcedir>
<cppflags></cppflags>
<ldflags></ldflags>
<ccompilerbinary></ccompilerbinary>
<cxxcompilerbinary></cxxcompilerbinary>
<f77compilerbinary></f77compilerbinary>
<cflags></cflags>
<f77flags></f77flags>
<topsourcedir/>
<cppflags/>
<ldflags/>
<ccompilerbinary/>
<cxxcompilerbinary/>
<f77compilerbinary/>
<cflags/>
<f77flags/>
</debug>
</configurations>
<make>
Expand All @@ -59,18 +59,18 @@
<abortonerror>true</abortonerror>
<numberofjobs>1</numberofjobs>
<dontact>false</dontact>
<makebin></makebin>
<makebin/>
<prio>0</prio>
</make>
</kdevautoproject>
<kdevdebugger>
<general>
<dbgshell>libtool</dbgshell>
<programargs></programargs>
<gdbpath></gdbpath>
<configGdbScript></configGdbScript>
<runShellScript></runShellScript>
<runGdbScript></runGdbScript>
<programargs/>
<gdbpath/>
<configGdbScript/>
<runShellScript/>
<runGdbScript/>
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>false</floatingtoolbar>
Expand Down Expand Up @@ -155,16 +155,14 @@
<headerCompletionDelay>250</headerCompletionDelay>
</codecompletion>
<creategettersetter>
<prefixGet></prefixGet>
<prefixGet/>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>
<inlineGet>true</inlineGet>
<inlineSet>true</inlineSet>
</creategettersetter>
<references>
<pcs>Qt</pcs>
</references>
<references/>
</kdevcppsupport>
<kdevfileview>
<groups>
Expand Down
44 changes: 41 additions & 3 deletions src/qgscustomprojectiondialog.cpp
Expand Up @@ -164,11 +164,49 @@ void QgsCustomProjectionDialog::pbnCancel_clicked()
}




void QgsCustomProjectionDialog::cboProjectionFamily_textChanged( const QString & )
void QgsCustomProjectionDialog::cboProjectionFamily_highlighted( const QString & theText)
{
#ifdef QGISDEBUG
std::cout << "Projection selected from combo" << std::endl;
#endif
//search the sqlite user projections db for the projection entry
//and display its parameters
QString myQGisSettingsDir = QDir::homeDirPath () + "/.qgis/";
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)
{
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.
assert(myResult == 0);
}

// Set up the query to retreive the projection information needed to populate the PROJECTION list
QString mySql = "select parameters from tbl_projection name where name='"+theText+"'";
#ifdef QGISDEBUG
std::cout << "Query to get proj params:" << 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) == SQLITE_ROW;
QString myParametersString = (char *)sqlite3_column_text(myPreparedStatement,0);
#ifdef QGISDEBUG
std::cout << "Setting parameters text box to: " << myParametersString << std::endl;
#endif
txtExpectedParameters->setReadOnly(false);
txtExpectedParameters->setText(myParametersString);
txtExpectedParameters->setReadOnly(true);
}
sqlite3_finalize(myPreparedStatement);
sqlite3_close(myDatabase);
}


Expand Down
2 changes: 1 addition & 1 deletion src/qgscustomprojectiondialog.h
Expand Up @@ -34,7 +34,7 @@ public slots:
void pbnOK_clicked();
void pbnApply_clicked();
void pbnCancel_clicked();
void cboProjectionFamily_textChanged( const QString & );
void cboProjectionFamily_highlighted( const QString & );
};

#endif
14 changes: 14 additions & 0 deletions src/qgscustomprojectiondialogbase.ui
Expand Up @@ -193,6 +193,18 @@ Parameters:</string>
<receiver>QgsCustomProjectionDialogBase</receiver>
<slot>cboProjectionFamily_textChanged(const QString&amp;)</slot>
</connection>
<connection>
<sender>cboProjectionFamily</sender>
<signal>activated(const QString&amp;)</signal>
<receiver>QgsCustomProjectionDialogBase</receiver>
<slot>cboProjectionFamily_activated(const QString&amp;)</slot>
</connection>
<connection>
<sender>cboProjectionFamily</sender>
<signal>highlighted(const QString&amp;)</signal>
<receiver>QgsCustomProjectionDialogBase</receiver>
<slot>cboProjectionFamily_highlighted(const QString&amp;)</slot>
</connection>
</connections>
<includes>
<include location="local" impldecl="in implementation">qgscustomprojectiondialogbase.ui.h</include>
Expand All @@ -203,6 +215,8 @@ Parameters:</string>
<slot>pbnOK_clicked()</slot>
<slot>pbnHelp_clicked()</slot>
<slot>cboProjectionFamily_textChanged( const QString &amp; )</slot>
<slot>cboProjectionFamily_activated( const QString &amp; )</slot>
<slot>cboProjectionFamily_highlighted( const QString &amp; )</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
12 changes: 12 additions & 0 deletions src/qgscustomprojectiondialogbase.ui.h
Expand Up @@ -39,3 +39,15 @@ void QgsCustomProjectionDialogBase::cboProjectionFamily_textChanged( const QStri
{

}


void QgsCustomProjectionDialogBase::cboProjectionFamily_activated( const QString & )
{

}


void QgsCustomProjectionDialogBase::cboProjectionFamily_highlighted( const QString & )
{

}

0 comments on commit 6263852

Please sign in to comment.