[QGIS Commit] r8954 - in trunk/qgis: python/gui src/app src/gui src/ui tests/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Jul 31 16:07:07 EDT 2008


Author: timlinux
Date: 2008-07-31 16:07:07 -0400 (Thu, 31 Jul 2008)
New Revision: 8954

Modified:
   trunk/qgis/python/gui/qgsprojectionselector.sip
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgsprojectproperties.cpp
   trunk/qgis/src/gui/qgsprojectionselector.cpp
   trunk/qgis/src/gui/qgsprojectionselector.h
   trunk/qgis/src/ui/qgscustomprojectiondialogbase.ui
   trunk/qgis/src/ui/qgsprojectionselectorbase.ui
   trunk/qgis/src/ui/qgsprojectpropertiesbase.ui
   trunk/qgis/tests/src/core/qgsrenderchecker.cpp
Log:
Fix for ticket #15 (Use term CRS instead of Projection throughout. Note this is a cosmetic fix only - internally class and var names still use the incorrect 'projection' nomenclature

Modified: trunk/qgis/python/gui/qgsprojectionselector.sip
===================================================================
--- trunk/qgis/python/gui/qgsprojectionselector.sip	2008-07-31 09:19:47 UTC (rev 8953)
+++ trunk/qgis/python/gui/qgsprojectionselector.sip	2008-07-31 20:07:07 UTC (rev 8954)
@@ -41,7 +41,6 @@
        */
       void applyProjList(QSet<QString> * crsFilter = 0);
 
