Given the first letter from a two-letter MGRS 100k zone, and given the MGRS table set for the zone number, figure out the easting value that should be added to the other, secondary easting value.
| 300 | // MGRS table set for the zone number, figure out the easting value that |
| 301 | // should be added to the other, secondary easting value. |
| 302 | int SquareCharToEasting(char e, size_t set) |
| 303 | { |
| 304 | ASSERT_LESS(set, kSetOriginColumnLetters.size(), ()); |
| 305 | int curCol = kSetOriginColumnLetters[set]; |
| 306 | int eastingValue = 100000; |
| 307 | bool rewindMarker = false; |
| 308 | |
| 309 | while (curCol != e) |
| 310 | { |
| 311 | curCol++; |
| 312 | if (curCol == 'I') |
| 313 | curCol++; |
| 314 | if (curCol == 'O') |
| 315 | curCol++; |
| 316 | if (curCol > 'Z') |
| 317 | { |
| 318 | if (rewindMarker) |
| 319 | return kInvalidEastingNorthing; |
| 320 | curCol = 'A'; |
| 321 | rewindMarker = true; |
| 322 | } |
| 323 | eastingValue += 100000; |
| 324 | } |
| 325 | |
| 326 | return eastingValue; |
| 327 | } |
| 328 | |
| 329 | /* Given the second letter from a two-letter MGRS 100k zone, and given the |
| 330 | * MGRS table set for the zone number, figure out the northing value that |