Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Chebyshev polynomials from proj #1226

Merged
merged 1 commit into from
Jan 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions docs/source/apps/proj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,26 +148,13 @@ The following control parameters can appear in any order
.. option:: -v

Causes a listing of cartographic control parameters tested for and used by
the program to be printed prior to input data. Should not be used with the
:option:`-T` option.
the program to be printed prior to input data.

.. option:: -V

This option causes an expanded annotated listing of the characteristics of
the projected point. :option:`-v` is implied with this option.

.. option:: -T <ulow,uhi,vlow,vhi,res[,umax,vmax]>

This option creates a set of bivariate Chebyshev polynomial coefficients
that approximate the selected cartographic projection on stdout. The values
*low* and *hi* denote the range of the input where the *u* or *v* prefixes apply to
respective longitude-x or latitude-y depending upon whether a forward or
inverse projection is selected. The integer *res* is a number specifying the
power of 10 precision of the approximation. For example, a *res* of -3
specifies an approximation with an accuracy better than 0.001. Optional *umax*, and *vmax*
specify maximum degree of the polynomials (default: 15).



The *+args* run-line arguments are associated with cartographic parameters.
Additional projection control parameters may be contained in two auxiliary
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ EXTRA_DIST = bin_cct.cmake bin_gie.cmake bin_cs2cs.cmake \
lib_proj.cmake CMakeLists.txt bin_geodtest.cmake tests/geodtest.cpp \
wkt1_grammar.y wkt2_grammar.y apps/emess.h

proj_SOURCES = apps/proj.cpp apps/gen_cheb.cpp apps/p_series.cpp apps/emess.cpp
proj_SOURCES = apps/proj.cpp apps/emess.cpp
projinfo_SOURCES = apps/projinfo.cpp
cs2cs_SOURCES = apps/cs2cs.cpp apps/gen_cheb.cpp apps/p_series.cpp apps/emess.cpp
cs2cs_SOURCES = apps/cs2cs.cpp apps/emess.cpp
cct_SOURCES = apps/cct.cpp apps/proj_strtod.cpp apps/proj_strtod.h apps/optargpm.h
nad2bin_SOURCES = apps/nad2bin.cpp
geod_SOURCES = apps/geod.cpp apps/geod_set.cpp apps/geod_interface.cpp apps/geod_interface.h apps/emess.cpp
Expand Down
107 changes: 0 additions & 107 deletions src/apps/gen_cheb.cpp

This file was deleted.

43 changes: 0 additions & 43 deletions src/apps/p_series.cpp

This file was deleted.

36 changes: 4 additions & 32 deletions src/apps/proj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#define MAX_PARGS 100
#define PJ_INVERS(P) (P->inv ? 1 : 0)

extern void gen_cheb(int, PJ_UV(*)(PJ_UV), const char *, PJ *, int, char **);

static PJ *Proj;
static union {
PJ_UV (*generic)(PJ_UV, PJ *);
Expand All @@ -43,7 +41,6 @@ static int
postscale = 0;

static const char
*cheby_str, /* string controlling Chebychev evaluation */
*oform = nullptr; /* output format for x-y or decimal degrees */
static char oform_buffer[16]; /* Buffer for oform when using -d */

Expand All @@ -56,22 +53,6 @@ static PJ_FACTORS facs;
static double (*informat)(const char *, char **), /* input data deformatter function */
fscale = 0.; /* cartesian scale factor */

static PJ_UV int_proj(PJ_UV data) {
if (prescale) {
data.u *= fscale;
data.v *= fscale;
}

data = (*proj.generic)(data, Proj);

if (postscale && data.u != HUGE_VAL) {
data.u *= fscale;
data.v *= fscale;
}

return data;
}

/* file processing function */
static void process(FILE *fid) {
char line[MAX_LINE+3], *s = nullptr, pline[40];
Expand Down Expand Up @@ -309,10 +290,10 @@ static void vprocess(FILE *fid) {
}

int main(int argc, char **argv) {
char *arg, *pargv[MAX_PARGS], **iargv = argv;
char *arg, *pargv[MAX_PARGS];
char **eargv = argv;
FILE *fid;
int pargc = 0, iargc = argc, eargc = 0, mon = 0;
int pargc = 0, eargc = 0, mon = 0;

if ( (emess_dat.Prog_name = strrchr(*argv,DIR_CHAR)) != nullptr)
++emess_dat.Prog_name;
Expand Down Expand Up @@ -425,10 +406,6 @@ int main(int argc, char **argv) {
emess(1,"missing argument for -%c",*arg);
oterr = *++argv;
continue;
case 'T': /* generate Chebyshev coefficients */
if (--argc <= 0) goto noargument;
cheby_str = *++argv;
continue;
case 'm': /* cartesian multiplier */
if (--argc <= 0) goto noargument;
postscale = 1;
Expand Down Expand Up @@ -482,10 +459,9 @@ int main(int argc, char **argv) {
} else /* assumed to be input file name(s) */
eargv[eargc++] = *argv;
}
if (eargc == 0 && !cheby_str) /* if no specific files force sysin */
if (eargc == 0) /* if no specific files force sysin */
eargv[eargc++] = const_cast<char*>("-");
else if (eargc > 0 && cheby_str) /* warning */
emess(4, "data files when generating Chebychev prohibited");

/* done with parameter and control input */
if (inverse && postscale) {
prescale = 1;
Expand All @@ -512,10 +488,6 @@ int main(int argc, char **argv) {
proj.inv = pj_inv;
} else
proj.fwd = pj_fwd;
if (cheby_str) {
gen_cheb(inverse, int_proj, cheby_str, Proj, iargc, iargv);
exit(0);
}

/* set input formatting control */
if (mon) {
Expand Down
2 changes: 0 additions & 2 deletions src/bin_cs2cs.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
set(CS2CS_SRC apps/cs2cs.cpp
apps/gen_cheb.cpp
apps/p_series.cpp
apps/emess.cpp
)

Expand Down
4 changes: 1 addition & 3 deletions src/bin_proj.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
set(PROJ_SRC apps/proj.cpp
apps/gen_cheb.cpp
apps/p_series.cpp
set(PROJ_SRC apps/proj.cpp
apps/emess.cpp
)

Expand Down