-      void updateProjAndEllipsoidAcronyms(int theSrsid, QString theProj4String);
 
       /*!
        * \brief Make the string safe for use in SQL statements.

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2008-07-31 09:19:47 UTC (rev 8953)
+++ trunk/qgis/src/app/qgisapp.cpp	2008-07-31 20:07:07 UTC (rev 8954)
@@ -661,9 +661,9 @@
   mActionOptions->setStatusTip(tr("Change various QGIS options"));
   connect(mActionOptions, SIGNAL(triggered()), this, SLOT(options()));
   //
-  mActionCustomProjection= new QAction(getThemeIcon("/mActionCustomProjection.png"), tr("Custom Projection..."), this);
+  mActionCustomProjection= new QAction(getThemeIcon("/mActionCustomProjection.png"), tr("Custom CRS..."), this);
   // mActionCustomProjection->setShortcut(tr("Alt+I","Manage custom projections"));
-  mActionCustomProjection->setStatusTip(tr("Manage custom projections"));
+  mActionCustomProjection->setStatusTip(tr("Manage custom coordinate reference systems"));
   connect(mActionCustomProjection, SIGNAL(triggered()), this, SLOT(customProjection()));
   //
   // Help Menu Related items
@@ -1237,10 +1237,11 @@
     exit(0);
   }
   mOnTheFlyProjectionStatusButton->setWhatsThis(tr("This icon shows whether "
-        "on the fly projection is enabled or not. Click the icon to bring up "
+        "on the fly coordinate reference system transformation is enabled or not. "
+        "Click the icon to bring up "
         "the project properties dialog to alter this behaviour."));
-  mOnTheFlyProjectionStatusButton->setToolTip(tr("Projection status - Click "
-        "to open projection dialog"));
+  mOnTheFlyProjectionStatusButton->setToolTip(tr("CRS status - Click "
+        "to open coordinate reference system dialog"));
   connect(mOnTheFlyProjectionStatusButton, SIGNAL(clicked()),
       this, SLOT(projectPropertiesProjections()));//bring up the project props dialog when clicked
   statusBar()->addPermanentWidget(mOnTheFlyProjectionStatusButton,0);

Modified: trunk/qgis/src/app/qgsprojectproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsprojectproperties.cpp	2008-07-31 09:19:47 UTC (rev 8953)
+++ trunk/qgis/src/app/qgsprojectproperties.cpp	2008-07-31 20:07:07 UTC (rev 8954)
@@ -59,7 +59,6 @@
   bool myProjectionEnabled = myRender->projectionsEnabled();
   cbxProjectionEnabled->setChecked(myProjectionEnabled);
   
-  // set the default wkt to WGS 84
   long mySRSID = myRender->destinationSrs().srsid();
   QgsDebugMsg("Read project SRSID: " + QString::number(mySRSID));
   projectionSelector->setSelectedSRSID(mySRSID);

Modified: trunk/qgis/src/gui/qgsprojectionselector.cpp
===================================================================
--- trunk/qgis/src/gui/qgsprojectionselector.cpp	2008-07-31 09:19:47 UTC (rev 8953)
+++ trunk/qgis/src/gui/qgsprojectionselector.cpp	2008-07-31 20:07:07 UTC (rev 8954)
@@ -27,7 +27,12 @@
 #include <QTextStream>
 #include <QHeaderView>
 #include <QResizeEvent>
+#include <QMessageBox>
 
+const int NAME_COLUMN=0;
+const int EPSG_COLUMN=1;
+const int QGIS_SRS_ID_COLUMN=2;
+
 QgsProjectionSelector::QgsProjectionSelector(QWidget* parent,
                                              const char * name,
                                              Qt::WFlags fl)
@@ -45,7 +50,9 @@
 
   // Get the full path name to the sqlite3 spatial reference database.
   mSrsDatabaseFileName = QgsApplication::srsDbFilePath();
-  lstCoordinateSystems->header()->setResizeMode(1,QHeaderView::Stretch);
+  lstCoordinateSystems->header()->setResizeMode(EPSG_COLUMN,QHeaderView::Stretch);
+  lstCoordinateSystems->header()->resizeSection(QGIS_SRS_ID_COLUMN,0);
+  lstCoordinateSystems->header()->setResizeMode(QGIS_SRS_ID_COLUMN,QHeaderView::Fixed);
 }
 
 
@@ -56,8 +63,9 @@
 void QgsProjectionSelector::resizeEvent ( QResizeEvent * theEvent )
 {
 
-  lstCoordinateSystems->header()->resizeSection(0,(theEvent->size().width()-120));
-  lstCoordinateSystems->header()->resizeSection(1,120);
+  lstCoordinateSystems->header()->resizeSection(NAME_COLUMN,(theEvent->size().width()-120));
+  lstCoordinateSystems->header()->resizeSection(EPSG_COLUMN,120);
+  lstCoordinateSystems->header()->resizeSection(QGIS_SRS_ID_COLUMN,0);
 }
 
 void QgsProjectionSelector::showEvent ( QShowEvent * theEvent )
@@ -223,7 +231,7 @@
   {
     QString mySRSIDString = QString::number(mSRSIDSelection);
   
-    QList<QTreeWidgetItem*> nodes = lstCoordinateSystems->findItems(mySRSIDString, Qt::MatchExactly|Qt::MatchRecursive, 1);
+    QList<QTreeWidgetItem*> nodes = lstCoordinateSystems->findItems(mySRSIDString, Qt::MatchExactly|Qt::MatchRecursive, QGIS_SRS_ID_COLUMN);
   
     if (nodes.count() > 0)
     {
@@ -268,10 +276,10 @@
   if(myItem)
   {
 
-    if(myItem->text(1).length() > 0)
+    if(myItem->text(QGIS_SRS_ID_COLUMN).length() > 0)
     {
       QString myDatabaseFileName;
-      QString mySrsId = myItem->text(1);
+      QString mySrsId = myItem->text(QGIS_SRS_ID_COLUMN);
 
       QgsDebugMsg("mySrsId = " + mySrsId);
       QgsDebugMsg("USER_PROJECTION_START_ID = " + QString::number(USER_PROJECTION_START_ID));
@@ -306,10 +314,8 @@
       rc = sqlite3_open(myDatabaseFileName.toUtf8().data(), &db);
       if(rc)
       {
-        QgsLogger::warning("Can't open database: " + QString(sqlite3_errmsg(db)));
-        // XXX This will likely never happen since on open, sqlite creates the
-        //     database if it does not exist.
-        assert(rc == 0);
+        showDBMissingWarning(myDatabaseFileName );
+        return QString("");
       }
       // prepare the sql statement
       const char *pzTail;
@@ -333,10 +339,6 @@
       sqlite3_finalize(ppStmt);
       // close the database
       sqlite3_close(db);
-#ifdef QGISDEBUG
-      std::cout << "Item selected : " << myItem->text(0).toLocal8Bit().data() << std::endl;
-      std::cout << "Item selected full string : " << myProjString.toLocal8Bit().data() << std::endl;
-#endif
       assert(myProjString.length() > 0);
       return myProjString;
     }
@@ -366,14 +368,14 @@
   if(lvi)
   {
     // Make sure the selected node is a srs and not a top-level projection node
-    if(lvi->text(1).length() > 0)
+    if(lvi->text(QGIS_SRS_ID_COLUMN).length() > 0)
     {
       QString myDatabaseFileName;
       //
       // Determine if this is a user projection or a system on
       // user projection defs all have srs_id >= 100000
       //
-      if (lvi->text(1).toLong() >= USER_PROJECTION_START_ID)
+      if (lvi->text(QGIS_SRS_ID_COLUMN).toLong() >= USER_PROJECTION_START_ID)
       {
         myDatabaseFileName = QgsApplication::qgisUserDbFilePath();
         QFileInfo myFileInfo;
@@ -398,10 +400,8 @@
       rc = sqlite3_open(myDatabaseFileName.toUtf8().data(), &db);
       if(rc)
       {
-        std::cout <<  "Can't open database: " <<  sqlite3_errmsg(db) << std::endl;
-        // XXX This will likely never happen since on open, sqlite creates the
-        //     database if it does not exist.
-        assert(rc == 0);
+        showDBMissingWarning(myDatabaseFileName );
+        return 0;
       }
       // prepare the sql statement
       const char *pzTail;
@@ -409,7 +409,7 @@
       QString sql = "select ";
       sql += attributeName;
       sql += " from tbl_srs where srs_id = ";
-      sql += lvi->text(1);
+      sql += lvi->text(QGIS_SRS_ID_COLUMN);
 
 #ifdef QGISDEBUG
       std::cout << "Finding selected attribute using : " <<  sql.toLocal8Bit().data() << std::endl;
@@ -456,9 +456,9 @@
 {
   QTreeWidgetItem* item = lstCoordinateSystems->currentItem();
 
-  if(item != NULL && item->text(1).length() > 0)
+  if(item != NULL && item->text(QGIS_SRS_ID_COLUMN).length() > 0)
   {
-    return lstCoordinateSystems->currentItem()->text(1).toLong();
+    return lstCoordinateSystems->currentItem()->text(QGIS_SRS_ID_COLUMN).toLong();
   }
   else
   {
@@ -487,7 +487,7 @@
 
   // User defined coordinate system node
   // Make in an italic font to distinguish them from real projections
-  mUserProjList = new QTreeWidgetItem(lstCoordinateSystems,QStringList("User Defined Coordinate Systems"));
+  mUserProjList = new QTreeWidgetItem(lstCoordinateSystems,QStringList(tr("User Defined Coordinate Systems")));
 
   QFont fontTemp = mUserProjList->font(0);
   fontTemp.setItalic(TRUE);
@@ -519,22 +519,19 @@
   myResult = sqlite3_open(QString(myDatabaseFileName).toUtf8().data(), &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);
+    showDBMissingWarning(myDatabaseFileName );
+    return;
   }
 
   // Set up the query to retrieve the projection information needed to populate the list
-  QString mySql = "select description, srs_id, is_geo, name, parameters from vw_srs ";
+  QString mySql = "select description, srs_id, epsg, is_geo, name, parameters from vw_srs ";
   mySql += "where ";
   mySql += sqlFilter;
 
-#ifdef QGISDEBUG
-  std::cout << "User projection list sql" << mySql.toLocal8Bit().data() << std::endl;
-#endif
   myResult = sqlite3_prepare(myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail);
   // XXX Need to free memory from the error msg if one is set
   if(myResult == SQLITE_OK)
@@ -543,8 +540,10 @@
     while(sqlite3_step(myPreparedStatement) == SQLITE_ROW)
     {
       newItem = new QTreeWidgetItem(mUserProjList, QStringList(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0))));
-      // display the qgis srs_id in the second column of the list view
-      newItem->setText(1,QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement, 1)));
+      // display the epsg (field 2) in the second column of the list view
+      newItem->setText(EPSG_COLUMN,QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,2 )));
+      // display the qgis srs_id (field 1) in the third column of the list view
+      newItem->setText(QGIS_SRS_ID_COLUMN,QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement, 1)));
     }
   }
   // close the sqlite3 statement
@@ -563,14 +562,14 @@
   // Make in an italic font to distinguish them from real projections
   //
   // Geographic coordinate system node
-  mGeoList = new QTreeWidgetItem(lstCoordinateSystems,QStringList("Geographic Coordinate Systems"));
+  mGeoList = new QTreeWidgetItem(lstCoordinateSystems,QStringList(tr("Geographic Coordinate Systems")));
 
   QFont fontTemp = mGeoList->font(0);
   fontTemp.setItalic(TRUE);
   mGeoList->setFont(0, fontTemp);
 
   // Projected coordinate system node
-  mProjList = new QTreeWidgetItem(lstCoordinateSystems,QStringList("Projected Coordinate Systems"));
+  mProjList = new QTreeWidgetItem(lstCoordinateSystems,QStringList(tr("Projected Coordinate Systems")));
 
   fontTemp = mProjList->font(0);
   fontTemp.setItalic(TRUE);
@@ -595,10 +594,10 @@
   rc = sqlite3_open(mSrsDatabaseFileName.toUtf8().data(), &db);
   if(rc)
   {
-    std::cout <<  "Can't open database: " <<  sqlite3_errmsg(db) << std::endl;
     // XXX This will likely never happen since on open, sqlite creates the
     //     database if it does not exist.
-    assert(rc == 0);
+    showDBMissingWarning(mSrsDatabaseFileName );
+    return ;
   }
   // prepare the sql statement
   const char *pzTail;
@@ -610,31 +609,20 @@
   assert(rc == SQLITE_OK);
   sqlite3_step(ppStmt);
 
-#ifdef QGISDEBUG
-  int myEntriesCount = sqlite3_column_int(ppStmt, 0);
-  std::cout << "Projection entries found in srs.db: " << myEntriesCount << std::endl;
-#endif
   sqlite3_finalize(ppStmt);
 
   // Set up the query to retreive the projection information needed to populate the list
   //note I am giving the full field names for clarity here and in case someown
   //changes the underlying view TS
-  sql = "select description, srs_id, is_geo, name, parameters from vw_srs ";
+  sql = "select description, srs_id, epsg, is_geo, name, parameters from vw_srs ";
   sql += "where ";
   sql += sqlFilter;
   sql += " order by name, description";
 
-#ifdef QGISDEBUG
-  std::cout << "SQL for projection list:\n" << sql.toLocal8Bit().data() << std::endl;
-#endif
   rc = sqlite3_prepare(db, sql.toUtf8(), sql.length(), &ppStmt, &pzTail);
   // XXX Need to free memory from the error msg if one is set
   if(rc == SQLITE_OK)
   {
-#ifdef QGISDEBUG
-    std::cout << "SQL for projection list executed ok..."  << std::endl;
-#endif
-
     QTreeWidgetItem *newItem;
     // Cache some stuff to speed up creating of the list of projected
     // spatial reference systems
@@ -648,59 +636,57 @@
       if(isGeo)
       {
         // this is a geographic coordinate system
-        // Add it to the tree
+        // Add it to the tree (field 0)
         newItem = new QTreeWidgetItem(mGeoList, QStringList(QString::fromUtf8((char *)sqlite3_column_text(ppStmt,0))));
 
-        // display the qgis srs_id in the second column of the list view
-        newItem->setText(1,QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 1)));
+        // display the epsg (field 2) in the second column of the list view
+        newItem->setText(EPSG_COLUMN,QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 2)));
+
+        // display the qgis srs_id (field 1) in the third column of the list view
+        newItem->setText(QGIS_SRS_ID_COLUMN,QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 1)));
       }
       else
       {
         // This is a projected srs
 
-	QTreeWidgetItem *node;
-	QString srsType = QString::fromUtf8((char*)sqlite3_column_text(ppStmt, 3));
+        QTreeWidgetItem *node;
+        QString srsType = QString::fromUtf8((char*)sqlite3_column_text(ppStmt, 3));
         // Find the node for this type and add the projection to it
         // If the node doesn't exist, create it
-	if (srsType == previousSrsType)
-	{
-	  node = previousSrsTypeNode;
-	}
-	else
-	{ // Different from last one, need to search
-	  QList<QTreeWidgetItem*> nodes = lstCoordinateSystems->findItems(srsType,Qt::MatchExactly|Qt::MatchRecursive,0);
-	  if(nodes.count() == 0)
-	  {
-	    // the node doesn't exist -- create it
+        if (srsType == previousSrsType)
+        {
+          node = previousSrsTypeNode;
+        }
+        else
+        { // Different from last one, need to search
+          QList<QTreeWidgetItem*> nodes = lstCoordinateSystems->findItems(srsType,Qt::MatchExactly|Qt::MatchRecursive,0);
+          if(nodes.count() == 0)
+          {
+            // the node doesn't exist -- create it
             // Make in an italic font to distinguish them from real projections
-	    node = new QTreeWidgetItem(mProjList, QStringList(srsType));
+            node = new QTreeWidgetItem(mProjList, QStringList(srsType));
 
             QFont fontTemp = node->font(0);
             fontTemp.setItalic(TRUE);
             node->setFont(0, fontTemp);
-	  }
-	  else
-	  {
-	    node = nodes.first();
-	  }
-	  // Update the cache.
-	  previousSrsType = srsType;
-	  previousSrsTypeNode = node;
-	}
+          }
+          else
+          {
+            node = nodes.first();
+          }
+          // Update the cache.
+          previousSrsType = srsType;
+          previousSrsTypeNode = node;
+        }
         // add the item, setting the projection name in the first column of the list view
         newItem = new QTreeWidgetItem(node, QStringList(QString::fromUtf8((char *)sqlite3_column_text(ppStmt,0))));
-        // set the srs_id in the second column on the list view
-        newItem->setText(1,QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 1)));
+        // display the epsg (field 2) in the second column of the list view
+        newItem->setText(EPSG_COLUMN,QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 2)));
+        // display the qgis srs_id (field 1) in the third column of the list view
+        newItem->setText(QGIS_SRS_ID_COLUMN,QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 1)));
       }
-      //Only enable thse lines temporarily if you want to generate a script
-      //to update proj an ellipoid fields in the srs.db
-      //updateProjAndEllipsoidAcronyms(QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 1)).toLong(),
-      //                               QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 4)))  ;
     }
   }
-#ifdef QGISDEBUG
-  std::cout << "Size of projection list widget : " << sizeof(*lstCoordinateSystems) << std::endl;
-#endif
   // close the sqlite3 statement
   sqlite3_finalize(ppStmt);
   // close the database
@@ -709,69 +695,7 @@
   mProjListDone = TRUE;
 }
 
-//this is a little helper function to populate the (well give you a sql script to populate)
-//the projection_acronym and ellipsoid_acronym fields in the srs.db backend
-//To cause it to be run, uncomment or add the line:
-//      updateProjAndEllipsoidAcronyms(QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 1)).toLong(),
-//                                     QString:.fromUtf8((char *)sqlite3_column_text(ppStmt, 4)))  ;
-//to the above method. NOTE it will cause a huge slow down in population of the proj selector dialog so
-//remember to disable it again!
-void QgsProjectionSelector::updateProjAndEllipsoidAcronyms(int theSrsid,QString theProj4String)
-{
 
-
-  //temporary hack
-  QFile myFile( "/tmp/srs_updates.sql" );
-  myFile.open(  QIODevice::WriteOnly | QIODevice::Append );
-  QTextStream myStream( &myFile );
-
-  QRegExp myProjRegExp( "proj=[a-zA-Z]* " );
-  int myStart= 0;
-  int myLength=0;
-  myStart = myProjRegExp.indexIn(theProj4String, myStart);
-  QString myProjectionAcronym;
-  if (myStart==-1)
-  {
-    std::cout << "proj string supplied has no +proj argument" << std::endl;
-    myProjectionAcronym = "";
-  }
-  else
-  {
-    myLength = myProjRegExp.matchedLength();
-    myProjectionAcronym = theProj4String.mid(myStart+PROJ_PREFIX_LEN,myLength-(PROJ_PREFIX_LEN+1));//+1 for space
-  }
-
-
-  QRegExp myEllipseRegExp( "ellps=[a-zA-Z0-9\\-]* " );
-  myStart= 0;
-  myLength=0;
-  myStart = myEllipseRegExp.indexIn(theProj4String, myStart);
-  QString myEllipsoidAcronym;
-  if (myStart==-1)
-  {
-    std::cout << "proj string supplied has no +ellps argument" << std::endl;
-    myEllipsoidAcronym="";
-  }
-  else
-  {
-    myLength = myEllipseRegExp.matchedLength();
-    myEllipsoidAcronym = theProj4String.mid(myStart+ELLPS_PREFIX_LEN,myLength-(ELLPS_PREFIX_LEN+1));
-  }
-
-
-  //now create the update statement
-  QString mySql = "update tbl_srs set projection_acronym='" + myProjectionAcronym +
-                  "', ellipsoid_acronym='" + myEllipsoidAcronym + "' where " +
-                  "srs_id=" + QString::number(theSrsid)+";";
-
-
-  //tmporary hack
-  myStream << mySql << "\n";
-  myFile.close();
-  //std::cout
-
-}
-
 // New coordinate system selected from the list
 void QgsProjectionSelector::coordinateSystemSelected( QTreeWidgetItem * theItem)
 {
@@ -780,17 +704,11 @@
   if (theItem != NULL && theItem->childCount() == 0)
   {
     // Found a real SRS
-    QString myDescription = tr("QGIS SRSID: ") + QString::number(getCurrentSRSID()) +"\n";
-    myDescription        += tr("PostGIS SRID: ") + QString::number(getCurrentSRID()) +"\n";
+    QString myDescription;
     emit sridSelected(QString::number(getCurrentSRSID()));
     QString myProjString = getCurrentProj4String();
-    if (!myProjString.isNull())
-    {
-      myDescription+=(myProjString);
-    }
-
     lstCoordinateSystems->scrollToItem(theItem);
-    teProjection->setText(myDescription);
+    teProjection->setText(myProjString);
   }
   else
   {
@@ -810,12 +728,8 @@
   QString mySearchString(stringSQLSafe(leSearch->text()));
   // Set up the query to retreive the projection information needed to populate the list
   QString mySql;
-  if (radSRID->isChecked())
+  if (radEPSGID->isChecked())
   {
-    mySql= "select srs_id from tbl_srs where srid=" + mySearchString;
-  }
-  else if (radEPSGID->isChecked())
-  {
     mySql= "select srs_id from tbl_srs where epsg=" + mySearchString;
   }
   else if (radName->isChecked()) //name search
@@ -843,12 +757,6 @@
              " and srs_id > " + QString::number(getCurrentSRSID()) + " order by srs_id limit 1";
     }
   }
-  else //qgis srsid
-  {
-    //no need to try too look up srsid in db as user has already entered it!
-    setSelectedSRSID(mySearchString.toLong());
-    return;
-  }
 #ifdef QGISDEBUG
   std::cout << " Search sql: " << mySql.toLocal8Bit().data() << std::endl;
 #endif
@@ -865,12 +773,12 @@
   myResult = sqlite3_open(mSrsDatabaseFileName.toUtf8().data(), &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);
+    showDBMissingWarning(mSrsDatabaseFileName );
+    return;
   }
 
   myResult = sqlite3_prepare(myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail);
@@ -945,12 +853,12 @@
     myResult = sqlite3_open(myDatabaseFileName.toUtf8().data(), &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.
-
+      showDBMissingWarning(myDatabaseFileName );
+      return 0;
     }
     else
     {
@@ -1016,3 +924,12 @@
 	myRetval.replace("%","\\%");
 	return myRetval;
  }
+
+const void QgsProjectionSelector::showDBMissingWarning(const QString theFileName)
+{
+
+    QMessageBox::critical(this, tr("Resource Location Error"), 
+        tr("Error reading database file from: \n %1\n"
+          "Because of this the projection selector will not work...")
+        .arg(theFileName));
+}

Modified: trunk/qgis/src/gui/qgsprojectionselector.h
===================================================================
--- trunk/qgis/src/gui/qgsprojectionselector.h	2008-07-31 09:19:47 UTC (rev 8953)
+++ trunk/qgis/src/gui/qgsprojectionselector.h	2008-07-31 20:07:07 UTC (rev 8954)
@@ -52,7 +52,6 @@
        */
       void applyProjList(QSet<QString> * crsFilter = 0);
 
