aboutsummaryrefslogtreecommitdiff
path: root/src/apps
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@mines-paris.org>2018-12-31 11:37:51 +0100
committerGitHub <noreply@github.com>2018-12-31 11:37:51 +0100
commit32f3ef47e55c38b0eabb6d781fee3944d3239414 (patch)
treeba2850500ee732559bada055dbab281ceff49a22 /src/apps
parent5c41d3a1078895ed096b416db15c91108bccad87 (diff)
parent0e0e0e475414ddeb75e0e140d8a3381a431036d9 (diff)
downloadPROJ-32f3ef47e55c38b0eabb6d781fee3944d3239414.tar.gz
PROJ-32f3ef47e55c38b0eabb6d781fee3944d3239414.zip
Merge pull request #1208 from rouault/merge_PJ_and_PJ_OBJ
Unify PJ_OBJ and PJ structures
Diffstat (limited to 'src/apps')
-rw-r--r--src/apps/cct.cpp2
-rw-r--r--src/apps/cs2cs.cpp70
-rw-r--r--src/apps/gen_cheb.cpp9
-rw-r--r--src/apps/geod.cpp2
-rw-r--r--src/apps/geod_interface.cpp3
-rw-r--r--src/apps/geod_set.cpp2
-rw-r--r--src/apps/gie.cpp2
-rw-r--r--src/apps/nad2bin.cpp4
-rw-r--r--src/apps/p_series.cpp3
-rw-r--r--src/apps/proj.cpp24
-rw-r--r--src/apps/projinfo.cpp3
11 files changed, 64 insertions, 60 deletions
diff --git a/src/apps/cct.cpp b/src/apps/cct.cpp
index 046257da..4deefba6 100644
--- a/src/apps/cct.cpp
+++ b/src/apps/cct.cpp
@@ -81,7 +81,7 @@ Thomas Knudsen, thokn@sdfe.dk, 2016-05-25/2017-10-26
#include "proj.h"
#include "proj_internal.h"
#include "proj_strtod.h"
-#include "projects.h"
+#include "proj_internal.h"
#include "optargpm.h"
diff --git a/src/apps/cs2cs.cpp b/src/apps/cs2cs.cpp
index f63bedcc..1e8fb474 100644
--- a/src/apps/cs2cs.cpp
+++ b/src/apps/cs2cs.cpp
@@ -43,7 +43,7 @@
// PROJ include order is sensitive
// clang-format off
#include "proj.h"
-#include "projects.h"
+#include "proj_internal.h"
#include "emess.h"
// clang-format on
@@ -83,7 +83,7 @@ static void process(FILE *fid)
{
char line[MAX_LINE + 3], *s, pline[40];
- projUV data;
+ PJ_UV data;
for (;;) {
double z;
@@ -209,11 +209,11 @@ static void process(FILE *fid)
/* instanciate_crs() */
/************************************************************************/
-static PJ_OBJ *instanciate_crs(const std::string &definition,
+static PJ *instanciate_crs(const std::string &definition,
const char *const *optionsImportCRS,
bool &isGeog, double &toRadians,
bool &isLatFirst) {
- PJ_OBJ *crs = proj_obj_create_from_user_input(nullptr, definition.c_str(),
+ PJ *crs = proj_create_from_user_input(nullptr, definition.c_str(),
optionsImportCRS);
if (!crs) {
return nullptr;
@@ -223,21 +223,21 @@ static PJ_OBJ *instanciate_crs(const std::string &definition,
toRadians = 0.0;
isLatFirst = false;
- auto type = proj_obj_get_type(crs);
- if (type == PJ_OBJ_TYPE_BOUND_CRS) {
- auto base = proj_obj_get_source_crs(nullptr, crs);
- proj_obj_destroy(crs);
+ auto type = proj_get_type(crs);
+ if (type == PJ_TYPE_BOUND_CRS) {
+ auto base = proj_get_source_crs(nullptr, crs);
+ proj_destroy(crs);
crs = base;
- type = proj_obj_get_type(crs);
+ type = proj_get_type(crs);
}
- if (type == PJ_OBJ_TYPE_GEOGRAPHIC_2D_CRS ||
- type == PJ_OBJ_TYPE_GEOGRAPHIC_3D_CRS) {
- auto cs = proj_obj_crs_get_coordinate_system(nullptr, crs);
+ if (type == PJ_TYPE_GEOGRAPHIC_2D_CRS ||
+ type == PJ_TYPE_GEOGRAPHIC_3D_CRS) {
+ auto cs = proj_crs_get_coordinate_system(nullptr, crs);
assert(cs);
isGeog = true;
const char *axisName = "";
- proj_obj_cs_get_axis_info(nullptr, cs, 0,
+ proj_cs_get_axis_info(nullptr, cs, 0,
&axisName, // name,
nullptr, // abbrev
nullptr, // direction
@@ -250,7 +250,7 @@ static PJ_OBJ *instanciate_crs(const std::string &definition,
NS_PROJ::internal::ci_find(std::string(axisName), "latitude") !=
std::string::npos;
- proj_obj_destroy(cs);
+ proj_destroy(cs);
}
return crs;
@@ -260,35 +260,35 @@ static PJ_OBJ *instanciate_crs(const std::string &definition,
/* get_geog_crs_proj_string_from_proj_crs() */
/************************************************************************/
-static std::string get_geog_crs_proj_string_from_proj_crs(PJ_OBJ *src,
+static std::string get_geog_crs_proj_string_from_proj_crs(PJ *src,
double &toRadians,
bool &isLatFirst) {
- auto srcType = proj_obj_get_type(src);
- if (srcType == PJ_OBJ_TYPE_BOUND_CRS) {
- auto base = proj_obj_get_source_crs(nullptr, src);
+ auto srcType = proj_get_type(src);
+ if (srcType == PJ_TYPE_BOUND_CRS) {
+ auto base = proj_get_source_crs(nullptr, src);
assert(base);
- proj_obj_destroy(src);
+ proj_destroy(src);
src = base;
- srcType = proj_obj_get_type(src);
+ srcType = proj_get_type(src);
}
- if (srcType != PJ_OBJ_TYPE_PROJECTED_CRS) {
+ if (srcType != PJ_TYPE_PROJECTED_CRS) {
return std::string();
}
- auto base = proj_obj_get_source_crs(nullptr, src);
+ auto base = proj_get_source_crs(nullptr, src);
assert(base);
- auto baseType = proj_obj_get_type(base);
- if (baseType != PJ_OBJ_TYPE_GEOGRAPHIC_2D_CRS &&
- baseType != PJ_OBJ_TYPE_GEOGRAPHIC_3D_CRS) {
- proj_obj_destroy(base);
+ auto baseType = proj_get_type(base);
+ if (baseType != PJ_TYPE_GEOGRAPHIC_2D_CRS &&
+ baseType != PJ_TYPE_GEOGRAPHIC_3D_CRS) {
+ proj_destroy(base);
return std::string();
}
- auto cs = proj_obj_crs_get_coordinate_system(nullptr, base);
+ auto cs = proj_crs_get_coordinate_system(nullptr, base);
assert(cs);
const char *axisName = "";
- proj_obj_cs_get_axis_info(nullptr, cs, 0,
+ proj_cs_get_axis_info(nullptr, cs, 0,
&axisName, // name,
nullptr, // abbrev
nullptr, // direction
@@ -300,11 +300,11 @@ static std::string get_geog_crs_proj_string_from_proj_crs(PJ_OBJ *src,
isLatFirst = NS_PROJ::internal::ci_find(std::string(axisName),
"latitude") != std::string::npos;
- proj_obj_destroy(cs);
+ proj_destroy(cs);
- auto retCStr = proj_obj_as_proj_string(nullptr, base, PJ_PROJ_5, nullptr);
+ auto retCStr = proj_as_proj_string(nullptr, base, PJ_PROJ_5, nullptr);
std::string ret(retCStr ? retCStr : "");
- proj_obj_destroy(base);
+ proj_destroy(base);
return ret;
}
@@ -541,7 +541,7 @@ int main(int argc, char **argv) {
proj_context_get_use_proj4_init_rules(nullptr, TRUE) ? optionsProj4Mode
: nullptr;
- PJ_OBJ *src = nullptr;
+ PJ *src = nullptr;
if (!fromStr.empty()) {
bool ignored;
src = instanciate_crs(fromStr, optionsImportCRS, srcIsGeog,
@@ -551,7 +551,7 @@ int main(int argc, char **argv) {
}
}
- PJ_OBJ *dst = nullptr;
+ PJ *dst = nullptr;
if (!toStr.empty()) {
dst = instanciate_crs(toStr, optionsImportCRS, destIsGeog,
destToRadians, destIsLatLong);
@@ -581,8 +581,8 @@ int main(int argc, char **argv) {
srcIsGeog = true;
}
- proj_obj_destroy(src);
- proj_obj_destroy(dst);
+ proj_destroy(src);
+ proj_destroy(dst);
transformation = proj_create_crs_to_crs(nullptr, fromStr.c_str(),
toStr.c_str(), nullptr);
diff --git a/src/apps/gen_cheb.cpp b/src/apps/gen_cheb.cpp
index 4ba514d4..23285314 100644
--- a/src/apps/gen_cheb.cpp
+++ b/src/apps/gen_cheb.cpp
@@ -1,6 +1,7 @@
/* generates 'T' option output */
#define PJ_LIB__
-#include "projects.h"
+#include "proj.h"
+#include "proj_internal.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -38,17 +39,17 @@ static long strtol_type_safe(const char *s, const char ** endptr, int base)
/* FIXME: put the declaration in a header. Also used in proj.c */
-void gen_cheb(int inverse, projUV (*proj)(projUV), const char *s, PJ *P,
+void gen_cheb(int inverse, PJ_UV (*proj)(PJ_UV), const char *s, PJ *P,
int iargc, char **iargv);
extern void p_series(Tseries *, FILE *, char *);
-void gen_cheb(int inverse, projUV (*proj)(projUV), const char *s, PJ *P,
+void gen_cheb(int inverse, PJ_UV (*proj)(PJ_UV), const char *s, PJ *P,
int iargc, char **iargv) {
long NU = 15, NV = 15;
int errin = 0, pwr;
long res = -1;
char *arg, fmt[32];
- projUV low, upp, resid;
+ PJ_UV low, upp, resid;
Tseries *F;
double (*input)(const char *, const char **);
diff --git a/src/apps/geod.cpp b/src/apps/geod.cpp
index 7b6367c6..7225856e 100644
--- a/src/apps/geod.cpp
+++ b/src/apps/geod.cpp
@@ -1,7 +1,7 @@
/* <<<< Geodesic filter program >>>> */
#include "proj.h"
-# include "projects.h"
+# include "proj_internal.h"
# include "geod_interface.h"
# include "emess.h"
# include <ctype.h>
diff --git a/src/apps/geod_interface.cpp b/src/apps/geod_interface.cpp
index a30377ac..a21a89e6 100644
--- a/src/apps/geod_interface.cpp
+++ b/src/apps/geod_interface.cpp
@@ -1,4 +1,5 @@
-#include "projects.h"
+#include "proj.h"
+#include "proj_internal.h"
#include "geod_interface.h"
void geod_ini(void) {
diff --git a/src/apps/geod_set.cpp b/src/apps/geod_set.cpp
index b9e9c42f..cd6b5018 100644
--- a/src/apps/geod_set.cpp
+++ b/src/apps/geod_set.cpp
@@ -5,7 +5,7 @@
#include <string.h>
#include "proj.h"
-#include "projects.h"
+#include "proj_internal.h"
#include "geod_interface.h"
#include "emess.h"
diff --git a/src/apps/gie.cpp b/src/apps/gie.cpp
index 3e4770a2..e912a076 100644
--- a/src/apps/gie.cpp
+++ b/src/apps/gie.cpp
@@ -117,7 +117,7 @@ Thomas Knudsen, thokn@sdfe.dk, 2017-10-01/2017-10-08
#include "proj_internal.h"
#include "proj_math.h"
#include "proj_strtod.h"
-#include "projects.h"
+#include "proj_internal.h"
#include "optargpm.h"
diff --git a/src/apps/nad2bin.cpp b/src/apps/nad2bin.cpp
index ff8f2ebd..a684b087 100644
--- a/src/apps/nad2bin.cpp
+++ b/src/apps/nad2bin.cpp
@@ -4,7 +4,7 @@
#define PJ_LIB__
#include "proj_internal.h"
-#include "projects.h"
+#include "proj_internal.h"
#define U_SEC_TO_RAD 4.848136811095359935899141023e-12
/************************************************************************/
@@ -274,7 +274,7 @@ int main(int argc, char **argv) {
unsigned char achHeader[11*16];
double dfValue;
pj_int32 nGSCount = ct.lim.lam * ct.lim.phi;
- LP ur;
+ PJ_LP ur;
ur.lam = ct.ll.lam + (ct.lim.lam-1) * ct.del.lam;
ur.phi = ct.ll.phi + (ct.lim.phi-1) * ct.del.phi;
diff --git a/src/apps/p_series.cpp b/src/apps/p_series.cpp
index cddea888..2f668ce0 100644
--- a/src/apps/p_series.cpp
+++ b/src/apps/p_series.cpp
@@ -1,5 +1,6 @@
/* print row coefficients of Tseries structure */
-#include "projects.h"
+#include "proj.h"
+#include "proj_internal.h"
#include <stdio.h>
#include <string.h>
#define NF 20 /* length of final format string */
diff --git a/src/apps/proj.cpp b/src/apps/proj.cpp
index b93fb04d..c8cd20a1 100644
--- a/src/apps/proj.cpp
+++ b/src/apps/proj.cpp
@@ -1,6 +1,6 @@
/* <<<< Cartographic projection filter program >>>> */
#include "proj.h"
-#include "projects.h"
+#include "proj_internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -20,13 +20,13 @@
#define MAX_PARGS 100
#define PJ_INVERS(P) (P->inv ? 1 : 0)
-extern void gen_cheb(int, projUV(*)(projUV), const char *, PJ *, int, char **);
+extern void gen_cheb(int, PJ_UV(*)(PJ_UV), const char *, PJ *, int, char **);
static PJ *Proj;
static union {
- projUV (*generic)(projUV, PJ *);
- projXY (*fwd)(projLP, PJ *);
- projLP (*inv)(projXY, PJ *);
+ PJ_UV (*generic)(PJ_UV, PJ *);
+ PJ_XY (*fwd)(PJ_LP, PJ *);
+ PJ_LP (*inv)(PJ_XY, PJ *);
} proj;
static int
@@ -56,7 +56,7 @@ static PJ_FACTORS facs;
static double (*informat)(const char *, char **), /* input data deformatter function */
fscale = 0.; /* cartesian scale factor */
-static projUV int_proj(projUV data) {
+static PJ_UV int_proj(PJ_UV data) {
if (prescale) {
data.u *= fscale;
data.v *= fscale;
@@ -82,7 +82,7 @@ static void process(FILE *fid) {
++emess_dat.File_line;
if (bin_in) { /* binary input */
- if (fread(&data, sizeof(projUV), 1, fid) != 1)
+ if (fread(&data, sizeof(PJ_UV), 1, fid) != 1)
break;
} else { /* ascii input */
if (!(s = fgets(line, MAX_LINE, fid)))
@@ -144,7 +144,7 @@ static void process(FILE *fid) {
}
if (bin_out) { /* binary output */
- (void)fwrite(&data, sizeof(projUV), 1, stdout);
+ (void)fwrite(&data, sizeof(PJ_UV), 1, stdout);
continue;
} else if (data.uv.u == HUGE_VAL) /* error output */
(void)fputs(oterr, stdout);
@@ -196,8 +196,8 @@ static void process(FILE *fid) {
/* file processing function --- verbosely */
static void vprocess(FILE *fid) {
char line[MAX_LINE+3], *s, pline[40];
- LP dat_ll;
- projXY dat_xy;
+ PJ_LP dat_ll;
+ PJ_XY dat_xy;
int linvers;
PJ_COORD coord;
@@ -247,7 +247,7 @@ static void vprocess(FILE *fid) {
}
if (prescale) { dat_xy.x *= fscale; dat_xy.y *= fscale; }
if (reversein) {
- projXY temp = dat_xy;
+ PJ_XY temp = dat_xy;
dat_xy.x = temp.y;
dat_xy.y = temp.x;
}
@@ -260,7 +260,7 @@ static void vprocess(FILE *fid) {
continue;
}
if (reversein) {
- LP temp = dat_ll;
+ PJ_LP temp = dat_ll;
dat_ll.lam = temp.phi;
dat_ll.phi = temp.lam;
}
diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp
index d604365a..4fcd3e5e 100644
--- a/src/apps/projinfo.cpp
+++ b/src/apps/projinfo.cpp
@@ -35,7 +35,8 @@
#include <iostream>
#include <utility>
-#include "projects.h"
+#include "proj.h"
+#include "proj_internal.h"
#include <proj/common.hpp>
#include <proj/coordinateoperation.hpp>