78#define PI 3.1415926535897931160E0
80#define DEGREE (PI / 180.0)
81#define RADIAN (180.0 / PI)
83#define DATUM_INDEX_WGS84 101
84#define DATUM_INDEX_UNKNOWN -1
86static const double WGS84_semimajor_axis_meters =
88static const double mercator_k0 = 0.9996;
89static const double WGSinvf = 298.257223563;
91void datumParams(
short datum,
double *a,
double *es);
96extern "C" void toDMS(
double a,
char *bufp,
int bufplen);
97extern "C" void toDMM(
double a,
char *bufp,
int bufplen);
98extern "C" void todmm(
int flag,
double a,
char *bufp,
int bufplen);
100extern "C" void toTM(
float lat,
float lon,
float lat0,
float lon0,
double *x,
102extern "C" void fromTM(
double x,
double y,
double lat0,
double lon0,
103 double *lat,
double *lon);
105extern "C" void toSM(
double lat,
double lon,
double lat0,
double lon0,
106 double *x,
double *y);
107extern "C" double toSMcache_y30(
double lat0);
108extern "C" void toSMcache(
double lat,
double lon,
double y30,
double lon0,
109 double *x,
double *y);
110extern "C" void fromSM(
double x,
double y,
double lat0,
double lon0,
111 double *lat,
double *lon);
112extern "C" void fromSMR(
double x,
double y,
double lat0,
double lon0,
113 double axis_meters,
double *lat,
double *lon);
115extern "C" void toSM_ECC(
double lat,
double lon,
double lat0,
double lon0,
116 double *x,
double *y);
117extern "C" void fromSM_ECC(
double x,
double y,
double lat0,
double lon0,
118 double *lat,
double *lon);
120extern "C" void toPOLY(
double lat,
double lon,
double lat0,
double lon0,
121 double *x,
double *y);
122extern "C" void fromPOLY(
double x,
double y,
double lat0,
double lon0,
123 double *lat,
double *lon);
125extern "C" void cache_phi0(
double lat0,
double *sin_phi0,
double *cos_phi0);
127extern "C" void toORTHO(
double lat,
double lon,
double sin_phi0,
128 double cos_phi0,
double lon0,
double *x,
double *y);
129extern "C" void fromORTHO(
double x,
double y,
double lat0,
double lon0,
130 double *lat,
double *lon);
132extern "C" double toPOLARcache_e(
double lat0);
133extern "C" void toPOLAR(
double lat,
double lon,
double e,
double lat0,
134 double lon0,
double *x,
double *y);
135extern "C" void fromPOLAR(
double x,
double y,
double lat0,
double lon0,
136 double *lat,
double *lon);
138extern "C" void toSTEREO(
double lat,
double lon,
double sin_phi0,
139 double cos_phi0,
double lon0,
double *x,
double *y);
140extern "C" void fromSTEREO(
double x,
double y,
double lat0,
double lon0,
141 double *lat,
double *lon);
143extern "C" void toGNO(
double lat,
double lon,
double sin_phi0,
double cos_phi0,
144 double lon0,
double *x,
double *y);
145extern "C" void fromGNO(
double x,
double y,
double lat0,
double lon0,
146 double *lat,
double *lon);
148extern "C" void toEQUIRECT(
double lat,
double lon,
double lat0,
double lon0,
149 double *x,
double *y);
150extern "C" void fromEQUIRECT(
double x,
double y,
double lat0,
double lon0,
151 double *lat,
double *lon);
154extern "C" void ll_gc_ll(
double lat,
double lon,
double crs,
double dist,
155 double *dlat,
double *dlon);
156extern "C" void ll_gc_ll_reverse(
double lat1,
double lon1,
double lat2,
157 double lon2,
double *bearing,
double *dist);
159extern "C" void PositionBearingDistanceMercator(
double lat,
double lon,
160 double brg,
double dist,
161 double *dlat,
double *dlon);
162extern "C" double DistGreatCircle(
double slat,
double slon,
double dlat,
164extern "C" double DistLoxodrome(
double slat,
double slon,
double dlat,
167extern "C" int GetDatumIndex(
const char *str);
168extern "C" void MolodenskyTransform(
double lat,
double lon,
double *to_lat,
169 double *to_lon,
int from_datum_index,
172extern "C" void DistanceBearingMercator(
double lat1,
double lon1,
double lat0,
173 double lon0,
double *brg,
double *dist);
175extern "C" int Georef_Calculate_Coefficients(
struct GeoRef *cp,
int nlin_lon);
176extern "C" int Georef_Calculate_Coefficients_Proj(
struct GeoRef *cp);
177extern "C" double lat_gc_crosses_meridian(
double lat1,
double lon1,
double lat2,
178 double lon2,
double lon);
179extern "C" double lat_rl_crosses_meridian(
double lat1,
double lon1,
double lat2,
180 double lon2,
double lon);
183void toDMS(
double a,
char *bufp,
int bufplen);
184void toDMM(
double a,
char *bufp,
int bufplen);
185int GetDatumIndex(
const char *str);
186void MolodenskyTransform(
double lat,
double lon,
double *to_lat,
double *to_lon,
187 int from_datum_index,
int to_datum_index);
188double lat_gc_crosses_meridian(
double lat1,
double lon1,
double lat2,
189 double lon2,
double lon);
190double lat_rl_crosses_meridian(
double lat1,
double lon1,
double lat2,
191 double lon2,
double lon);
227typedef void(lm_evaluate_ftype)(
double *par,
int m_dat,
double *fvec,
228 void *data,
int *info);
230void lm_evaluate_default(
double *par,
int m_dat,
double *fvec,
void *data,
234typedef void(lm_print_ftype)(
int n_par,
double *par,
int m_dat,
double *fvec,
235 void *data,
int iflag,
int iter,
int nfev);
237void lm_print_default(
int n_par,
double *par,
int m_dat,
double *fvec,
238 void *data,
int iflag,
int iter,
int nfev);
242void lm_minimize(
int m_dat,
int n_par,
double *par, lm_evaluate_ftype *evaluate,
243 lm_print_ftype *printout,
void *data,
245double lm_enorm(
int,
double *);
248void lm_lmdif(
int m,
int n,
double *x,
double *fvec,
double ftol,
double xtol,
249 double gtol,
int maxfev,
double epsfcn,
double *diag,
int mode,
250 double factor,
int *info,
int *nfev,
double *fjac,
int *ipvt,
251 double *qtf,
double *wa1,
double *wa2,
double *wa3,
double *wa4,
252 lm_evaluate_ftype *evaluate, lm_print_ftype *printout,
256extern const char *lm_infmsg[];
257extern const char *lm_shortmsg[];
265 double (*user_func)(
double user_tx_point,
double user_ty_point,
int n_par,