-      void updateProjAndEllipsoidAcronyms(int theSrsid, QString theProj4String);
 
       /*!
        * \brief Make the string safe for use in SQL statements.
@@ -156,6 +155,8 @@
        */
       long getCurrentLongAttribute(QString attributeName);
 
+      /** Show the user a warning if the srs database could not be found */
+      const void showDBMissingWarning(const QString theFileName);
       // List view nodes for the tree view of projections
       //! User defined projections node
       QTreeWidgetItem *mUserProjList;

Modified: trunk/qgis/src/ui/qgscustomprojectiondialogbase.ui
===================================================================
--- trunk/qgis/src/ui/qgscustomprojectiondialogbase.ui	2008-07-31 09:19:47 UTC (rev 8953)
+++ trunk/qgis/src/ui/qgscustomprojectiondialogbase.ui	2008-07-31 20:07:07 UTC (rev 8954)
@@ -10,7 +10,7 @@
    </rect>
   </property>
   <property name="windowTitle" >
-   <string>Custom Projection Definition</string>
+   <string>Custom Coordinate Reference System Definition</string>
   </property>
   <property name="windowIcon" >
    <iconset/>
@@ -25,7 +25,7 @@
       <item row="0" column="0" colspan="2" >
        <widget class="QLabel" name="label" >
         <property name="text" >
