head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.35; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.50; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.53.58; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.21.54; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# SGBucket Class Reference

A class to manage world scenery tiling. More...

`#include <newbucket.hxx>`

List of all members.

## Public Methods
| SGBucket ()
| Default constructor.
| SGBucket (const double dlon, const double dlat)
| Construct a bucket given a specific location.
| SGBucket (const bool is_good)
| Construct a bucket.
| SGBucket (const long int bindex)
| Construct a bucket given a unique bucket index number.
| ~SGBucket ()
| Default destructor.
void | set_bucket (double dlon, double dlat)
| Reset a bucket to represent a new lat and lon.
void | set_bucket (double *lonlat)
| Reset a bucket to represent a new lat and lon.
void | make_bad ()
| Create an impossible bucket.
long int | gen_index () const
| Generate the unique scenery tile index for this bucket.
string | gen_index_str () const
| Generate the unique scenery tile index for this bucket in ascii string form.
string | gen_base_path () const
| Build the base path name for this bucket.
double | get_center_lon () const
double | get_center_lat () const
double | get_width () const
double | get_height () const
double | get_width_m () const
double | get_height_m () const
int | get_lon () const
int | get_lat () const
int | get_x () const
int | get_y () const
## Friends
ostream & | operator<< (ostream &, const SGBucket &)
| Write the bucket lon, lat, x, and y to the output stream.
bool | operator== (const SGBucket &, const SGBucket &)
| Compare two bucket structures for equality.
## Related Functions
(Note that these are not member functions.)
SGBucket | sgBucketOffset (double dlon, double dlat, int x, int y)
| Return the bucket which is offset from the specified dlon, dlat by the specified tile units in the X & Y direction.
void | sgBucketDiff (const SGBucket &b1, const SGBucket &b2, int *dx, int *dy)
| Calculate the offset between two buckets (in quantity of buckets).

## Detailed Description

A class to manage world scenery tiling.

This class encapsulates the world tiling scheme. It provides ways to calculate a unique tile index from a lat/lon, and it can provide information such as the dimensions of a given tile.

Definition at line 117 of file newbucket.hxx.

## Constructor & Destructor Documentation

SGBucket::SGBucket | ( | const double | dlon,
|  | const double | dlat
| ) |

  | Construct a bucket given a specific location. Parameters:
  dlon | longitude specified in degrees
  dlat | latitude specified in degrees
Definition at line 40 of file newbucket.cxx. References set_bucket().

SGBucket::SGBucket | ( | const bool | is_good | ) |

  | Construct a bucket. Parameters:
  is_good | if false, create an invalid bucket. This is useful * if you are comparing cur_bucket to last_bucket and you want to * make sure last_bucket starts out as something impossible.
Definition at line 46 of file newbucket.cxx. References set_bucket().

SGBucket::SGBucket | ( | const long int | bindex | ) |

  | Construct a bucket given a unique bucket index number. Parameters:
  bindex | unique bucket index
Definition at line 55 of file newbucket.cxx.

## Member Function Documentation

string SGBucket::gen_base_path | ( |  | ) | const

| Build the base path name for this bucket. Returns: base path in string form Definition at line 136 of file newbucket.cxx. References SGPath::str(). Referenced by SGBinObject::write_ascii(), and SGBinObject::write_bin().

long int SGBucket::gen_index | ( |  | ) | const`[inline]`

| Generate the unique scenery tile index for this bucket. The index is constructed as follows: 9 bits - to represent 360 degrees of longitude (-180 to 179) 8 bits - to represent 180 degrees of latitude (-90 to 89) Each 1 degree by 1 degree tile is further broken down into an 8x8 grid. So we also need: 3 bits - to represent x (0 to 7) 3 bits - to represent y (0 to 7) Returns: tile index Definition at line 198 of file newbucket.hxx.

string SGBucket::gen_index_str | ( |  | ) | const`[inline]`

| Generate the unique scenery tile index for this bucket in ascii string form. Returns: tile index in string form Definition at line 207 of file newbucket.hxx.

double SGBucket::get_center_lat | ( |  | ) | const`[inline]`

| Returns: the center lat of a tile. Definition at line 236 of file newbucket.hxx. References SG_HALF_BUCKET_SPAN. Referenced by get_width(), get_width_m(), sgBucketDiff(), and sgBucketOffset().

double SGBucket::get_center_lon | ( |  | ) | const`[inline]`

