1
0
Fork 0

warning cleanup and final checks - TNCM, EKNB, and LIMJ all look good

This commit is contained in:
Peter Sadrozinski 2014-01-23 18:17:43 -05:00
parent c5d6c20998
commit 9bf7357297
12 changed files with 97 additions and 66 deletions

View file

@ -99,9 +99,12 @@ void TGConstruct::AddCustomObjects( void ) {
string command = "cp " + basecom + " " + dest_dir;
#endif
SG_LOG( SG_GENERAL, SG_DEBUG, "running " << command );
system( command.c_str() );
fprintf(fp, "OBJECT %s\n", name);
if ( system( command.c_str() ) != -1 ) {
fprintf(fp, "OBJECT %s\n", name);
} else {
SG_LOG( SG_GENERAL, SG_ALERT, "Could not issue command " << command );
}
} else {
fprintf(fp, "%s\n", line);
}

View file

@ -277,27 +277,31 @@ bool construct_tile( const SGBucket& b,
command = command + " > " + result_file + " 2>&1";
cout << command << endl;
system( command.c_str() );
FILE *fp = fopen( result_file.c_str(), "r" );
if ( fp == NULL) {
cout << "Missing results file " << result_file << endl;
return false;
}
char line[256];
while ( fgets( line, 256, fp ) != NULL ) {
string line_str = line;
line_str = line_str.substr(0, line_str.length() - 1);
// cout << line_str << endl;
if ( line_str == "[Finished successfully]" ) {
cout << "Tile " << b.gen_index_str() << " finished successfully" << endl;
fclose(fp);
return true;
if ( system( command.c_str() ) != -1 ) {
FILE *fp = fopen( result_file.c_str(), "r" );
if ( fp == NULL) {
cout << "Missing results file " << result_file << endl;
return false;
} else {
char line[256];
while ( fgets( line, 256, fp ) != NULL ) {
string line_str = line;
line_str = line_str.substr(0, line_str.length() - 1);
// cout << line_str << endl;
if ( line_str == "[Finished successfully]" ) {
cout << "Tile " << b.gen_index_str() << " finished successfully" << endl;
fclose(fp);
return true;
}
}
fclose(fp);
}
} else {
cout << "Could not issue command " << command << endl;
return false;
}
fclose(fp);
// Save the log file of the failed tile
cout << "Tile " << b.gen_index_str() << " failed" << endl;
string savelog=work_base+"/Status/failed-"+b.gen_index_str()+".log";
@ -305,8 +309,11 @@ bool construct_tile( const SGBucket& b,
command="mv "+result_file+" " +savelog;
cout << command << endl;
system(command.c_str());
if ( system(command.c_str()) == -1 ) {
cout << "Could not issue command " << command << endl;
return false;
}
return false;
}

View file

@ -267,7 +267,9 @@ void log_pending_tile( const string& path, long int tile ) {
string pending_file = path + "/" + b.gen_index_str() + ".pending";
string command = "touch " + pending_file;
system( command.c_str() );
if ( system( command.c_str() ) == -1 ) {
cout << "Could not issue command " << command << endl;
}
}
@ -288,7 +290,10 @@ void log_failed_tile( const string& path, long int tile ) {
string failed_file = path + "/" + b.gen_index_str() + ".failed";
string command = "touch " + failed_file;
system( command.c_str() );
if ( system( command.c_str() ) == -1 ) {
cout << "Could not issue command " << command << endl;
}
cout << "logged bad tile = " << tile << endl;
}

View file

@ -187,8 +187,8 @@ TGDem::read_a_record() {
// Map projection parameters (ignored)
for ( i = 0; i < 15; i++ ) {
dnum = next_exp();
// printf("%d: %f\n",i,dnum);
dnum = next_exp();
SG_LOG(SG_GENERAL, SG_DEBUG, i << ": " << dnum);
}
// Units code, 3 represents arc-seconds as the unit of measure for

View file

@ -40,11 +40,13 @@
# include <direct.h>
#endif
#include <boost/foreach.hpp>
#include <simgear/constants.h>
#include <simgear/io/lowlevel.hxx>
#include <simgear/misc/sg_dir.hxx>
#include <simgear/debug/logstream.hxx>
#include <boost/foreach.hpp>
#include "hgt.hxx"
@ -92,19 +94,23 @@ TGHgt::open ( const SGPath &f ) {
cout << "Extracting " << file_name.str() << " to " << tmp_dir.path().str() << endl;
string command = "unzip -d \"" + tmp_dir.path().str() + "\" " + file_name.base();
system( command.c_str() );
simgear::PathList files = tmp_dir.children(simgear::Dir::TYPE_FILE | simgear::Dir::NO_DOT_OR_DOTDOT);
BOOST_FOREACH(const SGPath& file, files) {
string ext = file.lower_extension();
if ( ext == "hgt" ) {
file_name = file;
break;
if ( system( command.c_str() ) != -1 )
{
simgear::PathList files = tmp_dir.children(simgear::Dir::TYPE_FILE | simgear::Dir::NO_DOT_OR_DOTDOT);
BOOST_FOREACH(const SGPath& file, files) {
string ext = file.lower_extension();
if ( ext == "hgt" ) {
file_name = file;
break;
}
}
}
remove_tmp_file = true;
cout << "Proceeding with " << file_name.str() << endl;
remove_tmp_file = true;
cout << "Proceeding with " << file_name.str() << endl;
} else {
SG_LOG(SG_GENERAL, SG_ALERT, "Failed to issue system call " << command );
exit(1);
}
}
cout << "Loading HGT data file: " << file_name.str() << endl;

View file

@ -154,7 +154,12 @@ long int tgChopper::GenerateIndex( std::string path )
exit( 0 );
}
} else {
fread( (void*)&index, sizeof(long int), 1, fp );
if ( fread( (void*)&index, sizeof(long int), 1, fp ) != 1 )
{
SG_LOG(SG_GENERAL, SG_ALERT, "Error reading Index file " << index_file << " abort");
boost::interprocess::named_mutex::remove("tgChopper_index2");
exit(0);
}
}
index++;

View file

@ -10,13 +10,8 @@
const double isEqual2D_Epsilon = 0.000001;
#if 0
#define CLIPPER_FIXEDPT (1000000000000)
#define CLIPPER_METERS_PER_DEGREE (111000)
#else
#define CLIPPER_FIXEDPT (10000000000000000)
#define CLIPPER_METERS_PER_DEGREE (1110000000)
#endif
SGGeod SGGeod_snap( const SGGeod& in, double grid )
{
@ -369,16 +364,17 @@ bool intersection(const SGGeod &p0, const SGGeod &p1, const SGGeod& p2, const SG
Segment_2 seg2( a2, b2 );
CGAL::Object result = CGAL::intersection(seg1, seg2);
if (const CGAL::Point_2<Kernel> *ipoint = CGAL::object_cast<CGAL::Point_2<Kernel> >(&result)) {
const CGAL::Point_2<Kernel> *ipoint = CGAL::object_cast<CGAL::Point_2<Kernel> >(&result);
const CGAL::Segment_2<Kernel> *iseg = CGAL::object_cast<CGAL::Segment_2<Kernel> >(&result);
if (ipoint) {
// handle the point intersection case with *ipoint.
return true;
} else if (iseg ) {
// handle the segment intersection case with *iseg.
return true;
} else {
if (const CGAL::Segment_2<Kernel> *iseg = CGAL::object_cast<CGAL::Segment_2<Kernel> >(&result)) {
// handle the segment intersection case with *iseg.
return false;
} else {
// handle the no intersection case.
return false;
}
// handle the no intersection case.
return false;
}
}

View file

@ -148,15 +148,18 @@ bool TGSrtmTiff::open( const SGPath &f ) {
cout << "Extracting " << file_name.str() << " to " << tmp_dir.path().str() << endl;
string command = "unzip -d \"" + tmp_dir.path().str() + "\" " + file_name.base();
system( command.c_str() );
simgear::PathList files = tmp_dir.children(simgear::Dir::TYPE_FILE | simgear::Dir::NO_DOT_OR_DOTDOT);
BOOST_FOREACH(const SGPath& file, files) {
string ext = file.lower_extension();
if ( (ext == "tif") || (ext == "tiff") ) {
file_name = file;
break;
if ( system( command.c_str() ) != -1 ) {
simgear::PathList files = tmp_dir.children(simgear::Dir::TYPE_FILE | simgear::Dir::NO_DOT_OR_DOTDOT);
BOOST_FOREACH(const SGPath& file, files) {
string ext = file.lower_extension();
if ( (ext == "tif") || (ext == "tiff") ) {
file_name = file;
break;
}
}
} else {
SG_LOG(SG_GENERAL, SG_ALERT, "Failed to issue system call " << command );
exit(1);
}
remove_tmp_file = true;

View file

@ -68,7 +68,7 @@ protected:
public:
GreedySubdivision(Map *map);
~GreedySubdivision();
virtual ~GreedySubdivision();
array2<char> is_used;

View file

@ -21,6 +21,11 @@ public:
token = t;
reshape(e);
}
virtual ~Triangle()
{
}
Triangle *linkTo(Triangle *t) { next_face = t; return this; }
Triangle *getLink() { return next_face; }

View file

@ -74,8 +74,8 @@ inline int goal_not_met()
{
return
( mesh->maxError() > error_threshold &&
mesh->pointCount() < point_limit ) ||
mesh->pointCount() < min_points;
(int)mesh->pointCount() < point_limit ) ||
(int)mesh->pointCount() < min_points;
}

View file

@ -91,7 +91,8 @@ public:
}
depth=32;
}
virtual ~ArrayMap() {}
virtual Terra::real eval(int i, int j) {
return (Terra::real)array.get_array_elev(i,j);
}