-         <string>You can define your own custom projection here. The definition must conform to the proj4 format for specifying a Spatial Reference System.</string>
+         <string>You can define your own custom Coordinate Reference System (CRS) here. The definition must conform to the proj4 format for specifying a CRS.</string>
         </property>
         <property name="wordWrap" >
          <bool>true</bool>
@@ -154,7 +154,7 @@
       <item row="0" column="0" colspan="3" >
        <widget class="QLabel" name="label_2" >
         <property name="text" >
-         <string>Use the text boxes below to test the projection definition you are creating. Enter a coordinate where both the lat/long and the projected result are known (for example by reading off a map). Then press the calculate button to see if the projection definition you are creating is accurate.</string>
+         <string>Use the text boxes below to test the CRS definition you are creating. Enter a coordinate where both the lat/long and the transformed result are known (for example by reading off a map). Then press the calculate button to see if the CRS definition you are creating is accurate.</string>
         </property>
         <property name="wordWrap" >
          <bool>true</bool>
@@ -184,7 +184,7 @@
       <item row="2" column="2" >
        <widget class="QLabel" name="textLabel2_3" >
         <property name="text" >
-         <string>Projected Coordinate System</string>
+         <string>Destination CRS        </string>
         </property>
        </widget>
       </item>

Modified: trunk/qgis/src/ui/qgsprojectionselectorbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsprojectionselectorbase.ui	2008-07-31 09:19:47 UTC (rev 8953)
+++ trunk/qgis/src/ui/qgsprojectionselectorbase.ui	2008-07-31 20:07:07 UTC (rev 8954)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>468</width>
-    <height>428</height>
+    <width>457</width>
+    <height>403</height>
    </rect>
   </property>
   <property name="sizePolicy" >
