/* * Proj 4 integration code follows */ #define PROJ_PARMS__ \ struct isea_dgg dgg; #define PJ_LIB__ #include PROJ_HEAD(isea, "Icosahedral Snyder Equal Area") "\n\tSph"; FORWARD(s_forward); struct isea_pt out; struct isea_geo in; in.lon = lp.lam; in.lat = lp.phi; out = isea_forward(&P->dgg, &in); xy.x = out.x; xy.y = out.y; return xy; } FREEUP; if (P) pj_dalloc(P); } ENTRY0(isea) char *opt; P->fwd = s_forward; isea_grid_init(&P->dgg); P->dgg.output = ISEA_PLANE; /* P->dgg.radius = P->a; /* otherwise defaults to 1 */ /* calling library will scale, I think */ opt = pj_param(P->ctx,P->params, "sorient").s; if (opt) { if (!strcmp(opt, "isea")) { isea_orient_isea(&P->dgg); } else if (!strcmp(opt, "pole")) { isea_orient_pole(&P->dgg); } else { E_ERROR(-34); } } if (pj_param(P->ctx,P->params, "tazi").i) { P->dgg.o_az = pj_param(P->ctx,P->params, "razi").f; } if (pj_param(P->ctx,P->params, "tlon_0").i) { P->dgg.o_lon = pj_param(P->ctx,P->params, "rlon_0").f; } if (pj_param(P->ctx,P->params, "tlat_0").i) { P->dgg.o_lat = pj_param(P->ctx,P->params, "rlat_0").f; } if (pj_param(P->ctx,P->params, "taperture").i) { P->dgg.aperture = pj_param(P->ctx,P->params, "iaperture").i; } if (pj_param(P->ctx,P->params, "tresolution").i) { P->dgg.resolution = pj_param(P->ctx,P->params, "iresolution").i; } opt = pj_param(P->ctx,P->params, "smode").s; if (opt) { if (!strcmp(opt, "plane")) { P->dgg.output = ISEA_PLANE; } else if (!strcmp(opt, "di")) { P->dgg.output = ISEA_Q2DI; } else if (!strcmp(opt, "dd")) { P->dgg.output = ISEA_Q2DD; } else if (!strcmp(opt, "hex")) { P->dgg.output = ISEA_HEX; } else { /* TODO verify error code. Possibly eliminate magic */ E_ERROR(-34); } } if (pj_param(P->ctx,P->params, "trescale").i) { P->dgg.radius = ISEA_SCALE; } if (pj_param(P->ctx,P->params, "tresolution").i) { P->dgg.resolution = pj_param(P->ctx,P->params, "iresolution").i; } else { P->dgg.resolution = 4; } if (pj_param(P->ctx,P->params, "taperture").i) { P->dgg.aperture = pj_param(P->ctx,P->params, "iaperture").i; } else { P->dgg.aperture = 3; } ENDENTRY(P)