Optionally deprecate parts of SGBucket
When NO_DEPRECATED_API is set, remove portions of the SGBucket API.
This commit is contained in:
parent
3c4c05fb3e
commit
b4f4ef9c5b
@ -64,10 +64,13 @@ void SGBucket::make_bad()
|
|||||||
lat = -1000;
|
lat = -1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_DEPRECATED_API
|
||||||
|
|
||||||
// constructor for specified location
|
// constructor for specified location
|
||||||
SGBucket::SGBucket(const double dlon, const double dlat) {
|
SGBucket::SGBucket(const double dlon, const double dlat) {
|
||||||
set_bucket(dlon, dlat);
|
set_bucket(dlon, dlat);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SGBucket::SGBucket(const SGGeod& geod) {
|
SGBucket::SGBucket(const SGGeod& geod) {
|
||||||
set_bucket(geod.getLongitudeDeg(),
|
set_bucket(geod.getLongitudeDeg(),
|
||||||
@ -107,8 +110,23 @@ static int floorWithEpsilon(double x)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the bucket params for the specified lat and lon
|
#ifndef NO_DEPRECATED_API
|
||||||
|
|
||||||
void SGBucket::set_bucket(double dlon, double dlat)
|
void SGBucket::set_bucket(double dlon, double dlat)
|
||||||
|
{
|
||||||
|
innerSet(dlon, dlat);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SGBucket::set_bucket(const SGGeod& geod)
|
||||||
|
{
|
||||||
|
innerSet(geod.getLongitudeDeg(), geod.getLatitudeDeg());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Set the bucket params for the specified lat and lon
|
||||||
|
void SGBucket::innerSet( double dlon, double dlat )
|
||||||
{
|
{
|
||||||
if ((dlon < -180.0) || (dlon >= 180.0)) {
|
if ((dlon < -180.0) || (dlon >= 180.0)) {
|
||||||
SG_LOG(SG_TERRAIN, SG_WARN, "SGBucket::set_bucket: passed longitude:" << dlon);
|
SG_LOG(SG_TERRAIN, SG_WARN, "SGBucket::set_bucket: passed longitude:" << dlon);
|
||||||
@ -171,11 +189,6 @@ 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
|
// Build the path name for this bucket
|
||||||
std::string SGBucket::gen_base_path() const {
|
std::string SGBucket::gen_base_path() const {
|
||||||
// long int index;
|
// long int index;
|
||||||
@ -297,7 +310,10 @@ SGBucket SGBucket::sibling(int dx, int dy) const
|
|||||||
|
|
||||||
double tmp = get_center_lon() + dx * span;
|
double tmp = get_center_lon() + dx * span;
|
||||||
tmp = SGMiscd::normalizePeriodic(-180.0, 180.0, tmp);
|
tmp = SGMiscd::normalizePeriodic(-180.0, 180.0, tmp);
|
||||||
return SGBucket(tmp, clat);
|
|
||||||
|
SGBucket b;
|
||||||
|
b.innerSet(tmp, clat);
|
||||||
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SGBucket::gen_index_str() const
|
std::string SGBucket::gen_index_str() const
|
||||||
@ -309,6 +325,7 @@ std::string SGBucket::gen_index_str() const
|
|||||||
return (std::string)tmp;
|
return (std::string)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_DEPRECATED_API
|
||||||
// find the bucket which is offset by the specified tile units in the
|
// find the bucket which is offset by the specified tile units in the
|
||||||
// X & Y direction. We need the current lon and lat to resolve
|
// X & Y direction. We need the current lon and lat to resolve
|
||||||
// ambiguities when going from a wider tile to a narrower one above or
|
// ambiguities when going from a wider tile to a narrower one above or
|
||||||
@ -335,7 +352,7 @@ SGBucket sgBucketOffset( double dlon, double dlat, int dx, int dy ) {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// calculate the offset between two buckets
|
// calculate the offset between two buckets
|
||||||
void sgBucketDiff( const SGBucket& b1, const SGBucket& b2, int *dx, int *dy ) {
|
void sgBucketDiff( const SGBucket& b1, const SGBucket& b2, int *dx, int *dy ) {
|
||||||
@ -400,7 +417,7 @@ void sgGetBuckets( const SGGeod& min, const SGGeod& max, std::vector<SGBucket>&
|
|||||||
span = sg_bucket_span( lat );
|
span = sg_bucket_span( lat );
|
||||||
for (lon = min.getLongitudeDeg(); lon <= max.getLongitudeDeg(); lon += span)
|
for (lon = min.getLongitudeDeg(); lon <= max.getLongitudeDeg(); lon += span)
|
||||||
{
|
{
|
||||||
SGBucket b(lon, lat);
|
SGBucket b(SGGeod::fromDeg(lon, lat));
|
||||||
if (!b.isValid()) {
|
if (!b.isValid()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
// #define NO_DEPRECATED_API
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* standard size of a bucket in degrees (1/8 of a degree)
|
* standard size of a bucket in degrees (1/8 of a degree)
|
||||||
*/
|
*/
|
||||||
@ -101,6 +103,7 @@ private:
|
|||||||
unsigned char x; // x subdivision (0 to 7)
|
unsigned char x; // x subdivision (0 to 7)
|
||||||
unsigned char y; // y subdivision (0 to 7)
|
unsigned char y; // y subdivision (0 to 7)
|
||||||
|
|
||||||
|
void innerSet( double dlon, double dlat );
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,12 +116,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
|
#ifndef NO_DEPRECATED_API
|
||||||
/**
|
/**
|
||||||
* Construct a bucket given a specific location.
|
* Construct a bucket given a specific location.
|
||||||
* @param dlon longitude specified in degrees
|
* @param dlon longitude specified in degrees
|
||||||
* @param dlat latitude specified in degrees
|
* @param dlat latitude specified in degrees
|
||||||
*/
|
*/
|
||||||
SGBucket(const double dlon, const double dlat);
|
SGBucket(const double dlon, const double dlat);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a bucket given a specific location.
|
* Construct a bucket given a specific location.
|
||||||
@ -132,6 +137,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
SGBucket(const long int bindex);
|
SGBucket(const long int bindex);
|
||||||
|
|
||||||
|
#ifndef NO_DEPRECATED_API
|
||||||
/**
|
/**
|
||||||
* Reset a bucket to represent a new lat and lon
|
* Reset a bucket to represent a new lat and lon
|
||||||
* @param dlon longitude specified in degrees
|
* @param dlon longitude specified in degrees
|
||||||
@ -139,12 +145,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
void set_bucket(const SGGeod& geod);
|
void set_bucket(const SGGeod& geod);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset a bucket to represent a new lat and lon
|
* Reset a bucket to represent a new lat and lon
|
||||||
* @param dlon longitude specified in degrees
|
* @param dlon longitude specified in degrees
|
||||||
* @param dlat latitude specified in degrees
|
* @param dlat latitude specified in degrees
|
||||||
*/
|
*/
|
||||||
void set_bucket( double dlon, double dlat );
|
void set_bucket( double dlon, double dlat );
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an impossible bucket.
|
* Create an impossible bucket.
|
||||||
@ -290,7 +298,7 @@ inline bool operator!= (const SGBucket& lhs, const SGBucket& rhs)
|
|||||||
return !(lhs == rhs);
|
return !(lhs == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_DEPRECATED_API
|
||||||
/**
|
/**
|
||||||
* \relates SGBucket
|
* \relates SGBucket
|
||||||
* Return the bucket which is offset from the specified dlon, dlat by
|
* Return the bucket which is offset from the specified dlon, dlat by
|
||||||
@ -302,6 +310,7 @@ inline bool operator!= (const SGBucket& lhs, const SGBucket& rhs)
|
|||||||
* @return offset bucket
|
* @return offset bucket
|
||||||
*/
|
*/
|
||||||
SGBucket sgBucketOffset( double dlon, double dlat, int x, int y );
|
SGBucket sgBucketOffset( double dlon, double dlat, int x, int y );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user