@@ -16,218 +16,150 @@
    </sizepolicy>
   </property>
   <property name="windowTitle" >
-   <string>Projection Selector</string>
+   <string>Coordinate Reference System Selector</string>
   </property>
   <property name="windowIcon" >
    <iconset/>
   </property>
   <layout class="QGridLayout" >
    <property name="leftMargin" >
-    <number>0</number>
+    <number>3</number>
    </property>
    <property name="topMargin" >
-    <number>0</number>
+    <number>3</number>
    </property>
    <property name="rightMargin" >
-    <number>0</number>
+    <number>3</number>
    </property>
    <property name="bottomMargin" >
-    <number>0</number>
+    <number>3</number>
    </property>
-   <property name="horizontalSpacing" >
-    <number>0</number>
-   </property>
-   <property name="verticalSpacing" >
-    <number>0</number>
-   </property>
    <item row="0" column="0" >
-    <widget class="QGroupBox" name="groupBox_2" >
+    <widget class="QTreeWidget" name="lstCoordinateSystems" >
+     <property name="alternatingRowColors" >
+      <bool>true</bool>
+     </property>
+     <property name="uniformRowHeights" >
+      <bool>true</bool>
+     </property>
+     <property name="columnCount" >
+      <number>3</number>
+     </property>
+     <column>
+      <property name="text" >
+       <string>Coordinate Reference System</string>
+      </property>
+     </column>
+     <column>
+      <property name="text" >
+       <string>EPSG</string>
+      </property>
+     </column>
+     <column>
+      <property name="text" >
+       <string>ID</string>
+      </property>
+     </column>
+    </widget>
+   </item>
+   <item row="1" column="0" >
+    <widget class="QTextEdit" name="teProjection" >
      <property name="sizePolicy" >
       <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
