Hi Gijs,
Ok, got my shopping done quickly, so could get back
to computer games quickly ;=))
Thanks for a prompt response. Have updated the source,
and for sure now see you 'protect' against a 'blank'
Line Width, and use "10", if no other user input...
Also note you now protect against 'spaces' in paths,
file names by encasing each/all in double quotes ;=))
this seems good...
AND I discovered why no 'ogr_decode' output! I had
skipped building ogr_decode due to its dependence on
GDAL libraries!
But have recently managed to build a massive static
libgdal.lib, but still doing some more testing on it
before returning to the TG suite, and adding ogr_decode,
and one other, poly2ogr...
I do not know if ogr_decode is better, worse or the same
as shape_decode, but as indicated shape_decode has no
dependence on a 3rd party library like GDAL, which indeed,
as I have recently discovered, does lots of 'research' based
on the file content to establish type, and thus attempts to
apply the correct 'dataset', not based solely on file
extensions...
As Ralf Gerlich 2007 source comments state, it is "loosely
based on shape-decode.cxx by Curtis L. Olsen", but on
reviewing the code a little more, it, like shape_decode,
uses external to it tg::makePolygon(...), and
tgChopNormalPolygon(...), etc to generate output, so to
that extent would have to be the same...
But that means there is no error check proc.start(args,...)
after it has run...
You could also check for the existence of the EXE...
There is no doubt should be some message, somewhere that
makes it clear _NOTHING_ was run ;=()
And in looking through some Qt posts saw where one person
had added the code switch :-
#ifdef Q_OS_WIN
command += ".exe";
#endif
which would make it easy to also check for 'existence',
and allow a critical message to be displayed, like -
QMessageBox::critical(this, tr("NO EXE FILE"),...
There is an alternative start(QString & program,
QStringList & arguments, OpenMode mode = ReadWrite);
but while it seems both forms have no 'return' - void -
you can check on how it ended, like say proc->atEnd(),
to also help output a messages about what happened...
So messing with these ideas, produced the attached
patch, to check if the EXE exists... it works for me ;=))
Will be a few days before I can complete the TGSuite
with my new GDAL library... and continue this exploration...
HTH,
Regards,
Geoff.
attached: diff-01.txt
diff -ur C:\FGCVS\terrageargui\mainwindow.cpp C:\FG\29\terrageargui\mainwindow.cpp
--- C:\FGCVS\terrageargui\mainwindow.cpp Tue Apr 26 18:25:41 2011
+++ C:\FG\29\terrageargui\mainwindow.cpp Tue Apr 26 20:17:21 2011
@@ -513,9 +513,18 @@
if ((ui->tblShapesAlign->item(i, 1) == 0) || (ui->tblShapesAlign->item(i, 1)->text().length() == 0)) continue;
QString shapefile = ui->tblShapesAlign->item(i, 1)->text();
- QString arguments = "\""+terragearDirectory+"/ogr-decode\" ";
-
- arguments += "--line-width "+lineWidth+" ";
+ QString arguments = "\""+terragearDirectory+"/ogr-decode";
+#ifdef Q_OS_WIN
+ arguments += ".exe";
+#endif
+ arguments += "\"";
+ QFile f(arguments);
+ if ( ! f.exists() ) {
+ QString msg = "Unable to locate executable ["+arguments+"]";
+ QMessageBox::critical(this,"ERROR: NO FILE", msg);
+ return;
+ }
+ arguments += " --line-width "+lineWidth+" ";
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel