@speleotica/frcsdata 4.3.1 → 5.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ParseIssue.d.ts +98 -0
- package/ParseIssue.d.ts.map +1 -0
- package/ParseIssue.js +17 -0
- package/ParseIssue.js.map +1 -0
- package/SourceLoc.d.ts +67 -0
- package/SourceLoc.d.ts.map +1 -0
- package/SourceLoc.js +18 -0
- package/SourceLoc.js.map +1 -0
- package/chunksToLines.d.ts +5 -0
- package/chunksToLines.d.ts.map +1 -0
- package/chunksToLines.js +37 -0
- package/chunksToLines.js.map +1 -0
- package/cli/check-survey-correspondence.d.ts +2 -0
- package/cli/check-survey-correspondence.d.ts.map +1 -0
- package/cli/check-survey-correspondence.js +44 -0
- package/cli/check-survey-correspondence.js.map +1 -0
- package/cli/check-survey.d.ts +2 -0
- package/cli/check-survey.d.ts.map +1 -0
- package/cli/check-survey.js +27 -0
- package/cli/check-survey.js.map +1 -0
- package/cli/parse-survey.d.ts +2 -0
- package/cli/parse-survey.d.ts.map +1 -0
- package/cli/parse-survey.js +15 -0
- package/cli/parse-survey.js.map +1 -0
- package/cli/summarize-survey.d.ts +2 -0
- package/cli/summarize-survey.d.ts.map +1 -0
- package/cli/summarize-survey.js +33 -0
- package/cli/summarize-survey.js.map +1 -0
- package/cli.d.ts +2 -0
- package/cli.d.ts.map +1 -0
- package/cli.js +72 -0
- package/cli.js.map +1 -0
- package/formatFrcsTripSummaryFile.d.ts +3 -0
- package/formatFrcsTripSummaryFile.d.ts.map +1 -0
- package/formatFrcsTripSummaryFile.js +33 -0
- package/formatFrcsTripSummaryFile.js.map +1 -0
- package/formatIssues.d.ts +10 -0
- package/formatIssues.d.ts.map +1 -0
- package/formatIssues.js +52 -0
- package/formatIssues.js.map +1 -0
- package/index.d.ts +5 -7
- package/index.d.ts.map +1 -1
- package/index.js +16 -49
- package/index.js.map +1 -1
- package/node/index.d.ts +4 -2
- package/node/index.d.ts.map +1 -1
- package/node/index.js +6 -12
- package/node/index.js.map +1 -1
- package/package.json +8 -6
- package/parseFrcsPlotFile.js +112 -245
- package/parseFrcsPlotFile.js.map +1 -1
- package/parseFrcsTripSummaryFile.d.ts +3 -1
- package/parseFrcsTripSummaryFile.d.ts.map +1 -1
- package/parseFrcsTripSummaryFile.js +53 -119
- package/parseFrcsTripSummaryFile.js.map +1 -1
- package/src/ParseIssue.ts +19 -0
- package/src/SourceLoc.ts +13 -0
- package/src/chunksToLines.ts +26 -0
- package/src/cli/check-survey-correspondence.ts +49 -0
- package/src/cli/check-survey.ts +23 -0
- package/src/cli/parse-survey.ts +10 -0
- package/src/cli/summarize-survey.ts +28 -0
- package/src/cli.ts +63 -0
- package/src/formatFrcsTripSummaryFile.ts +45 -0
- package/src/formatIssues.ts +97 -0
- package/src/index.ts +9 -7
- package/src/node/index.ts +18 -5
- package/src/parseFrcsTripSummaryFile.ts +8 -2
- package/src/string/index.ts +18 -5
- package/src/survey/FrcsSurveyFile.ts +217 -0
- package/src/survey/FrcsSurveyFileJson.ts +46 -0
- package/src/survey/ZodFrcsSurveyFileJson.ts +260 -0
- package/src/survey/ZodFrcsSurveyFileToJson.ts +297 -0
- package/src/{formatFrcsShot.ts → survey/formatFrcsShot.ts} +39 -22
- package/src/{formatFrcsSurveyFile.ts → survey/formatFrcsSurveyFile.ts} +4 -5
- package/src/survey/getColumnRanges.ts +82 -0
- package/src/survey/normalizeTeamMemberName.ts +7 -0
- package/src/survey/parseFrcsSurveyFile.ts +848 -0
- package/src/survey/parsers.ts +128 -0
- package/src/survey/summarizeSurvey.ts +51 -0
- package/src/survey/validators.ts +24 -0
- package/src/underlineSource.ts +34 -0
- package/src/unwrapInvalid.ts +3 -0
- package/src/web/index.ts +27 -21
- package/string/index.d.ts +4 -2
- package/string/index.d.ts.map +1 -1
- package/string/index.js +8 -34
- package/string/index.js.map +1 -1
- package/survey/FrcsSurveyFile.d.ts +172 -0
- package/survey/FrcsSurveyFile.d.ts.map +1 -0
- package/{FrcsSurveyFile.js → survey/FrcsSurveyFile.js} +3 -1
- package/survey/FrcsSurveyFile.js.map +1 -0
- package/survey/FrcsSurveyFileJson.d.ts +15 -0
- package/survey/FrcsSurveyFileJson.d.ts.map +1 -0
- package/{FrcsTrip.js → survey/FrcsSurveyFileJson.js} +1 -1
- package/survey/FrcsSurveyFileJson.js.map +1 -0
- package/survey/ZodFrcsSurveyFileJson.d.ts +60549 -0
- package/survey/ZodFrcsSurveyFileJson.d.ts.map +1 -0
- package/survey/ZodFrcsSurveyFileJson.js +186 -0
- package/survey/ZodFrcsSurveyFileJson.js.map +1 -0
- package/survey/ZodFrcsSurveyFileToJson.d.ts +60390 -0
- package/survey/ZodFrcsSurveyFileToJson.d.ts.map +1 -0
- package/survey/ZodFrcsSurveyFileToJson.js +209 -0
- package/survey/ZodFrcsSurveyFileToJson.js.map +1 -0
- package/{formatFrcsShot.d.ts → survey/formatFrcsShot.d.ts} +2 -3
- package/survey/formatFrcsShot.d.ts.map +1 -0
- package/survey/formatFrcsShot.js +107 -0
- package/survey/formatFrcsShot.js.map +1 -0
- package/survey/formatFrcsSurveyFile.d.ts +3 -0
- package/survey/formatFrcsSurveyFile.d.ts.map +1 -0
- package/survey/formatFrcsSurveyFile.js +87 -0
- package/survey/formatFrcsSurveyFile.js.map +1 -0
- package/survey/getColumnRanges.d.ts +24 -0
- package/survey/getColumnRanges.d.ts.map +1 -0
- package/survey/getColumnRanges.js +62 -0
- package/survey/getColumnRanges.js.map +1 -0
- package/survey/normalizeTeamMemberName.d.ts +2 -0
- package/survey/normalizeTeamMemberName.d.ts.map +1 -0
- package/survey/normalizeTeamMemberName.js +12 -0
- package/survey/normalizeTeamMemberName.js.map +1 -0
- package/{parseFrcsSurveyFile.d.ts → survey/parseFrcsSurveyFile.d.ts} +2 -5
- package/survey/parseFrcsSurveyFile.d.ts.map +1 -0
- package/survey/parseFrcsSurveyFile.js +626 -0
- package/survey/parseFrcsSurveyFile.js.map +1 -0
- package/survey/parsers.d.ts +11 -0
- package/survey/parsers.d.ts.map +1 -0
- package/survey/parsers.js +119 -0
- package/survey/parsers.js.map +1 -0
- package/survey/summarizeSurvey.d.ts +6 -0
- package/survey/summarizeSurvey.d.ts.map +1 -0
- package/survey/summarizeSurvey.js +58 -0
- package/survey/summarizeSurvey.js.map +1 -0
- package/survey/validators.d.ts +7 -0
- package/survey/validators.d.ts.map +1 -0
- package/survey/validators.js +36 -0
- package/survey/validators.js.map +1 -0
- package/underlineSource.d.ts +6 -0
- package/underlineSource.d.ts.map +1 -0
- package/underlineSource.js +22 -0
- package/underlineSource.js.map +1 -0
- package/unwrapInvalid.d.ts +4 -0
- package/unwrapInvalid.d.ts.map +1 -0
- package/unwrapInvalid.js +10 -0
- package/unwrapInvalid.js.map +1 -0
- package/web/index.d.ts +6 -6
- package/web/index.d.ts.map +1 -1
- package/web/index.js +60 -118
- package/web/index.js.map +1 -1
- package/FrcsShot.d.ts +0 -57
- package/FrcsShot.d.ts.map +0 -1
- package/FrcsShot.js +0 -13
- package/FrcsShot.js.map +0 -1
- package/FrcsSurveyFile.d.ts +0 -29
- package/FrcsSurveyFile.d.ts.map +0 -1
- package/FrcsSurveyFile.js.map +0 -1
- package/FrcsTrip.d.ts +0 -23
- package/FrcsTrip.d.ts.map +0 -1
- package/FrcsTrip.js.map +0 -1
- package/formatFrcsShot.d.ts.map +0 -1
- package/formatFrcsShot.js +0 -96
- package/formatFrcsShot.js.map +0 -1
- package/formatFrcsSurveyFile.d.ts +0 -3
- package/formatFrcsSurveyFile.d.ts.map +0 -1
- package/formatFrcsSurveyFile.js +0 -165
- package/formatFrcsSurveyFile.js.map +0 -1
- package/parseFrcsSurveyFile.d.ts.map +0 -1
- package/parseFrcsSurveyFile.js +0 -812
- package/parseFrcsSurveyFile.js.map +0 -1
- package/src/FrcsShot.ts +0 -56
- package/src/FrcsSurveyFile.ts +0 -47
- package/src/FrcsTrip.ts +0 -25
- package/src/parseFrcsSurveyFile.ts +0 -788
package/parseFrcsSurveyFile.js
DELETED
|
@@ -1,812 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = parseFrcsSurveyFile;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
var _FrcsSurveyFile = require("./FrcsSurveyFile.js");
|
|
14
|
-
var _parseSegment = require("parse-segment");
|
|
15
|
-
var _unitized = require("@speleotica/unitized");
|
|
16
|
-
var _FrcsShot = require("./FrcsShot.js");
|
|
17
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
-
function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
20
|
-
function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(r) { var n = this.s["return"]; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, "throw": function _throw(r) { var n = this.s["return"]; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
|
|
21
|
-
function parseNumber(s, unit) {
|
|
22
|
-
var value = parseFloat(s);
|
|
23
|
-
if (isNaN(value)) return null;
|
|
24
|
-
return new _unitized.UnitizedNumber(value, unit);
|
|
25
|
-
}
|
|
26
|
-
function parseAzimuth(s, unit) {
|
|
27
|
-
var parsed = parseNumber(s, unit);
|
|
28
|
-
return (parsed === null || parsed === void 0 ? void 0 : parsed.get(_unitized.Angle.degrees)) === 360 ? _unitized.Unitize.degrees(0) : parsed;
|
|
29
|
-
}
|
|
30
|
-
function parseKind(kind) {
|
|
31
|
-
switch (kind) {
|
|
32
|
-
case 'H':
|
|
33
|
-
return _FrcsShot.FrcsShotKind.Horizontal;
|
|
34
|
-
case 'D':
|
|
35
|
-
return _FrcsShot.FrcsShotKind.Diagonal;
|
|
36
|
-
default:
|
|
37
|
-
return _FrcsShot.FrcsShotKind.Normal;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function parseLengthUnit(unit) {
|
|
41
|
-
switch (unit) {
|
|
42
|
-
case 'FI':
|
|
43
|
-
return _unitized.Length.inches;
|
|
44
|
-
case 'FF':
|
|
45
|
-
case 'FT':
|
|
46
|
-
return _unitized.Length.feet;
|
|
47
|
-
case 'MT':
|
|
48
|
-
case 'MM':
|
|
49
|
-
case 'M ':
|
|
50
|
-
return _unitized.Length.meters;
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
function parseAngleUnit(unit) {
|
|
55
|
-
switch (unit) {
|
|
56
|
-
case 'D':
|
|
57
|
-
return _unitized.Angle.degrees;
|
|
58
|
-
case 'G':
|
|
59
|
-
return _unitized.Angle.gradians;
|
|
60
|
-
case 'M':
|
|
61
|
-
return _unitized.Angle.milsNATO;
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// determines if a cell contains a valid station name.
|
|
67
|
-
function isValidStation(s) {
|
|
68
|
-
return /^\s*\S+\s*$/.test(s);
|
|
69
|
-
}
|
|
70
|
-
// determines if a cell contains a valid unsigned integer.
|
|
71
|
-
function isValidUInt(s) {
|
|
72
|
-
return /^\s*[0-9]+\s*$/.test(s);
|
|
73
|
-
}
|
|
74
|
-
// determines if a cell contains a valid float.
|
|
75
|
-
function isValidFloat(s) {
|
|
76
|
-
return /^\s*[-+]?([0-9]+(\.[0-9]*)?|\.[0-9]+)\s*$/.test(s);
|
|
77
|
-
}
|
|
78
|
-
// determines if a cell contains a valid unsigned float or whitespace.
|
|
79
|
-
function isValidOptFloat(s) {
|
|
80
|
-
return /^\s*[-+]?[0-9]*(\.[0-9]*)?\s*$/.test(s);
|
|
81
|
-
}
|
|
82
|
-
// determines if a cell contains a valid unsigned float or whitespace.
|
|
83
|
-
function isValidOptUFloat(s) {
|
|
84
|
-
return /^\s*[0-9]*(\.[0-9]*)?\s*$/.test(s);
|
|
85
|
-
}
|
|
86
|
-
// determines if a cell contains a valid unsigned float.
|
|
87
|
-
function isValidUFloat(s) {
|
|
88
|
-
return /^\s*([0-9]+(\.[0-9]*)?|\.[0-9]+)\s*$/.test(s);
|
|
89
|
-
}
|
|
90
|
-
// determines if a cell contains a valid inclination or whitespace.
|
|
91
|
-
function isValidOptInclination(s) {
|
|
92
|
-
return /^\s*[-+]?[0-9]*(\.[0-9]*)?\s*$/.test(s);
|
|
93
|
-
}
|
|
94
|
-
function parseLrud(s, unit) {
|
|
95
|
-
var value = parseFloat(s);
|
|
96
|
-
return !Number.isFinite(value) || value < 0 ? null : new _unitized.UnitizedNumber(value, unit);
|
|
97
|
-
}
|
|
98
|
-
function parseFromStationLruds(line, distanceUnit) {
|
|
99
|
-
var fromStr = line.substring(0, 5);
|
|
100
|
-
if (!/^\s*\S+$/.test(fromStr)) return undefined;
|
|
101
|
-
var gap = line.substring(5, 40);
|
|
102
|
-
if (gap.trim()) return undefined;
|
|
103
|
-
var lrudStr = line.substring(40, 52);
|
|
104
|
-
if (!/\d/.test(lrudStr)) return undefined;
|
|
105
|
-
var lStr = line.substring(40, 43);
|
|
106
|
-
var rStr = line.substring(43, 46);
|
|
107
|
-
var uStr = line.substring(46, 49);
|
|
108
|
-
var dStr = line.substring(49, 52);
|
|
109
|
-
if (!isValidOptFloat(lStr) || !isValidOptFloat(rStr) || !isValidOptFloat(uStr) || !isValidOptFloat(dStr)) {
|
|
110
|
-
return undefined;
|
|
111
|
-
}
|
|
112
|
-
var up = parseLrud(uStr, distanceUnit);
|
|
113
|
-
var down = parseLrud(dStr, distanceUnit);
|
|
114
|
-
var left = parseLrud(lStr, distanceUnit);
|
|
115
|
-
var right = parseLrud(rStr, distanceUnit);
|
|
116
|
-
return [fromStr.trim(), {
|
|
117
|
-
left: left,
|
|
118
|
-
right: right,
|
|
119
|
-
up: up,
|
|
120
|
-
down: down
|
|
121
|
-
}];
|
|
122
|
-
}
|
|
123
|
-
function getColumnRanges(config) {
|
|
124
|
-
var result = {
|
|
125
|
-
toStation: [0, 0],
|
|
126
|
-
fromStation: [0, 0],
|
|
127
|
-
distance: [0, 0],
|
|
128
|
-
distanceFeet: [0, 0],
|
|
129
|
-
distanceInches: [0, 0],
|
|
130
|
-
kind: [0, 0],
|
|
131
|
-
exclude: [0, 0],
|
|
132
|
-
frontsightAzimuth: [0, 0],
|
|
133
|
-
backsightAzimuth: [0, 0],
|
|
134
|
-
frontsightInclination: [0, 0],
|
|
135
|
-
backsightInclination: [0, 0],
|
|
136
|
-
left: [0, 0],
|
|
137
|
-
right: [0, 0],
|
|
138
|
-
up: [0, 0],
|
|
139
|
-
down: [0, 0]
|
|
140
|
-
};
|
|
141
|
-
var c = 0;
|
|
142
|
-
for (var _i = 0, _arr = Object.entries(config); _i < _arr.length; _i++) {
|
|
143
|
-
var _arr$_i = (0, _slicedToArray2["default"])(_arr[_i], 2),
|
|
144
|
-
key = _arr$_i[0],
|
|
145
|
-
value = _arr$_i[1];
|
|
146
|
-
if (key === 'distanceFeet' || key === 'distanceInches') continue;
|
|
147
|
-
result[key][0] = c;
|
|
148
|
-
result[key][1] = c + value;
|
|
149
|
-
c += value;
|
|
150
|
-
}
|
|
151
|
-
if (config.distanceFeet) {
|
|
152
|
-
result.distanceFeet[0] = result.distance[0];
|
|
153
|
-
result.distanceFeet[1] = result.distance[0] + config.distanceFeet;
|
|
154
|
-
result.distanceInches[0] = result.distanceFeet[1];
|
|
155
|
-
result.distanceInches[1] = result.distanceFeet[1] + config.distanceInches;
|
|
156
|
-
}
|
|
157
|
-
return result;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Parses a raw cdata.fr survey file. These look like so:
|
|
161
|
-
*
|
|
162
|
-
<pre> Fisher Ridge Cave System, Hart Co., KY
|
|
163
|
-
ENTRANCE DROPS, JOE'S "I LOVE MY WIFE TRAVERSE", TRICKY TRAVERSE
|
|
164
|
-
PETER QUICK, KEITH ORTIZ - 2-15-81
|
|
165
|
-
This File has Crumps test connected. 11/20/12
|
|
166
|
-
*
|
|
167
|
-
FT C DD A
|
|
168
|
-
AE20 0 1 3 0 2
|
|
169
|
-
* %FS
|
|
170
|
-
* AE20 0 0 0 Bug-can't put before so put after-so can't make 2 fixed 10/28/12
|
|
171
|
-
AE19 AE20 9.3 60.0 60.0-36.0 2 12 0 20
|
|
172
|
-
AE18 AE19 24.5 0.0 0.0-90.0 6 10 25 0
|
|
173
|
-
AE17 AE18 8.0 350.5 350.5 17.0 3 5 0 0
|
|
174
|
-
AE16 AE17 6.7 0.0 0.0-90.0 3 5 6 1
|
|
175
|
-
AE15 AE16 12.6 70.5 71.0-18.0 4 0 2 1
|
|
176
|
-
AE14 AE15 10.0 21.5 20.0 6.0 5 5 0 3
|
|
177
|
-
AE13 AE14 26.8 288.0 286.0-50.0 0 7 20 5
|
|
178
|
-
*
|
|
179
|
-
*SHORT CANYON AT THE BASE OF THE SECOND DROP
|
|
180
|
-
AE12 AE13 20.7 236.0 236.0 34.0 3 5 4 4
|
|
181
|
-
AE11 AE12 12.4 210.0 210.0 35.0 7 4 5 1
|
|
182
|
-
AE10 AE13 25.7 40.0 40.0 -9.0 2 2 3 6
|
|
183
|
-
*
|
|
184
|
-
*AE10 AT JOE'S " I LOVE MY WIFE TRAVERSE "
|
|
185
|
-
AE9 AE10 17.8 32.5 31.0 23.0 4 5 20 15
|
|
186
|
-
AE1 AE9 13.7 82.0 82.0-13.0
|
|
187
|
-
A1 AE1 34.3 46.0 48.0-17.5
|
|
188
|
-
*
|
|
189
|
-
*SURVEY TO DOME NEAR THE ENTRANCE DOME (ABOVE THE SECOND DROP)
|
|
190
|
-
AD1 AE15 8.0 200.0 200.0 0.0 3 1 1 1
|
|
191
|
-
AD2 AD1 17.7 161.0 161.0 7.0 1 4 25 1
|
|
192
|
-
AD3 AD2 10.4 180.0 180.0 50.0 4 1 15 5
|
|
193
|
-
*
|
|
194
|
-
TRICKY TRAVERSE AND THEN FIRST SURVEY IN UPPER CROWLWAY
|
|
195
|
-
DAN CROWL, KEITH ORTIZ, CHIP HOPPER, PETER QUICK, LARRY BEAN 14 FEB 1981
|
|
196
|
-
*
|
|
197
|
-
FI B DD
|
|
198
|
-
A2 A1 48 10 292.0 110.0-42.0 5 10 35 5
|
|
199
|
-
A3 A2 12 5 333.5 153.5 35.0 3 1 15 5
|
|
200
|
-
A4 A3 4 2 0.0 0.0 90.0 3 1 10 10
|
|
201
|
-
...</pre>
|
|
202
|
-
*
|
|
203
|
-
*/
|
|
204
|
-
function parseFrcsSurveyFile(_x, _x2) {
|
|
205
|
-
return _parseFrcsSurveyFile.apply(this, arguments);
|
|
206
|
-
}
|
|
207
|
-
function _parseFrcsSurveyFile() {
|
|
208
|
-
_parseFrcsSurveyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file,
|
|
209
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
210
|
-
lines) {
|
|
211
|
-
var _ref,
|
|
212
|
-
_ref$columns,
|
|
213
|
-
columns,
|
|
214
|
-
ranges,
|
|
215
|
-
maxRange,
|
|
216
|
-
cave,
|
|
217
|
-
location,
|
|
218
|
-
trips,
|
|
219
|
-
errors,
|
|
220
|
-
tripName,
|
|
221
|
-
tripTeam,
|
|
222
|
-
tripDate,
|
|
223
|
-
inTripComment,
|
|
224
|
-
tripCommentStartLine,
|
|
225
|
-
tripCommentEndLine,
|
|
226
|
-
tripComment,
|
|
227
|
-
commentLines,
|
|
228
|
-
trip,
|
|
229
|
-
inBlockComment,
|
|
230
|
-
section,
|
|
231
|
-
commentFromStationLruds,
|
|
232
|
-
addCommentLine,
|
|
233
|
-
getComment,
|
|
234
|
-
unitsChanged,
|
|
235
|
-
alternateUnits,
|
|
236
|
-
nextShotUnits,
|
|
237
|
-
lineNumber,
|
|
238
|
-
line,
|
|
239
|
-
errored,
|
|
240
|
-
error,
|
|
241
|
-
parseUnits,
|
|
242
|
-
validate,
|
|
243
|
-
addShot,
|
|
244
|
-
began,
|
|
245
|
-
_iteratorAbruptCompletion,
|
|
246
|
-
_didIteratorError,
|
|
247
|
-
_iteratorError,
|
|
248
|
-
_loop,
|
|
249
|
-
_ret,
|
|
250
|
-
_iterator,
|
|
251
|
-
_step,
|
|
252
|
-
_args2 = arguments;
|
|
253
|
-
return _regenerator["default"].wrap(function _callee$(_context2) {
|
|
254
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
255
|
-
case 0:
|
|
256
|
-
getComment = function _getComment() {
|
|
257
|
-
if (!(commentLines !== null && commentLines !== void 0 && commentLines.length)) return null;
|
|
258
|
-
var comment = commentLines.join('\n').trim();
|
|
259
|
-
commentLines.length = 0;
|
|
260
|
-
return comment || null;
|
|
261
|
-
};
|
|
262
|
-
addCommentLine = function _addCommentLine(comment) {
|
|
263
|
-
if (trip) {
|
|
264
|
-
var distanceUnit = trip.header.distanceUnit;
|
|
265
|
-
var parsedFromStationLruds = parseFromStationLruds(comment, distanceUnit);
|
|
266
|
-
if (parsedFromStationLruds) {
|
|
267
|
-
commentFromStationLruds.set(parsedFromStationLruds[0], parsedFromStationLruds[1]);
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
if (commentLines) {
|
|
272
|
-
commentLines.push(comment);
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
_ref = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {}, _ref$columns = _ref.columns, columns = _ref$columns === void 0 ? _FrcsSurveyFile.defaultFrcsShotColumnConfig : _ref$columns;
|
|
276
|
-
ranges = getColumnRanges(columns);
|
|
277
|
-
maxRange = Math.max.apply(Math, (0, _toConsumableArray2["default"])(Object.values(ranges).map(function (r) {
|
|
278
|
-
return r[1];
|
|
279
|
-
})));
|
|
280
|
-
cave = null;
|
|
281
|
-
location = null;
|
|
282
|
-
trips = [];
|
|
283
|
-
errors = [];
|
|
284
|
-
inTripComment = true;
|
|
285
|
-
tripCommentStartLine = 1;
|
|
286
|
-
tripCommentEndLine = -1;
|
|
287
|
-
tripComment = [];
|
|
288
|
-
commentLines = [];
|
|
289
|
-
trip = null;
|
|
290
|
-
inBlockComment = false;
|
|
291
|
-
commentFromStationLruds = new Map();
|
|
292
|
-
unitsChanged = false;
|
|
293
|
-
lineNumber = 0;
|
|
294
|
-
errored = false;
|
|
295
|
-
error = function error(message, startColumn, endColumn) {
|
|
296
|
-
errored = true;
|
|
297
|
-
errors.push(new _parseSegment.SegmentParseError(message, new _parseSegment.Segment({
|
|
298
|
-
value: line,
|
|
299
|
-
source: file,
|
|
300
|
-
startLine: lineNumber,
|
|
301
|
-
startCol: 0
|
|
302
|
-
}).substring(startColumn, endColumn)));
|
|
303
|
-
};
|
|
304
|
-
parseUnits = function parseUnits() {
|
|
305
|
-
// FT CC DD
|
|
306
|
-
// 01234567
|
|
307
|
-
var distanceUnit = parseLengthUnit(line.slice(0, 2));
|
|
308
|
-
if (!distanceUnit) {
|
|
309
|
-
distanceUnit = _unitized.Length.feet;
|
|
310
|
-
error('Invalid distance unit', 0, 2);
|
|
311
|
-
}
|
|
312
|
-
var azimuthUnit = parseAngleUnit(line[6]);
|
|
313
|
-
if (!azimuthUnit) {
|
|
314
|
-
azimuthUnit = _unitized.Angle.degrees;
|
|
315
|
-
error('Invalid azimuth unit', 6, 7);
|
|
316
|
-
}
|
|
317
|
-
var inclinationUnit = parseAngleUnit(line[7]);
|
|
318
|
-
if (!inclinationUnit) {
|
|
319
|
-
inclinationUnit = _unitized.Angle.degrees;
|
|
320
|
-
error('Invalid inclination unit', 7, 8);
|
|
321
|
-
}
|
|
322
|
-
var backsightAzimuthCorrected = line[3] === 'C';
|
|
323
|
-
var backsightInclinationCorrected = line[4] === 'C';
|
|
324
|
-
var hasBacksightAzimuth = line[3] !== ' ' && line[3] !== '-';
|
|
325
|
-
var hasBacksightInclination = line[4] !== ' ' && line[4] !== '-';
|
|
326
|
-
if (!/[-CB ]/.test(line[3])) {
|
|
327
|
-
error('Invalid backsight azimuth type', 3, 4);
|
|
328
|
-
}
|
|
329
|
-
if (!/[-CB ]/.test(line[4])) {
|
|
330
|
-
error('Invalid backsight inclination type', 4, 5);
|
|
331
|
-
}
|
|
332
|
-
return {
|
|
333
|
-
distanceUnit: distanceUnit,
|
|
334
|
-
azimuthUnit: azimuthUnit,
|
|
335
|
-
inclinationUnit: inclinationUnit,
|
|
336
|
-
backsightAzimuthCorrected: backsightAzimuthCorrected,
|
|
337
|
-
backsightInclinationCorrected: backsightInclinationCorrected,
|
|
338
|
-
hasBacksightAzimuth: hasBacksightAzimuth,
|
|
339
|
-
hasBacksightInclination: hasBacksightInclination
|
|
340
|
-
};
|
|
341
|
-
};
|
|
342
|
-
validate = function validate(startColumn, endColumn, fieldName, validator) {
|
|
343
|
-
var field = line.substring(startColumn, endColumn);
|
|
344
|
-
if (!validator(field)) {
|
|
345
|
-
error((field.trim() ? 'Invalid ' : 'Missing ') + fieldName, startColumn, endColumn);
|
|
346
|
-
}
|
|
347
|
-
return field;
|
|
348
|
-
};
|
|
349
|
-
addShot = function addShot(shot) {
|
|
350
|
-
if (!trip) return;
|
|
351
|
-
if (alternateUnits) {
|
|
352
|
-
var recorded = shot;
|
|
353
|
-
shot = _objectSpread(_objectSpread({}, shot), {}, {
|
|
354
|
-
recorded: recorded
|
|
355
|
-
});
|
|
356
|
-
if (nextShotUnits) {
|
|
357
|
-
recorded.units = nextShotUnits;
|
|
358
|
-
nextShotUnits = undefined;
|
|
359
|
-
}
|
|
360
|
-
var _trip$header = trip.header,
|
|
361
|
-
backsightAzimuthCorrected = _trip$header.backsightAzimuthCorrected,
|
|
362
|
-
backsightInclinationCorrected = _trip$header.backsightInclinationCorrected,
|
|
363
|
-
distanceUnit = _trip$header.distanceUnit,
|
|
364
|
-
azimuthUnit = _trip$header.azimuthUnit,
|
|
365
|
-
inclinationUnit = _trip$header.inclinationUnit;
|
|
366
|
-
if (alternateUnits.backsightAzimuthCorrected !== backsightAzimuthCorrected) {
|
|
367
|
-
shot.backsightAzimuth = shot.backsightAzimuth ? _unitized.Angle.opposite(shot.backsightAzimuth) : undefined;
|
|
368
|
-
}
|
|
369
|
-
if (alternateUnits.backsightInclinationCorrected !== backsightInclinationCorrected) {
|
|
370
|
-
var _shot$backsightInclin;
|
|
371
|
-
shot.backsightInclination = (_shot$backsightInclin = shot.backsightInclination) === null || _shot$backsightInclin === void 0 ? void 0 : _shot$backsightInclin.negate();
|
|
372
|
-
}
|
|
373
|
-
if (distanceUnit !== alternateUnits.distanceUnit) {
|
|
374
|
-
shot.distance = shot.distance["in"](distanceUnit);
|
|
375
|
-
if (shot.fromLruds) {
|
|
376
|
-
var _shot$fromLruds$left, _shot$fromLruds$right, _shot$fromLruds$up, _shot$fromLruds$down;
|
|
377
|
-
shot.fromLruds.left = (_shot$fromLruds$left = shot.fromLruds.left) === null || _shot$fromLruds$left === void 0 ? void 0 : _shot$fromLruds$left["in"](distanceUnit);
|
|
378
|
-
shot.fromLruds.right = (_shot$fromLruds$right = shot.fromLruds.right) === null || _shot$fromLruds$right === void 0 ? void 0 : _shot$fromLruds$right["in"](distanceUnit);
|
|
379
|
-
shot.fromLruds.up = (_shot$fromLruds$up = shot.fromLruds.up) === null || _shot$fromLruds$up === void 0 ? void 0 : _shot$fromLruds$up["in"](distanceUnit);
|
|
380
|
-
shot.fromLruds.down = (_shot$fromLruds$down = shot.fromLruds.down) === null || _shot$fromLruds$down === void 0 ? void 0 : _shot$fromLruds$down["in"](distanceUnit);
|
|
381
|
-
}
|
|
382
|
-
if (shot.toLruds) {
|
|
383
|
-
var _shot$toLruds$left, _shot$toLruds$right, _shot$toLruds$up, _shot$toLruds$down;
|
|
384
|
-
shot.toLruds.left = (_shot$toLruds$left = shot.toLruds.left) === null || _shot$toLruds$left === void 0 ? void 0 : _shot$toLruds$left["in"](distanceUnit);
|
|
385
|
-
shot.toLruds.right = (_shot$toLruds$right = shot.toLruds.right) === null || _shot$toLruds$right === void 0 ? void 0 : _shot$toLruds$right["in"](distanceUnit);
|
|
386
|
-
shot.toLruds.up = (_shot$toLruds$up = shot.toLruds.up) === null || _shot$toLruds$up === void 0 ? void 0 : _shot$toLruds$up["in"](distanceUnit);
|
|
387
|
-
shot.toLruds.down = (_shot$toLruds$down = shot.toLruds.down) === null || _shot$toLruds$down === void 0 ? void 0 : _shot$toLruds$down["in"](distanceUnit);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
if (azimuthUnit !== alternateUnits.azimuthUnit) {
|
|
391
|
-
var _shot$frontsightAzimu, _shot$backsightAzimut;
|
|
392
|
-
shot.frontsightAzimuth = (_shot$frontsightAzimu = shot.frontsightAzimuth) === null || _shot$frontsightAzimu === void 0 ? void 0 : _shot$frontsightAzimu["in"](azimuthUnit);
|
|
393
|
-
shot.backsightAzimuth = (_shot$backsightAzimut = shot.backsightAzimuth) === null || _shot$backsightAzimut === void 0 ? void 0 : _shot$backsightAzimut["in"](azimuthUnit);
|
|
394
|
-
}
|
|
395
|
-
if (inclinationUnit !== alternateUnits.inclinationUnit) {
|
|
396
|
-
var _shot$frontsightIncli, _shot$backsightInclin2;
|
|
397
|
-
shot.frontsightInclination = (_shot$frontsightIncli = shot.frontsightInclination) === null || _shot$frontsightIncli === void 0 ? void 0 : _shot$frontsightIncli["in"](inclinationUnit);
|
|
398
|
-
shot.backsightInclination = (_shot$backsightInclin2 = shot.backsightInclination) === null || _shot$backsightInclin2 === void 0 ? void 0 : _shot$backsightInclin2["in"](inclinationUnit);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
trip.shots.push(shot);
|
|
402
|
-
};
|
|
403
|
-
began = false;
|
|
404
|
-
_iteratorAbruptCompletion = false;
|
|
405
|
-
_didIteratorError = false;
|
|
406
|
-
_context2.prev = 27;
|
|
407
|
-
_loop = /*#__PURE__*/_regenerator["default"].mark(function _loop() {
|
|
408
|
-
var match, _match, _match$k, k, team, dateMatch, month, day, year, _match2, _line, _line2, _line3, _line4, _ref2, distanceUnit, _ref3, azimuthUnit, inclinationUnit, inches, fromStr, from, lStr, rStr, uStr, dStr, up, down, left, right, toStr, _shot, fromLruds, fromLrudMatch, _fromLrudMatch$1$trim, _fromLrudMatch$1$trim2, _left, _right, _up, _down, comment, azmFsStr, azmBsStr, incFsStr, incBsStr, kind, distance, horizontalDistance, verticalDistance, frontsightInclination, backsightInclination, excludeDistance, isSplay, _line5, _line6, feetStr, inchesStr, invalid, offset, exclude, _line7, _line8, _feetStr, _exclude, h, v, d, _v, frontsightAzimuth, backsightAzimuth, shot;
|
|
409
|
-
return _regenerator["default"].wrap(function _loop$(_context) {
|
|
410
|
-
while (1) switch (_context.prev = _context.next) {
|
|
411
|
-
case 0:
|
|
412
|
-
line = _step.value;
|
|
413
|
-
errored = false;
|
|
414
|
-
lineNumber++;
|
|
415
|
-
if (began) {
|
|
416
|
-
_context.next = 10;
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
if (!/^\s+\*/.test(line)) {
|
|
420
|
-
_context.next = 7;
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
lineNumber++;
|
|
424
|
-
return _context.abrupt("return", 0);
|
|
425
|
-
case 7:
|
|
426
|
-
began = true;
|
|
427
|
-
match = /^\s*([^,]+)(,(.*))?/.exec(line);
|
|
428
|
-
if (match) {
|
|
429
|
-
cave = match[1].trim();
|
|
430
|
-
if (match[3]) {
|
|
431
|
-
location = match[3].trim();
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
case 10:
|
|
435
|
-
if (!unitsChanged) {
|
|
436
|
-
_context.next = 16;
|
|
437
|
-
break;
|
|
438
|
-
}
|
|
439
|
-
unitsChanged = false;
|
|
440
|
-
alternateUnits = parseUnits();
|
|
441
|
-
nextShotUnits = alternateUnits;
|
|
442
|
-
_context.next = 113;
|
|
443
|
-
break;
|
|
444
|
-
case 16:
|
|
445
|
-
if (!/^\s{1,8}\*/.test(line)) {
|
|
446
|
-
_context.next = 23;
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
inTripComment = !inTripComment;
|
|
450
|
-
alternateUnits = nextShotUnits = undefined;
|
|
451
|
-
unitsChanged = false;
|
|
452
|
-
if (inTripComment) {
|
|
453
|
-
section = undefined;
|
|
454
|
-
tripTeam = undefined;
|
|
455
|
-
tripDate = undefined;
|
|
456
|
-
tripComment.length = 0;
|
|
457
|
-
tripCommentStartLine = lineNumber;
|
|
458
|
-
} else {
|
|
459
|
-
tripCommentEndLine = lineNumber;
|
|
460
|
-
}
|
|
461
|
-
_context.next = 113;
|
|
462
|
-
break;
|
|
463
|
-
case 23:
|
|
464
|
-
if (!inTripComment) {
|
|
465
|
-
_context.next = 29;
|
|
466
|
-
break;
|
|
467
|
-
}
|
|
468
|
-
if (lineNumber === tripCommentStartLine + 1) {
|
|
469
|
-
tripName = line && line.trim();
|
|
470
|
-
} else if (lineNumber === tripCommentStartLine + 2) {
|
|
471
|
-
_match = /^(.+?,.+?)\s*(?:[-.](.*))?$/.exec(line && line.trim());
|
|
472
|
-
if (_match) {
|
|
473
|
-
k = 1;
|
|
474
|
-
team = _match[k++];
|
|
475
|
-
tripTeam = team.split(team.indexOf(';') >= 0 ? /\s*;\s*/g : /\s*,\s*/g);
|
|
476
|
-
dateMatch = /^(\d+)[-/](\d+)[-/](\d+)$/.exec((_match$k = _match[k++]) === null || _match$k === void 0 ? void 0 : _match$k.trim());
|
|
477
|
-
if (dateMatch) {
|
|
478
|
-
month = parseInt(dateMatch[1]);
|
|
479
|
-
day = parseInt(dateMatch[2]);
|
|
480
|
-
year = parseInt(dateMatch[3]);
|
|
481
|
-
tripDate = new Date(year < 70 ? year + 2000 : year, month - 1, day);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
} else if (lineNumber > 1) {
|
|
485
|
-
tripComment.push(line);
|
|
486
|
-
}
|
|
487
|
-
_match2 = /^\*\*\*([^*])\*\*\*/.exec(line);
|
|
488
|
-
if (_match2) {
|
|
489
|
-
section = _match2[1].trim();
|
|
490
|
-
}
|
|
491
|
-
_context.next = 113;
|
|
492
|
-
break;
|
|
493
|
-
case 29:
|
|
494
|
-
if (!/^(\s{9,}|)\*/.test(line)) {
|
|
495
|
-
_context.next = 36;
|
|
496
|
-
break;
|
|
497
|
-
}
|
|
498
|
-
if (/^\*\s*%NC(\b|$)/.test(line)) {
|
|
499
|
-
unitsChanged = true;
|
|
500
|
-
}
|
|
501
|
-
if (!/^\*\s*%/.test(line)) {
|
|
502
|
-
_context.next = 33;
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
return _context.abrupt("return", 0);
|
|
506
|
-
case 33:
|
|
507
|
-
if (/[^\s*]/.test(line)) {
|
|
508
|
-
addCommentLine(line.replace(/^\s*\*/, ''));
|
|
509
|
-
inBlockComment = false;
|
|
510
|
-
} else {
|
|
511
|
-
inBlockComment = !inBlockComment;
|
|
512
|
-
if (inBlockComment) commentLines.length = 0;
|
|
513
|
-
}
|
|
514
|
-
_context.next = 113;
|
|
515
|
-
break;
|
|
516
|
-
case 36:
|
|
517
|
-
if (!inBlockComment) {
|
|
518
|
-
_context.next = 40;
|
|
519
|
-
break;
|
|
520
|
-
}
|
|
521
|
-
addCommentLine(line);
|
|
522
|
-
_context.next = 113;
|
|
523
|
-
break;
|
|
524
|
-
case 40:
|
|
525
|
-
if (!(lineNumber === tripCommentEndLine + 1)) {
|
|
526
|
-
_context.next = 45;
|
|
527
|
-
break;
|
|
528
|
-
}
|
|
529
|
-
trip = {
|
|
530
|
-
header: _objectSpread({
|
|
531
|
-
name: tripName || '',
|
|
532
|
-
comment: tripComment && tripComment.join('\n') || null,
|
|
533
|
-
section: section,
|
|
534
|
-
date: tripDate,
|
|
535
|
-
team: tripTeam
|
|
536
|
-
}, parseUnits()),
|
|
537
|
-
shots: []
|
|
538
|
-
};
|
|
539
|
-
trips.push(trip);
|
|
540
|
-
_context.next = 113;
|
|
541
|
-
break;
|
|
542
|
-
case 45:
|
|
543
|
-
if (!trip) {
|
|
544
|
-
_context.next = 113;
|
|
545
|
-
break;
|
|
546
|
-
}
|
|
547
|
-
_ref2 = alternateUnits || trip.header, distanceUnit = _ref2.distanceUnit;
|
|
548
|
-
_ref3 = alternateUnits || trip.header, azimuthUnit = _ref3.azimuthUnit, inclinationUnit = _ref3.inclinationUnit;
|
|
549
|
-
inches = distanceUnit === _unitized.Length.inches;
|
|
550
|
-
if (inches) distanceUnit = _unitized.Length.feet;
|
|
551
|
-
|
|
552
|
-
// rigorously check the values in all the columns to make sure this
|
|
553
|
-
// is really a survey shot line, just in case any stray comments are
|
|
554
|
-
// not properly delimited.
|
|
555
|
-
|
|
556
|
-
// from station name
|
|
557
|
-
if (/\S/.test((_line = line).substring.apply(_line, (0, _toConsumableArray2["default"])(ranges.fromStation)))) {
|
|
558
|
-
_context.next = 52;
|
|
559
|
-
break;
|
|
560
|
-
}
|
|
561
|
-
return _context.abrupt("return", 0);
|
|
562
|
-
case 52:
|
|
563
|
-
fromStr = validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.fromStation).concat(['from station', isValidStation]));
|
|
564
|
-
from = fromStr.trim(); // Sadly I have found negative LRUD values in Chip's format and apparently
|
|
565
|
-
// his program doesn't fail on them, so I have to accept them here
|
|
566
|
-
// isValidOptFloat instead of isValidOptUFloat
|
|
567
|
-
lStr = validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.left).concat(['left', isValidOptFloat]));
|
|
568
|
-
rStr = validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.right).concat(['right', isValidOptFloat]));
|
|
569
|
-
uStr = validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.up).concat(['up', isValidOptFloat]));
|
|
570
|
-
dStr = validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.down).concat(['down', isValidOptFloat]));
|
|
571
|
-
if (!errored) {
|
|
572
|
-
_context.next = 60;
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
return _context.abrupt("return", 0);
|
|
576
|
-
case 60:
|
|
577
|
-
up = parseLrud(uStr, distanceUnit);
|
|
578
|
-
down = parseLrud(dStr, distanceUnit);
|
|
579
|
-
left = parseLrud(lStr, distanceUnit);
|
|
580
|
-
right = parseLrud(rStr, distanceUnit); // to station name
|
|
581
|
-
toStr = (_line2 = line).substring.apply(_line2, (0, _toConsumableArray2["default"])(ranges.toStation));
|
|
582
|
-
if (toStr.trim()) {
|
|
583
|
-
_context.next = 69;
|
|
584
|
-
break;
|
|
585
|
-
}
|
|
586
|
-
_shot = {
|
|
587
|
-
from: from,
|
|
588
|
-
to: null,
|
|
589
|
-
kind: _FrcsShot.FrcsShotKind.Normal,
|
|
590
|
-
distance: new _unitized.UnitizedNumber(0, distanceUnit),
|
|
591
|
-
frontsightAzimuth: null,
|
|
592
|
-
backsightAzimuth: null,
|
|
593
|
-
frontsightInclination: null,
|
|
594
|
-
backsightInclination: null,
|
|
595
|
-
fromLruds: {
|
|
596
|
-
left: left,
|
|
597
|
-
right: right,
|
|
598
|
-
up: up,
|
|
599
|
-
down: down
|
|
600
|
-
},
|
|
601
|
-
excludeDistance: true,
|
|
602
|
-
comment: getComment()
|
|
603
|
-
};
|
|
604
|
-
addShot(_shot);
|
|
605
|
-
return _context.abrupt("return", 0);
|
|
606
|
-
case 69:
|
|
607
|
-
if (!isValidStation(toStr)) {
|
|
608
|
-
error.apply(void 0, ['Invalid station name'].concat((0, _toConsumableArray2["default"])(ranges.toStation)));
|
|
609
|
-
}
|
|
610
|
-
fromLruds = commentFromStationLruds.get(from);
|
|
611
|
-
if (fromLruds) {
|
|
612
|
-
commentFromStationLruds["delete"](from);
|
|
613
|
-
} else {
|
|
614
|
-
fromLrudMatch = new RegExp("^\\s+".concat(fromStr.trim().replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "((\\s+(\\d+(\\.\\d*)?|\\.\\d+)){4})")).exec(line.substring(maxRange));
|
|
615
|
-
if (fromLrudMatch) {
|
|
616
|
-
_fromLrudMatch$1$trim = fromLrudMatch[1].trim().split(/\s+/g).map(function (s) {
|
|
617
|
-
return parseLrud(s, distanceUnit);
|
|
618
|
-
}), _fromLrudMatch$1$trim2 = (0, _slicedToArray2["default"])(_fromLrudMatch$1$trim, 4), _left = _fromLrudMatch$1$trim2[0], _right = _fromLrudMatch$1$trim2[1], _up = _fromLrudMatch$1$trim2[2], _down = _fromLrudMatch$1$trim2[3];
|
|
619
|
-
fromLruds = {
|
|
620
|
-
left: _left,
|
|
621
|
-
right: _right,
|
|
622
|
-
up: _up,
|
|
623
|
-
down: _down
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
comment = getComment(); // azimuth and inclination
|
|
628
|
-
azmFsStr = validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.frontsightAzimuth).concat(['azimuth', isValidOptUFloat]));
|
|
629
|
-
azmBsStr = validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.backsightAzimuth).concat(['azimuth', isValidOptUFloat]));
|
|
630
|
-
incFsStr = (_line3 = line).substring.apply(_line3, (0, _toConsumableArray2["default"])(ranges.frontsightInclination));
|
|
631
|
-
incBsStr = (_line4 = line).substring.apply(_line4, (0, _toConsumableArray2["default"])(ranges.backsightInclination));
|
|
632
|
-
if (!errored) {
|
|
633
|
-
_context.next = 79;
|
|
634
|
-
break;
|
|
635
|
-
}
|
|
636
|
-
return _context.abrupt("return", 0);
|
|
637
|
-
case 79:
|
|
638
|
-
if (!inches) {
|
|
639
|
-
_context.next = 94;
|
|
640
|
-
break;
|
|
641
|
-
}
|
|
642
|
-
feetStr = (_line5 = line).substring.apply(_line5, (0, _toConsumableArray2["default"])(ranges.distanceFeet));
|
|
643
|
-
inchesStr = (_line6 = line).substring.apply(_line6, (0, _toConsumableArray2["default"])(ranges.distanceInches)); // feet and inches are not both optional
|
|
644
|
-
if (!(!isValidUInt(feetStr) && !isValidUInt(inchesStr))) {
|
|
645
|
-
_context.next = 86;
|
|
646
|
-
break;
|
|
647
|
-
}
|
|
648
|
-
invalid = feetStr.trim() || inchesStr.trim();
|
|
649
|
-
error(invalid ? 'Invalid distance' : 'Missing distance', ranges.distanceFeet[0], ranges.distanceInches[1]);
|
|
650
|
-
return _context.abrupt("return", 0);
|
|
651
|
-
case 86:
|
|
652
|
-
// sometimes inches are omitted, hence the || 0...I'm assuming it's possible
|
|
653
|
-
// for feet to be omitted as well
|
|
654
|
-
distance = _unitized.Unitize.inches(parseFloat(inchesStr) || 0).add(_unitized.Unitize.feet(parseFloat(feetStr) || 0));
|
|
655
|
-
offset = ranges.kind[0] === ranges.distance[1] ? ranges.distanceInches[1] - ranges.distance[1] : 0;
|
|
656
|
-
kind = parseKind(line.substring(ranges.kind[0] + offset, ranges.kind[1] + offset).trim());
|
|
657
|
-
exclude = line.substring(ranges.exclude[0] + offset, ranges.exclude[1] + offset).trim(); // NOTE there are two columns around here that can contain a *.
|
|
658
|
-
// I think they might represent different values, but thisis confused by
|
|
659
|
-
// the fact that for ft/in shots, if there is a D or H flag it occupies the
|
|
660
|
-
// first column that can contain a * for decimal feet shots
|
|
661
|
-
excludeDistance = exclude === '*' || exclude === 's';
|
|
662
|
-
isSplay = exclude === 's';
|
|
663
|
-
_context.next = 100;
|
|
664
|
-
break;
|
|
665
|
-
case 94:
|
|
666
|
-
// decimal feet are not optional
|
|
667
|
-
_feetStr = validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.distance).concat(['distance', isValidUFloat]));
|
|
668
|
-
distance = new _unitized.UnitizedNumber(parseFloat(_feetStr), distanceUnit);
|
|
669
|
-
kind = parseKind((_line7 = line).substring.apply(_line7, (0, _toConsumableArray2["default"])(ranges.kind)).trim());
|
|
670
|
-
_exclude = (_line8 = line).substring.apply(_line8, (0, _toConsumableArray2["default"])(ranges.exclude)).trim();
|
|
671
|
-
excludeDistance = _exclude === '*' || _exclude === 's';
|
|
672
|
-
isSplay = _exclude === 's';
|
|
673
|
-
case 100:
|
|
674
|
-
if (kind !== _FrcsShot.FrcsShotKind.Normal) {
|
|
675
|
-
validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.frontsightInclination).concat(['vertical-distance', isValidFloat]));
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
// convert horizontal and diagonal shots to standard
|
|
679
|
-
// in this case incFs is the vertical offset between stations
|
|
680
|
-
// fortunately it appears we can always count on incFs being specified
|
|
681
|
-
// and incBs not being specified for these types of shots
|
|
682
|
-
if (kind === _FrcsShot.FrcsShotKind.Horizontal) {
|
|
683
|
-
// distance is horizontal offset and incFsStr is vertical offset
|
|
684
|
-
horizontalDistance = distance;
|
|
685
|
-
h = horizontalDistance.get(distanceUnit);
|
|
686
|
-
v = parseFloat(incFsStr);
|
|
687
|
-
verticalDistance = new _unitized.UnitizedNumber(v, distanceUnit);
|
|
688
|
-
distance = new _unitized.UnitizedNumber(Math.sqrt(h * h + v * v), distanceUnit);
|
|
689
|
-
frontsightInclination = _unitized.Angle.atan2(verticalDistance, horizontalDistance);
|
|
690
|
-
backsightInclination = null;
|
|
691
|
-
} else if (kind === _FrcsShot.FrcsShotKind.Diagonal) {
|
|
692
|
-
// distance is as usual, but incFsStr is vertical offset
|
|
693
|
-
d = distance.get(distanceUnit);
|
|
694
|
-
_v = parseFloat(incFsStr);
|
|
695
|
-
verticalDistance = new _unitized.UnitizedNumber(_v, distanceUnit);
|
|
696
|
-
frontsightInclination = _unitized.Angle.asin(_v / d);
|
|
697
|
-
backsightInclination = null;
|
|
698
|
-
} else {
|
|
699
|
-
// frontsight inclination
|
|
700
|
-
validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.frontsightInclination).concat(['inclination', isValidOptInclination]));
|
|
701
|
-
// backsight inclination
|
|
702
|
-
validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.backsightInclination).concat(['inclination', isValidOptInclination]));
|
|
703
|
-
frontsightInclination = parseNumber(incFsStr, inclinationUnit);
|
|
704
|
-
backsightInclination = parseNumber(incBsStr, inclinationUnit);
|
|
705
|
-
}
|
|
706
|
-
if (!errored) {
|
|
707
|
-
_context.next = 104;
|
|
708
|
-
break;
|
|
709
|
-
}
|
|
710
|
-
return _context.abrupt("return", 0);
|
|
711
|
-
case 104:
|
|
712
|
-
frontsightAzimuth = parseAzimuth(azmFsStr, azimuthUnit);
|
|
713
|
-
backsightAzimuth = parseAzimuth(azmBsStr, azimuthUnit);
|
|
714
|
-
if (!frontsightInclination && !backsightInclination) {
|
|
715
|
-
frontsightInclination = _unitized.Unitize.degrees(0);
|
|
716
|
-
}
|
|
717
|
-
shot = {
|
|
718
|
-
from: from,
|
|
719
|
-
to: toStr.trim(),
|
|
720
|
-
kind: kind,
|
|
721
|
-
distance: distance,
|
|
722
|
-
frontsightAzimuth: frontsightAzimuth,
|
|
723
|
-
backsightAzimuth: backsightAzimuth,
|
|
724
|
-
frontsightInclination: frontsightInclination,
|
|
725
|
-
backsightInclination: backsightInclination,
|
|
726
|
-
toLruds: {
|
|
727
|
-
left: left,
|
|
728
|
-
right: right,
|
|
729
|
-
up: up,
|
|
730
|
-
down: down
|
|
731
|
-
},
|
|
732
|
-
excludeDistance: excludeDistance,
|
|
733
|
-
comment: comment
|
|
734
|
-
};
|
|
735
|
-
if (isSplay) shot.isSplay = true;
|
|
736
|
-
if (fromLruds) shot.fromLruds = fromLruds;
|
|
737
|
-
if (horizontalDistance) shot.horizontalDistance = horizontalDistance;
|
|
738
|
-
if (verticalDistance) shot.verticalDistance = verticalDistance;
|
|
739
|
-
addShot(shot);
|
|
740
|
-
case 113:
|
|
741
|
-
case "end":
|
|
742
|
-
return _context.stop();
|
|
743
|
-
}
|
|
744
|
-
}, _loop);
|
|
745
|
-
});
|
|
746
|
-
_iterator = _asyncIterator(lines);
|
|
747
|
-
case 30:
|
|
748
|
-
_context2.next = 32;
|
|
749
|
-
return _iterator.next();
|
|
750
|
-
case 32:
|
|
751
|
-
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
|
752
|
-
_context2.next = 40;
|
|
753
|
-
break;
|
|
754
|
-
}
|
|
755
|
-
return _context2.delegateYield(_loop(), "t0", 34);
|
|
756
|
-
case 34:
|
|
757
|
-
_ret = _context2.t0;
|
|
758
|
-
if (!(_ret === 0)) {
|
|
759
|
-
_context2.next = 37;
|
|
760
|
-
break;
|
|
761
|
-
}
|
|
762
|
-
return _context2.abrupt("continue", 37);
|
|
763
|
-
case 37:
|
|
764
|
-
_iteratorAbruptCompletion = false;
|
|
765
|
-
_context2.next = 30;
|
|
766
|
-
break;
|
|
767
|
-
case 40:
|
|
768
|
-
_context2.next = 46;
|
|
769
|
-
break;
|
|
770
|
-
case 42:
|
|
771
|
-
_context2.prev = 42;
|
|
772
|
-
_context2.t1 = _context2["catch"](27);
|
|
773
|
-
_didIteratorError = true;
|
|
774
|
-
_iteratorError = _context2.t1;
|
|
775
|
-
case 46:
|
|
776
|
-
_context2.prev = 46;
|
|
777
|
-
_context2.prev = 47;
|
|
778
|
-
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
779
|
-
_context2.next = 51;
|
|
780
|
-
break;
|
|
781
|
-
}
|
|
782
|
-
_context2.next = 51;
|
|
783
|
-
return _iterator["return"]();
|
|
784
|
-
case 51:
|
|
785
|
-
_context2.prev = 51;
|
|
786
|
-
if (!_didIteratorError) {
|
|
787
|
-
_context2.next = 54;
|
|
788
|
-
break;
|
|
789
|
-
}
|
|
790
|
-
throw _iteratorError;
|
|
791
|
-
case 54:
|
|
792
|
-
return _context2.finish(51);
|
|
793
|
-
case 55:
|
|
794
|
-
return _context2.finish(46);
|
|
795
|
-
case 56:
|
|
796
|
-
return _context2.abrupt("return", {
|
|
797
|
-
cave: cave,
|
|
798
|
-
columns: columns,
|
|
799
|
-
location: location,
|
|
800
|
-
trips: trips,
|
|
801
|
-
errors: errors
|
|
802
|
-
});
|
|
803
|
-
case 57:
|
|
804
|
-
case "end":
|
|
805
|
-
return _context2.stop();
|
|
806
|
-
}
|
|
807
|
-
}, _callee, null, [[27, 42, 46, 56], [47,, 51, 55]]);
|
|
808
|
-
}));
|
|
809
|
-
return _parseFrcsSurveyFile.apply(this, arguments);
|
|
810
|
-
}
|
|
811
|
-
module.exports = exports.default;
|
|
812
|
-
//# sourceMappingURL=parseFrcsSurveyFile.js.map
|