X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fbucket%2Fnewbucket.hxx;h=09169f860fd0435d8d8a60a5a185ac7842e4edfb;hb=f205e918d9e1df28da3df69c6c58df6b6391916f;hp=d3e8783af3372c34830ed901c6ce17129a739fe8;hpb=872db67f21e9f89bc4282e571d448a704f01d8e5;p=simgear.git diff --git a/simgear/bucket/newbucket.hxx b/simgear/bucket/newbucket.hxx index d3e8783a..09169f86 100644 --- a/simgear/bucket/newbucket.hxx +++ b/simgear/bucket/newbucket.hxx @@ -24,6 +24,11 @@ /** \file newbucket.hxx * A class and associated utiltity functions to manage world scenery tiling. + * + * Tile borders are aligned along circles of latitude and longitude. + * All tiles are 1/8 degree of latitude high and their width in degrees + * longitude depends on their latitude, adjusted in such a way that + * all tiles cover about the same amount of area of the earth surface. */ #ifndef _NEWBUCKET_HXX @@ -37,6 +42,7 @@ #include // sprintf() #include #include +#include /** * standard size of a bucket in degrees (1/8 of a degree) @@ -52,9 +58,7 @@ // return the horizontal tile span factor based on latitude static double sg_bucket_span( double l ) { if ( l >= 89.0 ) { - return 360.0; - } else if ( l >= 88.0 ) { - return 8.0; + return 12.0; } else if ( l >= 86.0 ) { return 4.0; } else if ( l >= 83.0 ) { @@ -75,12 +79,10 @@ static double sg_bucket_span( double l ) { return 1.0; } else if ( l >= -86.0 ) { return 2.0; - } else if ( l >= -88.0 ) { - return 4.0; } else if ( l >= -89.0 ) { - return 8.0; + return 4.0; } else { - return 360.0; + return 12.0; } } @@ -211,9 +213,9 @@ public: double span = sg_bucket_span( lat + y / 8.0 + SG_HALF_BUCKET_SPAN ); if ( span >= 1.0 ) { - return lon + span / 2.0; + return lon + get_width() / 2.0; } else { - return lon + x * span + span / 2.0; + return lon + x * span + get_width() / 2.0; } } @@ -321,6 +323,15 @@ SGBucket sgBucketOffset( double dlon, double dlat, int x, int y ); void sgBucketDiff( const SGBucket& b1, const SGBucket& b2, int *dx, int *dy ); +/** + * \relates SGBucket + * retrieve a list of buckets in the given bounding box + * @param min min lon,lat of bounding box in degrees + * @param max max lon,lat of bounding box in degrees + * @param list standard vector of buckets within the bounding box + */ +void sgGetBuckets( const SGGeod& min, const SGGeod& max, std::vector& list ); + /** * Write the bucket lon, lat, x, and y to the output stream. * @param out output stream @@ -329,7 +340,7 @@ void sgBucketDiff( const SGBucket& b1, const SGBucket& b2, int *dx, int *dy ); inline std::ostream& operator<< ( std::ostream& out, const SGBucket& b ) { - return out << b.lon << ":" << b.x << ", " << b.lat << ":" << b.y; + return out << b.lon << ":" << (int)b.x << ", " << b.lat << ":" << (int)b.y; }