Improve warning of object in wrong bucket.

Reduce level to DEV_WARN from DEV_ALERT as it's
largely benign.
This commit is contained in:
Stuart Buchanan 2017-04-07 21:20:42 +01:00
parent fe87e7f60d
commit 9223f30f08

View File

@ -285,16 +285,13 @@ struct ReaderWriterSTG::_ModelBin {
void checkInsideBucket(const SGPath& absoluteFileName, float lon, float lat) { void checkInsideBucket(const SGPath& absoluteFileName, float lon, float lat) {
SGBucket bucket = bucketIndexFromFileName(absoluteFileName.file_base().c_str()); SGBucket bucket = bucketIndexFromFileName(absoluteFileName.file_base().c_str());
SGBucket correctBucket = SGBucket( SGGeod::fromDeg(lon, lat));
if ((lon > bucket.get_center_lon() + bucket.get_width()/2.0) || if (bucket != correctBucket) {
(lon < bucket.get_center_lon() - bucket.get_width()/2.0) || SG_LOG( SG_TERRAIN, SG_DEV_WARN, absoluteFileName
(lat > bucket.get_center_lat() + bucket.get_height()/2.0) || << ": Object at " << lon << ", " << lat <<
(lat < bucket.get_center_lat() - bucket.get_height()/2.0) ) " in incorrect bucket (" << bucket << ") - should be in " <<
{ correctBucket.gen_index_str() << " (" << correctBucket << ")");
SG_LOG( SG_TERRAIN, SG_DEV_ALERT, absoluteFileName
<< ": Object outside tile bounds " << lon << ", " << lat <<
"Center of tile: " << bucket.get_center_lon() << ", " <<
bucket.get_center_lat());
} }
} }
@ -462,9 +459,6 @@ struct ReaderWriterSTG::_ModelBin {
SG_LOG( SG_TERRAIN, SG_ALERT, absoluteFileName SG_LOG( SG_TERRAIN, SG_ALERT, absoluteFileName
<< ": Unknown token '" << token << "'" ); << ": Unknown token '" << token << "'" );
} }
} else {
SG_LOG( SG_TERRAIN, SG_ALERT, absoluteFileName
<< ": Unknown token '" << token << "'" );
} }
} }