+     <property name="minimumSize" >
+      <size>
+       <width>0</width>
+       <height>100</height>
+      </size>
+     </property>
+     <property name="maximumSize" >
+      <size>
+       <width>16777215</width>
+       <height>100</height>
+      </size>
+     </property>
+     <property name="autoFormatting" >
+      <set>QTextEdit::AutoBulletList</set>
+     </property>
+     <property name="readOnly" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0" >
+    <widget class="QGroupBox" name="groupBox" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
      <property name="title" >
-      <string>Projection</string>
+      <string>Search</string>
      </property>
      <layout class="QGridLayout" >
-      <property name="leftMargin" >
-       <number>12</number>
-      </property>
-      <property name="topMargin" >
-       <number>12</number>
-      </property>
-      <property name="rightMargin" >
-       <number>12</number>
-      </property>
-      <property name="bottomMargin" >
-       <number>12</number>
-      </property>
-      <property name="horizontalSpacing" >
-       <number>0</number>
-      </property>
-      <property name="verticalSpacing" >
-       <number>0</number>
-      </property>
-      <item row="2" column="0" >
-       <widget class="QGroupBox" name="groupBox" >
-        <property name="sizePolicy" >
-         <sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
+      <item row="0" column="0" >
+       <widget class="QRadioButton" name="radEPSGID" >
+        <property name="text" >
+         <string>EPSG ID</string>
         </property>