| Returns: the center lon of a tile. Definition at line 223 of file newbucket.hxx. References SG_HALF_BUCKET_SPAN. Referenced by sgBucketDiff().

double SGBucket::get_height | ( |  | ) | const

| Returns: the height of the tile in degrees. Definition at line 191 of file newbucket.cxx. References SG_BUCKET_SPAN.

double SGBucket::get_height_m | ( |  | ) | const

| Returns: the height of the tile in meters. Definition at line 215 of file newbucket.cxx. References SG_BUCKET_SPAN, and SG_EQUATORIAL_RADIUS_M.

int SGBucket::get_lat | ( |  | ) | const`[inline]`

| Returns: the lat of the lower left corner of this tile. Definition at line 270 of file newbucket.hxx.

int SGBucket::get_lon | ( |  | ) | const`[inline]`

| Returns: the lon of the lower left corner of this tile. Definition at line 265 of file newbucket.hxx.

double SGBucket::get_width | ( |  | ) | const

| Returns: the width of the tile in degrees. Definition at line 185 of file newbucket.cxx. References get_center_lat().

double SGBucket::get_width_m | ( |  | ) | const

| Returns: the width of the tile in meters. Definition at line 197 of file newbucket.cxx. References get_center_lat(), and SG_EQUATORIAL_RADIUS_M.

int SGBucket::get_x | ( |  | ) | const`[inline]`

| Returns: the x coord within the 1x1 degree chunk this tile. Definition at line 275 of file newbucket.hxx.

int SGBucket::get_y | ( |  | ) | const`[inline]`

| Returns: the y coord within the 1x1 degree chunk this tile. Definition at line 280 of file newbucket.hxx.

void SGBucket::make_bad | ( |  | ) | `[inline]`

| Create an impossible bucket. This is useful if you are comparing cur_bucket to last_bucket and you want to make sure last_bucket starts out as something impossible. Definition at line 178 of file newbucket.hxx. References set_bucket().

void SGBucket::set_bucket | ( | double * | lonlat | ) |

  | Reset a bucket to represent a new lat and lon. Parameters:
  lonlat | an array of double[2] holding lon and lat (specified) in degrees
Definition at line 79 of file newbucket.cxx. References set_bucket().

void SGBucket::set_bucket | ( | double | dlon,
|  | double | dlat
| ) |

  | Reset a bucket to represent a new lat and lon. Parameters:
  dlon | longitude specified in degrees
  dlat | latitude specified in degrees
Definition at line 85 of file newbucket.cxx. References SG_EPSILON. Referenced by make_bad(), set_bucket(), SGBucket(), and sgBucketOffset().

## Friends And Related Function Documentation

ostream& operator<< | ( | ostream & | ,
|  | const SGBucket & |
| ) | `[friend]`

  | Write the bucket lon, lat, x, and y to the output stream. Parameters:
  out | output stream
  b | bucket
Definition at line 319 of file newbucket.hxx.

bool operator== | ( | const SGBucket & | ,
|  | const SGBucket & |
| ) | `[friend]`

  | Compare two bucket structures for equality. Parameters:
  b1 | bucket 1
  b2 | bucket 2
Returns: comparison result Definition at line 332 of file newbucket.hxx.

void sgBucketDiff | ( | const SGBucket & | b1,
|  | const SGBucket & | b2,
|  | int * | dx,
|  | int * | dy
| ) | `[related]`

  | Calculate the offset between two buckets (in quantity of buckets). Parameters:
  b1 | bucket 1
  b2 | bucket 2
  dx | offset distance (lon) in tile units
  dy | offset distance (lat) in tile units
Definition at line 252 of file newbucket.cxx. References get_center_lat(), get_center_lon(), and SG_BUCKET_SPAN.

SGBucket sgBucketOffset | ( | double | dlon,
|  | double | dlat,
|  | int | x,
|  | int | y
| ) | `[related]`

  | Return the bucket which is offset from the specified dlon, dlat by the specified tile units in the X & Y direction. Parameters:
  dlon | starting lon in degrees
  dlat | starting lat in degrees
  x | number of bucket units to offset in x (lon) direction
  y | number of bucket units to offset in y (lat) direction
Returns: offset bucket Definition at line 227 of file newbucket.cxx. References get_center_lat(), set_bucket(), and SG_BUCKET_SPAN.

The documentation for this class was generated from the following files:

- newbucket.hxx
- newbucket.cxx

@ 1.3 log @Oops, try again. @ text @d1023 1 a1023 1