VAPoR  0.1
Public Member Functions | List of all members
VAPoR::Proj4API Class Reference

Wrapper for proj4 C API. More...

#include <Proj4API.h>

Inheritance diagram for VAPoR::Proj4API:
VetsUtil::MyBase

Public Member Functions

 Proj4API ()
 
 ~Proj4API ()
 
int Initialize (string srcdef, string dstdef)
 
int Transform (double *x, double *y, size_t n, int offset=1) const
 
int Transform (double *x, double *y, double *z, size_t n, int offset=1) const
 
int Transform (float *x, float *y, size_t n, int offset=1) const
 
int Transform (float *x, float *y, float *z, size_t n, int offset=1) const
 
bool IsLatLonSrc () const
 
bool IsLatLonDst () const
 
bool IsGeocentSrc () const
 
bool IsGeocentDst () const
 
string GetSrcStr () const
 Return the current source projection definition string. More...
 
string GetDstStr () const
 Return the current destination projection definition string. More...
 
string ProjErr () const
 
void Clamp (double *x, double *y, size_t n, int offset) const
 
- Public Member Functions inherited from VetsUtil::MyBase
 MyBase ()
 
const string & getClassName () const
 

Additional Inherited Members

- Public Types inherited from VetsUtil::MyBase
typedef void(* ErrMsgCB_T) (const char *msg, int err_code)
 
typedef void(* DiagMsgCB_T) (const char *msg)
 
- Static Public Member Functions inherited from VetsUtil::MyBase
static void SetErrMsg (const char *format,...)
 Record a formatted error message. More...
 
static void SetErrMsg (int errcode, const char *format,...)
 Record a formatted error message and an error code. More...
 
static const char * GetErrMsg ()
 
static void SetErrCode (int err_code)
 Record an error code. More...
 
static int GetErrCode ()
 Retrieve the current error code. More...
 
static void SetErrMsgCB (ErrMsgCB_T cb)
 
static ErrMsgCB_T GetErrMsgCB ()
 
static void SetErrMsgFilePtr (FILE *fp)
 
static const FILE * SetErrMsgFilePtr ()
 
static void SetDiagMsg (const char *format,...)
 Record a formatted diagnostic message. More...
 
static const char * GetDiagMsg ()
 
static void SetDiagMsgCB (DiagMsgCB_T cb)
 
static DiagMsgCB_T GetDiagMsgCB ()
 
static void SetDiagMsgFilePtr (FILE *fp)
 
static bool EnableErrMsg (bool enable)
 
- Static Public Attributes inherited from VetsUtil::MyBase
static char * ErrMsg
 
static int ErrCode
 
static int ErrMsgSize
 
static FILE * ErrMsgFilePtr
 
static ErrMsgCB_T ErrMsgCB
 
static char * DiagMsg
 
static int DiagMsgSize
 
static FILE * DiagMsgFilePtr
 
static DiagMsgCB_T DiagMsgCB
 
static bool Enabled
 
- Protected Member Functions inherited from VetsUtil::MyBase
void SetClassName (const string &name)
 

Detailed Description

Wrapper for proj4 C API.

Author
John Clyne

This class provides a convience wrapper for the proj4 Cartographic Projections Library http://trac.osgeo.org/proj/

Definition at line 17 of file Proj4API.h.

Constructor & Destructor Documentation

VAPoR::Proj4API::Proj4API ( )
VAPoR::Proj4API::~Proj4API ( )

Member Function Documentation

void VAPoR::Proj4API::Clamp ( double *  x,
double *  y,
size_t  n,
int  offset 
) const

Clamp the input values to bounds permitted by the source projection. If the source projection is not recognized the method is a no-op

string VAPoR::Proj4API::GetDstStr ( ) const

Return the current destination projection definition string.

string VAPoR::Proj4API::GetSrcStr ( ) const

Return the current source projection definition string.

int VAPoR::Proj4API::Initialize ( string  srcdef,
string  dstdef 
)

Initialize the class

Initializes the class with source and destination proj4 transformation strings.

Parameters
[in]srcdefThe source proj4 transformation definition. If empty, the string "+proj=latlong" is used.
[in]dstdefThe destintation proj4 transformation definition. If empty, the string "+proj=latlong" is used.
Return values
statusRetruns a negative int on failure
See also
pj_init_plus()
bool VAPoR::Proj4API::IsGeocentDst ( ) const
bool VAPoR::Proj4API::IsGeocentSrc ( ) const
bool VAPoR::Proj4API::IsLatLonDst ( ) const

Return true of destination projection definition is lat-long

This method returns true iff the destination projection definition is geographic (i.e. +proj=latlong). If true, subsequent transforms will return output values in geographic coordinates (i.e. degrees) False is returned otherwise

See also
Initialize(), pj_is_latlong()
bool VAPoR::Proj4API::IsLatLonSrc ( ) const

Return true of source projection definition is lat-long

This method returns true iff the source projection definition is geographic (i.e. +proj=latlong). If true, subsequent transforms expect input values to be in geographic coordinates (i.e. degrees) False is returned otherwise

See also
Initialize(), pj_is_latlong()
string VAPoR::Proj4API::ProjErr ( ) const

Return the error string generated by the proj4 C API for the most recent error

See also
pj_strerrno()
int VAPoR::Proj4API::Transform ( double *  x,
double *  y,
size_t  n,
int  offset = 1 
) const

Transform coordinates

Transforms coordinates based on defintions of the source and destination proj4 transformation definitions passed to Initialize(). Transformations are performed between Geographic coordinates (latitude and longitude) and Cartographic coordinates (Cartesian) as specified by the transformation definitions. Cartographic coordinates are referred to as the Projection Coordinate System (PCS). Default units for the PCS are meters on the ground. Geographic coordinates are always in degrees.

Note
As with the proj4 C library the transformations are performed in place, modifiying the input values
Parameters
[in,out]xarray of longitudes or PCS X values
[in,out]yarray of latitudes or PCS Y values
[in]nnum elements in x, y, and z
[in]offsetOffset between adjacent values in the input and output arrays.
Return values
statusRetruns a negative int on failure
See also
Initialize(), pj_transform()
int VAPoR::Proj4API::Transform ( double *  x,
double *  y,
double *  z,
size_t  n,
int  offset = 1 
) const
int VAPoR::Proj4API::Transform ( float *  x,
float *  y,
size_t  n,
int  offset = 1 
) const
int VAPoR::Proj4API::Transform ( float *  x,
float *  y,
float *  z,
size_t  n,
int  offset = 1 
) const

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