1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#define PJ_LIB__
#include <errno.h>
#include <proj.h>
#include "projects.h"
struct pj_opaque {
double rc;
};
PROJ_HEAD(eqc, "Equidistant Cylindrical (Plate Caree)")
"\n\tCyl, Sph\n\tlat_ts=[, lat_0=0]";
static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */
XY xy = {0.0,0.0};
struct pj_opaque *Q = P->opaque;
xy.x = Q->rc * lp.lam;
xy.y = lp.phi - P->phi0;
return xy;
}
static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */
LP lp = {0.0,0.0};
struct pj_opaque *Q = P->opaque;
lp.lam = xy.x / Q->rc;
lp.phi = xy.y + P->phi0;
return lp;
}
PJ *PROJECTION(eqc) {
struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque));
if (0==Q)
return pj_default_destructor (P, ENOMEM);
P->opaque = Q;
if ((Q->rc = cos(pj_param(P->ctx, P->params, "rlat_ts").f)) <= 0.)
return pj_default_destructor (P, PJD_ERR_LAT_TS_LARGER_THAN_90);
P->inv = s_inverse;
P->fwd = s_forward;
P->es = 0.;
return P;
}
int pj_eqc_selftest (void) {return 10000;}
|