-        <property name="title" >
-         <string>Search</string>
+        <property name="iconSize" >
+         <size>
+          <width>16</width>
+          <height>10</height>
+         </size>
         </property>
-        <layout class="QGridLayout" >
-         <property name="leftMargin" >
-          <number>2</number>
-         </property>
-         <property name="topMargin" >
-          <number>2</number>
-         </property>
-         <property name="rightMargin" >
-          <number>2</number>
-         </property>
-         <property name="bottomMargin" >
-          <number>2</number>
-         </property>
-         <property name="horizontalSpacing" >
-          <number>3</number>
-         </property>
-         <property name="verticalSpacing" >
-          <number>3</number>
-         </property>
-         <item row="1" column="3" >
-          <widget class="QPushButton" name="pbnFind" >
-           <property name="maximumSize" >
-            <size>
-             <width>100</width>
-             <height>16777215</height>
-            </size>
-           </property>
-           <property name="text" >
-            <string>Find</string>
-           </property>
-           <property name="default" >
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="0" colspan="3" >
-          <widget class="QLineEdit" name="leSearch" />
-         </item>
-         <item row="0" column="3" >
-          <widget class="QRadioButton" name="radName" >
-           <property name="text" >
-            <string>Name</string>
-           </property>
-           <property name="iconSize" >
-            <size>
-             <width>16</width>
-             <height>10</height>
-            </size>
-           </property>
-          </widget>
-         </item>
-         <item row="0" column="2" >
-          <widget class="QRadioButton" name="radSRSID" >
-           <property name="text" >
-            <string>QGIS SRSID</string>
-           </property>
-           <property name="iconSize" >
-            <size>
-             <width>16</width>
-             <height>10</height>
-            </size>
-           </property>
-          </widget>
-         </item>
-         <item row="0" column="1" >
-          <widget class="QRadioButton" name="radEPSGID" >
-           <property name="text" >
-            <string>EPSG ID</string>
-           </property>
-           <property name="iconSize" >
-            <size>
-             <width>16</width>
-             <height>10</height>
-            </size>
-           </property>
-          </widget>
-         </item>
-         <item row="0" column="0" >
-          <widget class="QRadioButton" name="radSRID" >
-           <property name="text" >
-            <string>Postgis SRID</string>
-           </property>
-           <property name="iconSize" >
-            <size>
-             <width>16</width>
-             <height>10</height>
-            </size>
-           </property>
-           <property name="checked" >
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-        </layout>
        </widget>
       </item>
