RAVE
projection_pipeline.c File Reference

Helper class to support both legacy PROJ.4 projection and > PROJ.4. More...

#include "projection_pipeline.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <proj.h>

Classes

struct  _ProjectionPipeline_t
 Represents one projection. More...
 

Macros

#define UV   PJ_UV
 

Functions

ProjectionPipeline_tProjectionPipeline_createPipeline (Projection_t *first, Projection_t *second)
 Creates a pipeline from one projection to another.
 
ProjectionPipeline_tProjectionPipeline_createPipelineFromDef (const char *first, const char *second)
 Creates a pipeline from one projection to another.
 
ProjectionPipeline_tProjectionPipeline_createDefaultLonLatPipeline (Projection_t *other)
 Creates a default pipeline used for translating between lon/lat and the other projection.
 
ProjectionPipeline_tProjectionPipeline_createDefaultLonLatPipelineFromDef (const char *other)
 Creates a default pipeline used for translating between lon/lat and the other projection where other is defined as a string.
 
int ProjectionPipeline_init (ProjectionPipeline_t *pipeline, Projection_t *first, Projection_t *second)
 Initializes a pipeline with the projections.
 
int ProjectionPipeline_initFromDef (ProjectionPipeline_t *pipeline, const char *first, const char *second)
 Initializes a pipeline with the projection definitions.
 
Projection_tProjectionPipeline_getFirstProjection (ProjectionPipeline_t *pipeline)
 Returns the first projection.
 
Projection_tProjectionPipeline_getSecondProjection (ProjectionPipeline_t *pipeline)
 Returns the second projection.
 
int ProjectionPipeline_fwd (ProjectionPipeline_t *pipeline, double inu, double inv, double *outu, double *outv)
 Transforms the coordinates from first projection to second projection using this pipeline.
 
int ProjectionPipeline_inv (ProjectionPipeline_t *pipeline, double inu, double inv, double *outu, double *outv)
 Transforms the coordinates from second projection to first projection using this pipeline.
 

Variables

RaveCoreObjectType ProjectionPipeline_TYPE
 Type definition to use when creating a rave object.
 

Detailed Description

Helper class to support both legacy PROJ.4 projection and > PROJ.4.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2021-10-14

Function Documentation

◆ ProjectionPipeline_createDefaultLonLatPipeline()

ProjectionPipeline_t * ProjectionPipeline_createDefaultLonLatPipeline ( Projection_t * other)

Creates a default pipeline used for translating between lon/lat and the other projection.

More or less same as writing: ProjectionPipeline_createPipeline(Projection_createDefaultLonLatProjection(), other)

Parameters
[in]other- the other projection
Returns
the pipeline on success otherwise NULL

◆ ProjectionPipeline_createDefaultLonLatPipelineFromDef()

ProjectionPipeline_t * ProjectionPipeline_createDefaultLonLatPipelineFromDef ( const char * other)

Creates a default pipeline used for translating between lon/lat and the other projection where other is defined as a string.

More or less same as writing: ProjectionPipeline_createPipelineFromDef(Projection_getDefaultLonLatProjDef(), other)

Parameters
[in]other- the other proj definition
Returns
the pipeline on success otherwise NULL

◆ ProjectionPipeline_createPipeline()

ProjectionPipeline_t * ProjectionPipeline_createPipeline ( Projection_t * first,
Projection_t * second )

Creates a pipeline from one projection to another.

Parameters
[in]first- first projection
[in]second- second projection
Returns
the pipeline on success otherwise NULL

◆ ProjectionPipeline_createPipelineFromDef()

ProjectionPipeline_t * ProjectionPipeline_createPipelineFromDef ( const char * first,
const char * second )

Creates a pipeline from one projection to another.

Parameters
[in]first- first projection definition
[in]second- second projection definition
Returns
the pipeline on success otherwise NULL

◆ ProjectionPipeline_fwd()

int ProjectionPipeline_fwd ( ProjectionPipeline_t * pipeline,
double inu,
double inv,
double * outu,
double * outv )

Transforms the coordinates from first projection to second projection using this pipeline.

Parameters
[in]pipeline- this pipeline
[in]inu- coordinate
[in]inv- coordinate
[out]outu- coordinate
[out]outv- coordinate
Returns
0 on failure, otherwise success

◆ ProjectionPipeline_getFirstProjection()

Projection_t * ProjectionPipeline_getFirstProjection ( ProjectionPipeline_t * pipeline)

Returns the first projection.

Parameters
[in]pipeline- self
Returns
the first pipeline

◆ ProjectionPipeline_getSecondProjection()

Projection_t * ProjectionPipeline_getSecondProjection ( ProjectionPipeline_t * pipeline)

Returns the second projection.

Parameters
[in]pipeline- self
Returns
the second pipeline

◆ ProjectionPipeline_init()

int ProjectionPipeline_init ( ProjectionPipeline_t * pipeline,
Projection_t * first,
Projection_t * second )

Initializes a pipeline with the projections.

Parameters
[in]first- first projection
[in]second- second projection
Returns
1 on success otherwise NULL

◆ ProjectionPipeline_initFromDef()

int ProjectionPipeline_initFromDef ( ProjectionPipeline_t * pipeline,
const char * first,
const char * second )

Initializes a pipeline with the projection definitions.

Parameters
[in]first- first projection definition
[in]second- second projection definition
Returns
1 on success otherwise NULL

◆ ProjectionPipeline_inv()

int ProjectionPipeline_inv ( ProjectionPipeline_t * pipeline,
double inu,
double inv,
double * outu,
double * outv )

Transforms the coordinates from second projection to first projection using this pipeline.

Parameters
[in]pipeline- this pipeline
[in]inu- coordinate
[in]inv- coordinate
[out]outu- coordinate
[out]outv- coordinate
Returns
0 on failure, otherwise success

Variable Documentation

◆ ProjectionPipeline_TYPE

RaveCoreObjectType ProjectionPipeline_TYPE
Initial value:
=
{
"ProjectionPipeline",
ProjectionPipeline_constructor,
ProjectionPipeline_destructor,
ProjectionPipeline_copyconstructor
}
struct _ProjectionPipeline_t ProjectionPipeline_t
Defines a projection pipeline.
Definition projection_pipeline.h:34

Type definition to use when creating a rave object.