X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fbucket%2Fnewbucket.cxx;h=119959039091e68cd7dcad37dcfd125aa7913371;hb=e8364a03bca45c9ed7f2d4779154ed3c72e32eec;hp=6a4b2ecb479ddb50d4d533d5730bb6cb7dc48391;hpb=4e7fe460a5c5c1b64dd1d540bc197dbb89614b7f;p=simgear.git diff --git a/simgear/bucket/newbucket.cxx b/simgear/bucket/newbucket.cxx index 6a4b2ecb..11995903 100644 --- a/simgear/bucket/newbucket.cxx +++ b/simgear/bucket/newbucket.cxx @@ -44,6 +44,9 @@ SGBucket::SGBucket(const double dlon, const double dlat) { set_bucket(dlon, dlat); } +SGBucket::SGBucket(const SGGeod& geod) { + set_bucket(geod); +} // create an impossible bucket if false SGBucket::SGBucket(const bool is_good) { @@ -73,11 +76,6 @@ SGBucket::SGBucket(const long int bindex) { } -// default destructor -SGBucket::~SGBucket() { -} - - // Set the bucket params for the specified lat and lon void SGBucket::set_bucket( double *lonlat ) { set_bucket( lonlat[0], lonlat[1] ); @@ -108,7 +106,7 @@ void SGBucket::set_bucket( double dlon, double dlat ) { } else if ( span <= 1.0 ) { x = (int)((dlon - lon) / span); } else { - if ( (dlon >= 0) || (fabs(diff) < SG_EPSILON) ) { + if ( dlon >= 0 ) { lon = (int)( (int)(lon / span) * span); } else { // cout << " lon = " << lon @@ -135,6 +133,11 @@ void SGBucket::set_bucket( double dlon, double dlat ) { } +void SGBucket::set_bucket(const SGGeod& geod) +{ + set_bucket(geod.getLongitudeDeg(), geod.getLatitudeDeg()); +} + // Build the path name for this bucket string SGBucket::gen_base_path() const { // long int index;