Hi Oliver:
> > that's a valid point. The patch is in svn. You are cleaning up the OS X 
> > port right before the end of the year, don't you?

And some more stuff - add a static method to check if a proj4 coordinate 
definition is accepted by the lib, popping up a warning if not.  We might want 
to add a link (uri) to the proj4 docs in the message box.  Didn't add it 
everywhere where the wizard is used, as I first wanted to check back if you 
like the approach...

Last one for today - have fun at the 'New Year' party, see you next year,

Albrecht.
Index: src/CDlgProjWizzard.cpp
===================================================================
--- src/CDlgProjWizzard.cpp     (Revision 3148)
+++ src/CDlgProjWizzard.cpp     (Arbeitskopie)
@@ -19,6 +19,7 @@
 
 #include "CDlgProjWizzard.h"
 #include "mitab.h"
+#include <proj_api.h>
 
 #include <QtGui>
 
@@ -125,6 +126,21 @@
 
 void CDlgProjWizzard::accept()
 {
-    line.setText(labelResult->text());
-    QDialog::accept();
+    if (CDlgProjWizzard::validProjStr(labelResult->text())) {
+       line.setText(labelResult->text());
+       QDialog::accept();
+    }
 }
+
+bool CDlgProjWizzard::validProjStr(const QString projStr)
+{
+    projPJ projCheck = pj_init_plus(projStr.toUtf8().data());
+
+    if (!projCheck) {
+       QMessageBox::warning(0, tr("Error..."),tr("The value\n'%1'\nis not a 
valid coordinate system 
definition:\n%2").arg(projStr).arg(pj_strerrno(pj_errno)),QMessageBox::Abort,QMessageBox::Abort);
+       return false;
+    } else {
+       pj_free(projCheck);
+       return true;
+    }
+}
Index: src/CDlgSetupGrid.cpp
===================================================================
--- src/CDlgSetupGrid.cpp       (Revision 3148)
+++ src/CDlgSetupGrid.cpp       (Arbeitskopie)
@@ -52,10 +52,12 @@
 
 void CDlgSetupGrid::accept()
 {
-    QPalette palette = labelGridColor->palette();
-    CGridDB::self().setProjAndColor(lineProjection->text(), 
palette.color(labelGridColor->foregroundRole()));
+    if (CDlgProjWizzard::validProjStr(lineProjection->text())) {
+       QPalette palette = labelGridColor->palette();
+       CGridDB::self().setProjAndColor(lineProjection->text(), 
palette.color(labelGridColor->foregroundRole()));
 
-    QDialog::accept();
+       QDialog::accept();
+    }
 }
 
 void CDlgSetupGrid::slotProjWizard()
Index: src/CDlgProjWizzard.h
===================================================================
--- src/CDlgProjWizzard.h       (Revision 3148)
+++ src/CDlgProjWizzard.h       (Arbeitskopie)
@@ -31,6 +31,8 @@
     public:
         CDlgProjWizzard(QLineEdit& line, QWidget * parent);
         virtual ~CDlgProjWizzard();
+       
+       static bool validProjStr(const QString projStr);
 
     public slots:
         void accept();
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Qlandkartegt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qlandkartegt-users

Reply via email to