xapian-core  1.4.21
Public Member Functions | Private Attributes | List of all members
GeoEncode::DecoderWithBoundingBox Class Reference

A class for decoding coordinates within a bounding box. More...

#include <geoencode.h>

Public Member Functions

 DecoderWithBoundingBox (double lat1, double lon1, double lat2, double lon2)
 Create a decoder with a bounding box. More...
 
bool decode (const std::string &value, double &lat_ref, double &lon_ref) const
 Decode a coordinate. More...
 

Private Attributes

double lon1
 Longitude at western edge of bounding box. More...
 
double lon2
 Longitude at eastern edge of bounding box. More...
 
double min_lat
 Minimum latitude in bounding box. More...
 
double max_lat
 Maximum latitude in bounding box. More...
 
unsigned char start1
 First byte of encoded form of coordinates with lon1. More...
 
unsigned char start2
 First byte of encoded form of coordinates with lon2. More...
 
bool include_poles
 True if either of the poles are included in the range. More...
 
bool discontinuous_longitude_range
 Flag; true if the longitude range is discontinuous (ie, goes over the boundary at which longitudes wrap from 360 to 0). More...
 

Detailed Description

A class for decoding coordinates within a bounding box.

This class aborts decoding if it is easily able to determine that the encoded coordinate supplied is outside the bounding box, avoiding some unnecessary work.

Definition at line 91 of file geoencode.h.

Constructor & Destructor Documentation

◆ DecoderWithBoundingBox()

GeoEncode::DecoderWithBoundingBox::DecoderWithBoundingBox ( double  lat1,
double  lon1,
double  lat2,
double  lon2 
)

Create a decoder with a bounding box.

The decoder will decode any encoded coordinates which lie inside the bounding box, and return false for any which lie outside the bounding box.

Parameters
lat1The latitude of the southern edge of the bounding box.
lon1The longitude of the western edge of the bounding box.
lat2The latitude of the northern edge of the bounding box.
lon2The longitude of the eastern edge of the bounding box.

Definition at line 190 of file geoencode.cc.

References calc_latlon_16ths().

Referenced by calc_latlon_16ths().

Member Function Documentation

◆ decode()

bool GeoEncode::DecoderWithBoundingBox::decode ( const std::string &  value,
double &  lat_ref,
double &  lon_ref 
) const

Decode a coordinate.

Parameters
valueThe coordinate to decode.
lat_refA reference to a value to return the latitude in.
lon_refA reference to a value to return the longitude in.
Returns
true if the coordinate was in the bounding box (in which case, result will have been updated to contain the coordinate), or false if the coordinate is outside the bounding box.

Note; if this returns false, the values of lat_ref and lon_ref may not have been updated, or may have been updated to incorrect values, due to aborting decoding of the coordinate part-way through.

Definition at line 226 of file geoencode.cc.

References GeoEncode::decode().

Member Data Documentation

◆ discontinuous_longitude_range

bool GeoEncode::DecoderWithBoundingBox::discontinuous_longitude_range
private

Flag; true if the longitude range is discontinuous (ie, goes over the boundary at which longitudes wrap from 360 to 0).

Definition at line 123 of file geoencode.h.

◆ include_poles

bool GeoEncode::DecoderWithBoundingBox::include_poles
private

True if either of the poles are included in the range.

Definition at line 118 of file geoencode.h.

◆ lon1

double GeoEncode::DecoderWithBoundingBox::lon1
private

Longitude at western edge of bounding box.

Definition at line 94 of file geoencode.h.

◆ lon2

double GeoEncode::DecoderWithBoundingBox::lon2
private

Longitude at eastern edge of bounding box.

Definition at line 98 of file geoencode.h.

◆ max_lat

double GeoEncode::DecoderWithBoundingBox::max_lat
private

Maximum latitude in bounding box.

Definition at line 106 of file geoencode.h.

◆ min_lat

double GeoEncode::DecoderWithBoundingBox::min_lat
private

Minimum latitude in bounding box.

Definition at line 102 of file geoencode.h.

◆ start1

unsigned char GeoEncode::DecoderWithBoundingBox::start1
private

First byte of encoded form of coordinates with lon1.

Definition at line 110 of file geoencode.h.

◆ start2

unsigned char GeoEncode::DecoderWithBoundingBox::start2
private

First byte of encoded form of coordinates with lon2.

Definition at line 114 of file geoencode.h.


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