28 static const real northoffset =
29 ( OSGBTM().Forward(
real(0), OriginLatitude(),
real(0), x, y),
30 FalseNorthing() -
y );
36 if (!(prec >= 0 && prec <= maxprec_))
44 char grid[2 + 2 * maxprec_];
54 grid[z++] = letters_[(tilegrid_ - (yh / tilegrid_) - 1)
55 * tilegrid_ + (xh / tilegrid_)];
56 grid[z++] = letters_[(tilegrid_ - (yh % tilegrid_) - 1)
57 * tilegrid_ + (xh % tilegrid_)];
63 for (
int c =
min(prec,
int(tilelevel_));
c--;) {
64 grid[z +
c] = digits_[ ix % base_ ];
66 grid[z +
c + prec] = digits_[ iy % base_ ];
69 if (prec > tilelevel_) {
70 xf -=
floor(xf / mult);
71 yf -=
floor(yf / mult);
75 for (
int c = prec - tilelevel_;
c--;) {
76 grid[z +
c + tilelevel_] = digits_[ ix % base_ ];
78 grid[z +
c + tilelevel_ + prec] = digits_[ iy % base_ ];
82 int mlen = z + 2 * prec;
84 copy(grid, grid + mlen, gridref.begin());
94 toupper(gridref[0]) ==
'I' &&
95 toupper(gridref[1]) ==
'N') {
100 char grid[2 + 2 * maxprec_];
101 for (
int i = 0;
i <
len; ++
i) {
102 if (!isspace(gridref[
i])) {
103 if (
p >= 2 + 2 * maxprec_)
105 grid[
p++] = gridref[
i];
111 throw GeographicErr(
"OSGB string " + gridref +
" too short");
114 " has odd number of characters");
122 yh = yh * tilegrid_ + tilegrid_ - (i / tilegrid_) - 1;
123 xh = xh * tilegrid_ + (i % tilegrid_);
128 int prec1 = (len -
p)/2;
133 for (
int i = 0;
i < prec1; ++
i) {
138 if (ix < 0 || iy < 0)
139 throw GeographicErr(
"Encountered a non-digit in " + gridref);
156 if (x < minx_ || x >= maxx_)
158 +
"km not in OSGB range [" 161 if (y < miny_ || y >= maxy_)
163 +
"km not in OSGB range [" static const char *const letters_
Header for GeographicLib::Utility class.
Transverse Mercator projection.
static const char *const digits_
Header for GeographicLib::OSGB class.
EIGEN_DEVICE_FUNC const FloorReturnType floor() const
static void CheckCoords(real x, real y)
Namespace for GeographicLib.
static std::string str(T x, int p=-1)
static real computenorthoffset()
static void GridReference(real x, real y, int prec, std::string &gridref)
Exception handling for GeographicLib.
static int lookup(const std::string &s, char c)
int EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Jet< T, N > pow(const Jet< T, N > &f, double g)
size_t len(handle h)
Get the length of a Python object.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
static const TransverseMercator & OSGBTM()