libdballe 9.6
Public Member Functions | Public Attributes | List of all members
dballe::LonRange Struct Reference

Range of longitudes. More...

#include <types.h>

Public Member Functions

 LonRange ()=default
 Construct a range that matches any longitude.
 
 LonRange (int min, int max)
 Construct a range given integer extremes.
 
 LonRange (double min, double max)
 Construct a range given extremes in degrees.
 
bool operator== (const LonRange &lr) const
 
bool operator!= (const LonRange &lr) const
 
bool is_missing () const
 Return true if the LonRange matches any longitude.
 
double dmin () const
 Get the lower extreme as double, or -180.0 if missing.
 
double dmax () const
 Get the upper extreme as double, or 180.0 if missing.
 
void get (double &min, double &max) const
 Get the extremes in degrees.
 
void set (int min, int max)
 Set the extremes as integers, throwing an error in case of open ended ranges.
 
void set (double min, double max)
 Set the extremes in degrees, throwing an error in case of open ended ranges.
 
void set (const LonRange &lr)
 Set from another LonRange, throwing an error in case of open ended ranges.
 
bool contains (int lon) const
 Check if a point is inside this range (extremes included)
 
bool contains (double lon) const
 Check if a point is inside this range (extremes included)
 
bool contains (const LonRange &lr) const
 Check if a range is inside this range (extremes included)
 
int print (FILE *out, const char *end="\n") const
 Print the LonRange to a FILE*.
 

Public Attributes

int imin = MISSING_INT
 Initial point of the longitude range.
 
int imax = MISSING_INT
 Final point of the longitude range.
 

Detailed Description

Range of longitudes.

When given as an integer, a longitude value is intended in 1/100000 of a degree, which is the maximum resolution supported by DB-All.e.

When given as a double a longitude value is intended to be in degrees.

Longitude values are normalized between -180.0 and 180.0. The range is the angle that goes from imin to imax. Both extremes are considered part of the range.

A range that matches any longitude has both imin and imax set to MISSING_INT.

Invariant: if imin == MISSING_INT, then imax == MISSING_INT. An open-ended longitude range makes no sense, since longitudes move alongide a closed circle.

Member Function Documentation

◆ get()

void dballe::LonRange::get ( double &  min,
double &  max 
) const

Get the extremes in degrees.

If is_missing() == true, it returns the values -180.0 and 180.0

◆ print()

int dballe::LonRange::print ( FILE *  out,
const char *  end = "\n" 
) const

Print the LonRange to a FILE*.

Parameters
outThe output stream
endString to print after the Station

The documentation for this struct was generated from the following file: