RAVE
|
Wrapper around PROJ.4. More...
#include "projection.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <proj.h>
Classes | |
struct | _Projection_t |
Represents one projection. More... | |
Macros | |
#define | UV PJ_UV |
Functions | |
void | Projection_setDebugLevel (int debugPj) |
Sets the debug level when using proj API. | |
int | Projection_getDebugLevel (void) |
Returns the debug level when using proj API. | |
const char * | Projection_getProjVersion (void) |
Returns the currently used Proj version. | |
void | Projection_setDefaultLonLatProjDef (const char *projdef) |
Sets the default lon/lat proj definition to use. | |
const char * | Projection_getDefaultLonLatProjDef (void) |
Returns the default lonlat proj definition. | |
int | Projection_init (Projection_t *projection, const char *id, const char *description, const char *definition) |
Initializes a projection with the projection. | |
Projection_t * | Projection_create (const char *id, const char *description, const char *definition) |
Creates a projection directly. | |
Projection_t * | Projection_createDefaultLonLatProjection (void) |
Creates a default lon lat projection by using the default lonlat pcs definition. | |
const char * | Projection_getID (Projection_t *projection) |
Returns the ID for this projection. | |
const char * | Projection_getDescription (Projection_t *projection) |
Returns the description for this projection. | |
const char * | Projection_getDefinition (Projection_t *projection) |
Returns the definition for this projection. | |
int | Projection_isLatLong (Projection_t *projection) |
Returns if this projection is a latlong or not. | |
int | Projection_transform (Projection_t *projection, Projection_t *tgt, double *x, double *y, double *z) |
Transforms the coordinates in this projection into the target projection. | |
int | Projection_transformx (Projection_t *projection, Projection_t *tgt, double x, double y, double z, double *ox, double *oy, double *oz) |
This is an alternate version of Projection_transform. | |
int | Projection_inv (Projection_t *projection, double x, double y, double *lon, double *lat) |
Translates surface coordinate into lon/lat. | |
int | Projection_fwd (Projection_t *projection, double lon, double lat, double *x, double *y) |
Translates lon/lat coordinate into a surface coordinate. | |
Variables | |
RaveCoreObjectType | Projection_TYPE |
Type definition to use when creating a rave object. | |
Wrapper around PROJ.4.
Projection_t * Projection_create | ( | const char * | id, |
const char * | description, | ||
const char * | definition ) |
Creates a projection directly.
Like writing: Projection_t* p = RAVE_OBJECT_NEW(&Projection_TYPE); if (p != NULL) { if (!Projection_init(p, id, description, definition)) { RAVE_OBJECT_RELEASE(p); } }
[in] | id | - the id |
[in] | description | - the description |
[in] | definition | - the definition |
Projection_t * Projection_createDefaultLonLatProjection | ( | void | ) |
Creates a default lon lat projection by using the default lonlat pcs definition.
int Projection_fwd | ( | Projection_t * | projection, |
double | lon, | ||
double | lat, | ||
double * | x, | ||
double * | y ) |
Translates lon/lat coordinate into a surface coordinate.
[in] | projection | - the projection |
[in] | lon | - the longitude (in radians) |
[in] | lat | - the latitude (in radians) |
[out] | x | - the x coordinate |
[out] | y | - the y coordinate |
int Projection_getDebugLevel | ( | void | ) |
Returns the debug level when using proj API.
const char * Projection_getDefaultLonLatProjDef | ( | void | ) |
Returns the default lonlat proj definition.
const char * Projection_getDefinition | ( | Projection_t * | projection | ) |
Returns the definition for this projection.
[in] | projection | - the projection |
const char * Projection_getDescription | ( | Projection_t * | projection | ) |
Returns the description for this projection.
[in] | projection | - the projection |
const char * Projection_getID | ( | Projection_t * | projection | ) |
Returns the ID for this projection.
[in] | projection | - the projection |
const char * Projection_getProjVersion | ( | void | ) |
Returns the currently used Proj version.
int Projection_init | ( | Projection_t * | projection, |
const char * | id, | ||
const char * | description, | ||
const char * | definition ) |
Initializes a projection with the projection.
int Projection_inv | ( | Projection_t * | projection, |
double | x, | ||
double | y, | ||
double * | lon, | ||
double * | lat ) |
Translates surface coordinate into lon/lat.
[in] | projection | - the projection |
[in] | x | - the x coordinate |
[in] | y | - the y coordinate |
[out] | lon | - the longitude (in radians) |
[out] | lat | - the latitude (in radians) |
int Projection_isLatLong | ( | Projection_t * | projection | ) |
Returns if this projection is a latlong or not.
[in] | projection | - self |
void Projection_setDebugLevel | ( | int | debugPj | ) |
Sets the debug level when using proj API.
[in] | debugPj | - Value between 0 (NONE) to 3 (FULL) and 4 (TELL?) |
void Projection_setDefaultLonLatProjDef | ( | const char * | projdef | ) |
Sets the default lon/lat proj definition to use.
Default is '+proj=longlat +ellps=WGS84 +datum=WGS84'
[in] | projdef | - A proj string, not longer than 1023 chars |
int Projection_transform | ( | Projection_t * | projection, |
Projection_t * | tgt, | ||
double * | x, | ||
double * | y, | ||
double * | z ) |
Transforms the coordinates in this projection into the target projection.
[in] | projection | - this projection |
[in] | tgt | - target projection |
[in,out] | x | - coordinate |
[in,out] | y | - coordinate |
[in,out] | z | - coordinate (MAY BE NULL in some cases), see PROJ.4 |
[in] | projection | - the projection |
int Projection_transformx | ( | Projection_t * | projection, |
Projection_t * | tgt, | ||
double | x, | ||
double | y, | ||
double | z, | ||
double * | ox, | ||
double * | oy, | ||
double * | oz ) |
This is an alternate version of Projection_transform.
This function will set the output valuesin ox, oy and oz respectively. x/y and ox/oy are always required. Some projections requires the z values as well but that is not enforced by this function and is up to the user to manage properly. If oz == NULL, then the transform will atempt to project without the z value.
[in] | projection | - self |
[in] | tgt | - the target projection |
[in] | x | - coordinate |
[in] | y | - coordinate |
[in] | z | - coordinate |
[out] | ox | - coordinate |
[out] | oy | - coordinate |
[out] | oz | - coordinate |
RaveCoreObjectType Projection_TYPE |
Type definition to use when creating a rave object.