-      <item row="1" column="0" >
-       <widget class="QTextEdit" name="teProjection" >
-        <property name="sizePolicy" >
-         <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
+      <item row="0" column="1" >
+       <widget class="QRadioButton" name="radName" >
+        <property name="text" >
+         <string>Name</string>
         </property>
-        <property name="minimumSize" >
+        <property name="iconSize" >
          <size>
-          <width>0</width>
-          <height>100</height>
+          <width>16</width>
+          <height>10</height>
          </size>
         </property>
+       </widget>
+      </item>
+      <item row="0" column="2" colspan="2" >
+       <spacer>
+        <property name="orientation" >
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" >
+         <size>
+          <width>231</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="1" column="0" colspan="3" >
+       <widget class="QLineEdit" name="leSearch" />
+      </item>
+      <item row="1" column="3" >
+       <widget class="QPushButton" name="pbnFind" >
         <property name="maximumSize" >
          <size>
-          <width>16777215</width>
-          <height>100</height>
+          <width>100</width>
+          <height>16777215</height>
          </size>
         </property>
-        <property name="autoFormatting" >
-         <set>QTextEdit::AutoBulletList</set>
+        <property name="text" >
+         <string>Find</string>
         </property>
-        <property name="readOnly" >
+        <property name="default" >
          <bool>true</bool>
         </property>
        </widget>
       </item>
-      <item row="0" column="0" >
-       <widget class="QTreeWidget" name="lstCoordinateSystems" >
-        <property name="alternatingRowColors" >
-         <bool>true</bool>
-        </property>
-        <property name="uniformRowHeights" >
-         <bool>true</bool>
-        </property>
-        <property name="columnCount" >
-         <number>2</number>
-        </property>
-        <column>
-         <property name="text" >
-          <string>Spatial Reference System</string>
-         </property>
-        </column>
-        <column>
-         <property name="text" >
-          <string>Id</string>
-         </property>
-        </column>
-       </widget>
-      </item>
      </layout>
     </widget>
    </item>

Modified: trunk/qgis/src/ui/qgsprojectpropertiesbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsprojectpropertiesbase.ui	2008-07-31 09:19:47 UTC (rev 8953)
+++ trunk/qgis/src/ui/qgsprojectpropertiesbase.ui	2008-07-31 20:07:07 UTC (rev 8954)
@@ -279,17 +279,17 @@
      </widget>
      <widget class="QWidget" name="tab2" >
       <attribute name="title" >
-       <string>Projection</string>
+       <string>Coordinate Reference System (CRS)</string>
       </attribute>
       <layout class="QGridLayout" >
        <property name="leftMargin" >
-        <number>11</number>
+        <number>3</number>
        </property>
        <property name="topMargin" >
         <number>11</number>
        </property>
        <property name="rightMargin" >
-        <number>11</number>
+        <number>3</number>
        </property>
        <property name="bottomMargin" >
         <number>11</number>
@@ -297,7 +297,7 @@
        <item row="0" column="0" >
         <widget class="QCheckBox" name="cbxProjectionEnabled" >
          <property name="text" >
-          <string>Enable on the fly projection</string>
+          <string>Enable 'on the fly' CRS transformation</string>
          </property>
         </widget>
        </item>

Modified: trunk/qgis/tests/src/core/qgsrenderchecker.cpp
===================================================================
--- trunk/qgis/tests/src/core/qgsrenderchecker.cpp	2008-07-31 09:19:47 UTC (rev 8953)
+++ trunk/qgis/tests/src/core/qgsrenderchecker.cpp	2008-07-31 20:07:07 UTC (rev 8954)
@@ -56,7 +56,8 @@
   QImage myImage( myExpectedImage.width() , myExpectedImage.height(), QImage::Format_RGB32 );
   myImage.fill ( qRgb( 152,219,249  ) );
   QPainter myPainter( &myImage );
-  mpMapRenderer->setOutputSize( QSize ( myExpectedImage.width(),myExpectedImage.height() ),72 ); 
+  mpMapRenderer->setOutputSize( QSize (
+        myExpectedImage.width(),myExpectedImage.height() ),myExpectedImage.logicalDpiX() ); 
   QTime myTime;
   myTime.start();
   mpMapRenderer->render( &myPainter );



More information about the QGIS-commit mailing list