15 #if !defined(GEOGRAPHICLIB_DATA)
17 # define GEOGRAPHICLIB_DATA "C:/ProgramData/GeographicLib"
19 # define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib"
23 #if !defined(GEOGRAPHICLIB_GEOID_DEFAULT_NAME)
24 # define GEOGRAPHICLIB_GEOID_DEFAULT_NAME "egm96-5"
29 # pragma warning (disable: 4996)
101 const int Geoid::c3_[stencilsize_ * nterms_] = {
102 9, -18, -88, 0, 96, 90, 0, 0, -60, -20,
103 -9, 18, 8, 0, -96, 30, 0, 0, 60, -20,
104 9, -88, -18, 90, 96, 0, -20, -60, 0, 0,
105 186, -42, -42, -150, -96, -150, 60, 60, 60, 60,
106 54, 162, -78, 30, -24, -90, -60, 60, -60, 60,
107 -9, -32, 18, 30, 24, 0, 20, -60, 0, 0,
108 -9, 8, 18, 30, -96, 0, -20, 60, 0, 0,
109 54, -78, 162, -90, -24, 30, 60, -60, 60, -60,
110 -54, 78, 78, 90, 144, 90, -60, -60, -60, -60,
111 9, -8, -18, -30, -24, 0, 20, 60, 0, 0,
112 -9, 18, -32, 0, 24, 30, 0, 0, -60, 20,
113 9, -18, -8, 0, -24, -30, 0, 0, 60, 20,
152 0, 0, -131, 0, 138, 144, 0, 0, -102, -31,
153 0, 0, 7, 0, -138, 42, 0, 0, 102, -31,
154 62, 0, -31, 0, 0, -62, 0, 0, 0, 31,
155 124, 0, -62, 0, 0, -124, 0, 0, 0, 62,
156 124, 0, -62, 0, 0, -124, 0, 0, 0, 62,
157 62, 0, -31, 0, 0, -62, 0, 0, 0, 31,
158 0, 0, 45, 0, -183, -9, 0, 93, 18, 0,
159 0, 0, 216, 0, 33, 87, 0, -93, 12, -93,
160 0, 0, 156, 0, 153, 99, 0, -93, -12, -93,
161 0, 0, -45, 0, -3, 9, 0, 93, -18, 0,
162 0, 0, -55, 0, 48, 42, 0, 0, -84, 31,
163 0, 0, -7, 0, -48, -42, 0, 0, 84, 31,
186 18, -36, -122, 0, 120, 135, 0, 0, -84, -31,
187 -18, 36, -2, 0, -120, 51, 0, 0, 84, -31,
188 36, -165, -27, 93, 147, -9, 0, -93, 18, 0,
189 210, 45, -111, -93, -57, -192, 0, 93, 12, 93,
190 162, 141, -75, -93, -129, -180, 0, 93, -12, 93,
191 -36, -21, 27, 93, 39, 9, 0, -93, -18, 0,
192 0, 0, 62, 0, 0, 31, 0, 0, 0, -31,
193 0, 0, 124, 0, 0, 62, 0, 0, 0, -62,
194 0, 0, 124, 0, 0, 62, 0, 0, 0, -62,
195 0, 0, 62, 0, 0, 31, 0, 0, 0, -31,
196 -18, 36, -64, 0, 66, 51, 0, 0, -102, 31,
197 18, -36, 2, 0, -66, -51, 0, 0, 102, 31,
212 "pixel_t has the wrong size");
220 if (!(getline(
_file,
s) &&
s ==
"P5"))
227 while (getline(
_file,
s)) {
232 string commentid,
key;
233 if (!(is >> commentid >>
key) || commentid !=
"#")
235 if (
key ==
"Description" ||
key ==
"DateTime") {
236 string::size_type
p =
237 s.find_first_not_of(
" \t",
unsigned(is.tellg()));
238 if (
p != string::npos)
240 }
else if (
key ==
"Offset") {
243 }
else if (
key ==
"Scale") {
246 }
else if (
key == (
_cubic ?
"MaxCubicError" :
"MaxBilinearError")) {
249 }
else if (
key == (
_cubic ?
"RMSCubicError" :
"RMSBilinearError")) {
262 if (!(
_file >> maxval))
288 (
unsigned long long)(
_file.tellg()))
298 _file.exceptions(ifstream::eofbit | ifstream::failbit | ifstream::badbit);
322 real v00 = 0, v01 = 0, v10 = 0, v11 = 0;
328 v01 =
rawval(ix + 1, iy );
329 v10 =
rawval(ix , iy + 1);
330 v11 =
rawval(ix + 1, iy + 1);
335 v[k++] =
rawval(ix + 1, iy - 1);
340 v[k++] =
rawval(ix - 1, iy + 1);
342 v[k++] =
rawval(ix + 1, iy + 1);
343 v[k++] =
rawval(ix + 2, iy + 1);
345 v[k++] =
rawval(ix + 1, iy + 2);
367 a = (1 -
fx) * v00 +
fx * v01,
368 b = (1 -
fx) * v10 +
fx * v11,
402 catch (
const exception&) {
409 throw GeographicErr(
"Attempt to change cache of threadsafe Geoid");
435 if (ie - iw >=
_width - 1) {
451 for (
int iy =
min(oysize,
_ysize); iy--;)
454 catch (
const bad_alloc&) {
460 for (
int iy = in; iy <= is; ++iy) {
461 int iy1 = iy, iw1 = iw;
464 iy1 = iy1 < 0 ? -iy1 : 2 * (
_height - 1) - iy1;
471 Utility::readarray<pixel_t, pixel_t, true>
476 Utility::readarray<pixel_t, pixel_t, true>
482 catch (
const exception&
e) {
490 char* geoidpath = getenv(
"GEOGRAPHICLIB_GEOID_PATH");
492 path = string(geoidpath);
495 char* datapath = getenv(
"GEOGRAPHICLIB_DATA");
497 path = string(datapath);
503 char* geoidname = getenv(
"GEOGRAPHICLIB_GEOID_NAME");
505 name = string(geoidname);