@speleotica/frcsdata 4.1.1 → 4.3.0
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/FrcsShot.d.ts +11 -0
- package/FrcsSurveyFile.d.ts +19 -0
- package/FrcsSurveyFile.js +19 -1
- package/FrcsTrip.d.ts +8 -6
- package/formatFrcsShot.d.ts +7 -2
- package/formatFrcsShot.js +85 -62
- package/formatFrcsSurveyFile.d.ts +2 -0
- package/formatFrcsSurveyFile.js +164 -0
- package/index.d.ts +2 -1
- package/index.js +8 -1
- package/node/index.d.ts +1 -1
- package/node/index.js +4 -1
- package/package.json +2 -2
- package/parseFrcsSurveyFile.d.ts +49 -46
- package/parseFrcsSurveyFile.js +427 -238
- package/string/index.d.ts +1 -1
- package/string/index.js +4 -1
- package/web/index.d.ts +4 -4
- package/web/index.js +11 -2
package/parseFrcsSurveyFile.js
CHANGED
|
@@ -6,11 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = parseFrcsSurveyFile;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _FrcsSurveyFile = require("./FrcsSurveyFile.js");
|
|
11
14
|
var _parseSegment = require("parse-segment");
|
|
12
15
|
var _unitized = require("@speleotica/unitized");
|
|
13
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; }
|
|
14
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"); }
|
|
15
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); }
|
|
16
21
|
function parseNumber(s, unit) {
|
|
@@ -40,6 +45,7 @@ function parseLengthUnit(unit) {
|
|
|
40
45
|
case 'FT':
|
|
41
46
|
return _unitized.Length.feet;
|
|
42
47
|
case 'MT':
|
|
48
|
+
case 'MM':
|
|
43
49
|
case 'M ':
|
|
44
50
|
return _unitized.Length.meters;
|
|
45
51
|
}
|
|
@@ -114,52 +120,87 @@ function parseFromStationLruds(line, distanceUnit) {
|
|
|
114
120
|
down: down
|
|
115
121
|
}];
|
|
116
122
|
}
|
|
117
|
-
|
|
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
|
+
}
|
|
118
159
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<pre> Fisher Ridge Cave System, Hart Co., KY
|
|
122
|
-
ENTRANCE DROPS, JOE'S "I LOVE MY WIFE TRAVERSE", TRICKY TRAVERSE
|
|
123
|
-
PETER QUICK, KEITH ORTIZ - 2-15-81
|
|
124
|
-
This File has Crumps test connected. 11/20/12
|
|
125
|
-
|
|
126
|
-
FT C DD A
|
|
127
|
-
|
|
128
|
-
* %FS
|
|
129
|
-
* AE20 0 0 0 Bug-can't put before so put after-so can't make 2 fixed 10/28/12
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
*
|
|
138
|
-
*SHORT CANYON AT THE BASE OF THE SECOND DROP
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*
|
|
143
|
-
*AE10 AT JOE'S " I LOVE MY WIFE TRAVERSE "
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
*
|
|
148
|
-
*SURVEY TO DOME NEAR THE ENTRANCE DOME (ABOVE THE SECOND DROP)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
TRICKY TRAVERSE AND THEN FIRST SURVEY IN UPPER CROWLWAY
|
|
154
|
-
DAN CROWL, KEITH ORTIZ, CHIP HOPPER, PETER QUICK, LARRY BEAN 14 FEB 1981
|
|
155
|
-
|
|
156
|
-
FI B DD
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
...</pre>
|
|
161
|
-
|
|
162
|
-
|
|
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
|
+
*/
|
|
163
204
|
function parseFrcsSurveyFile(_x, _x2) {
|
|
164
205
|
return _parseFrcsSurveyFile.apply(this, arguments);
|
|
165
206
|
}
|
|
@@ -167,14 +208,55 @@ function _parseFrcsSurveyFile() {
|
|
|
167
208
|
_parseFrcsSurveyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file,
|
|
168
209
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
169
210
|
lines) {
|
|
170
|
-
var
|
|
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;
|
|
171
253
|
return _regenerator["default"].wrap(function _callee$(_context2) {
|
|
172
254
|
while (1) switch (_context2.prev = _context2.next) {
|
|
173
255
|
case 0:
|
|
174
256
|
getComment = function _getComment() {
|
|
175
|
-
if (!commentLines) return null;
|
|
257
|
+
if (!(commentLines !== null && commentLines !== void 0 && commentLines.length)) return null;
|
|
176
258
|
var comment = commentLines.join('\n').trim();
|
|
177
|
-
commentLines =
|
|
259
|
+
commentLines.length = 0;
|
|
178
260
|
return comment || null;
|
|
179
261
|
};
|
|
180
262
|
addCommentLine = function _addCommentLine(comment) {
|
|
@@ -190,6 +272,11 @@ function _parseFrcsSurveyFile() {
|
|
|
190
272
|
commentLines.push(comment);
|
|
191
273
|
}
|
|
192
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
|
+
})));
|
|
193
280
|
cave = null;
|
|
194
281
|
location = null;
|
|
195
282
|
trips = [];
|
|
@@ -198,79 +285,201 @@ function _parseFrcsSurveyFile() {
|
|
|
198
285
|
tripCommentStartLine = 1;
|
|
199
286
|
tripCommentEndLine = -1;
|
|
200
287
|
tripComment = [];
|
|
201
|
-
commentLines =
|
|
288
|
+
commentLines = [];
|
|
202
289
|
trip = null;
|
|
203
290
|
inBlockComment = false;
|
|
204
291
|
commentFromStationLruds = new Map();
|
|
292
|
+
unitsChanged = false;
|
|
205
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;
|
|
206
404
|
_iteratorAbruptCompletion = false;
|
|
207
405
|
_didIteratorError = false;
|
|
208
|
-
_context2.prev =
|
|
406
|
+
_context2.prev = 27;
|
|
209
407
|
_loop = /*#__PURE__*/_regenerator["default"].mark(function _loop() {
|
|
210
|
-
var
|
|
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;
|
|
211
409
|
return _regenerator["default"].wrap(function _loop$(_context) {
|
|
212
410
|
while (1) switch (_context.prev = _context.next) {
|
|
213
411
|
case 0:
|
|
214
412
|
line = _step.value;
|
|
215
413
|
errored = false;
|
|
216
|
-
thisLineNumber = lineNumber;
|
|
217
|
-
error = function error(message, startColumn, endColumn) {
|
|
218
|
-
errored = true;
|
|
219
|
-
errors.push(new _parseSegment.SegmentParseError(message, new _parseSegment.Segment({
|
|
220
|
-
value: line,
|
|
221
|
-
source: file,
|
|
222
|
-
startLine: thisLineNumber,
|
|
223
|
-
startCol: 0
|
|
224
|
-
}).substring(startColumn, endColumn)));
|
|
225
|
-
};
|
|
226
|
-
validate = function validate(startColumn, endColumn, fieldName, validator) {
|
|
227
|
-
var field = line.substring(startColumn, endColumn);
|
|
228
|
-
if (!validator(field)) {
|
|
229
|
-
error((field.trim() ? 'Invalid ' : 'Missing ') + fieldName, startColumn, endColumn);
|
|
230
|
-
}
|
|
231
|
-
return field;
|
|
232
|
-
};
|
|
233
414
|
lineNumber++;
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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();
|
|
241
432
|
}
|
|
242
433
|
}
|
|
243
|
-
|
|
244
|
-
|
|
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;
|
|
245
447
|
break;
|
|
246
448
|
}
|
|
247
449
|
inTripComment = !inTripComment;
|
|
450
|
+
alternateUnits = nextShotUnits = undefined;
|
|
451
|
+
unitsChanged = false;
|
|
248
452
|
if (inTripComment) {
|
|
249
453
|
section = undefined;
|
|
250
|
-
|
|
454
|
+
tripTeam = undefined;
|
|
455
|
+
tripDate = undefined;
|
|
456
|
+
tripComment.length = 0;
|
|
251
457
|
tripCommentStartLine = lineNumber;
|
|
252
458
|
} else {
|
|
253
459
|
tripCommentEndLine = lineNumber;
|
|
254
460
|
}
|
|
255
|
-
_context.next =
|
|
461
|
+
_context.next = 113;
|
|
256
462
|
break;
|
|
257
|
-
case
|
|
463
|
+
case 23:
|
|
258
464
|
if (!inTripComment) {
|
|
259
|
-
_context.next =
|
|
465
|
+
_context.next = 29;
|
|
260
466
|
break;
|
|
261
467
|
}
|
|
262
468
|
if (lineNumber === tripCommentStartLine + 1) {
|
|
263
469
|
tripName = line && line.trim();
|
|
264
470
|
} else if (lineNumber === tripCommentStartLine + 2) {
|
|
265
|
-
_match = /^(
|
|
471
|
+
_match = /^(.+?,.+?)\s*(?:[-.](.*))?$/.exec(line && line.trim());
|
|
266
472
|
if (_match) {
|
|
267
473
|
k = 1;
|
|
268
474
|
team = _match[k++];
|
|
269
|
-
month = parseInt(_match[k++]);
|
|
270
|
-
day = parseInt(_match[k++]);
|
|
271
|
-
year = parseInt(_match[k++]);
|
|
272
|
-
tripDate = new Date(year < 70 ? year + 2000 : year, month - 1, day);
|
|
273
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
|
+
}
|
|
274
483
|
}
|
|
275
484
|
} else if (lineNumber > 1) {
|
|
276
485
|
tripComment.push(line);
|
|
@@ -279,129 +488,106 @@ function _parseFrcsSurveyFile() {
|
|
|
279
488
|
if (_match2) {
|
|
280
489
|
section = _match2[1].trim();
|
|
281
490
|
}
|
|
282
|
-
_context.next =
|
|
491
|
+
_context.next = 113;
|
|
283
492
|
break;
|
|
284
|
-
case
|
|
285
|
-
if (
|
|
286
|
-
_context.next =
|
|
493
|
+
case 29:
|
|
494
|
+
if (!/^(\s{9,}|)\*/.test(line)) {
|
|
495
|
+
_context.next = 36;
|
|
287
496
|
break;
|
|
288
497
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
498
|
+
if (/^\*\s*%NC(\b|$)/.test(line)) {
|
|
499
|
+
unitsChanged = true;
|
|
500
|
+
}
|
|
501
|
+
if (!/^\*\s*%/.test(line)) {
|
|
502
|
+
_context.next = 33;
|
|
503
|
+
break;
|
|
293
504
|
}
|
|
294
|
-
_context.
|
|
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;
|
|
295
515
|
break;
|
|
296
|
-
case
|
|
516
|
+
case 36:
|
|
297
517
|
if (!inBlockComment) {
|
|
298
|
-
_context.next =
|
|
518
|
+
_context.next = 40;
|
|
299
519
|
break;
|
|
300
520
|
}
|
|
301
521
|
addCommentLine(line);
|
|
302
|
-
_context.next =
|
|
522
|
+
_context.next = 113;
|
|
303
523
|
break;
|
|
304
|
-
case
|
|
524
|
+
case 40:
|
|
305
525
|
if (!(lineNumber === tripCommentEndLine + 1)) {
|
|
306
|
-
_context.next =
|
|
526
|
+
_context.next = 45;
|
|
307
527
|
break;
|
|
308
528
|
}
|
|
309
|
-
// FT CC DD
|
|
310
|
-
// 01234567
|
|
311
|
-
distanceUnit = parseLengthUnit(line.slice(0, 2));
|
|
312
|
-
if (!distanceUnit) {
|
|
313
|
-
distanceUnit = _unitized.Length.feet;
|
|
314
|
-
error('Invalid distance unit', 0, 2);
|
|
315
|
-
}
|
|
316
|
-
azimuthUnit = parseAngleUnit(line[6]);
|
|
317
|
-
if (!azimuthUnit) {
|
|
318
|
-
azimuthUnit = _unitized.Angle.degrees;
|
|
319
|
-
error('Invalid azimuth unit', 6, 7);
|
|
320
|
-
}
|
|
321
|
-
inclinationUnit = parseAngleUnit(line[7]);
|
|
322
|
-
if (!inclinationUnit) {
|
|
323
|
-
inclinationUnit = _unitized.Angle.degrees;
|
|
324
|
-
error('Invalid inclination unit', 7, 8);
|
|
325
|
-
}
|
|
326
|
-
backsightAzimuthCorrected = line[3] === 'C';
|
|
327
|
-
backsightInclinationCorrected = line[4] === 'C';
|
|
328
|
-
hasBacksightAzimuth = line[3] !== ' ' && line[3] !== '-';
|
|
329
|
-
hasBacksightInclination = line[4] !== ' ' && line[4] !== '-';
|
|
330
|
-
if (!/[-CB ]/.test(line[3])) {
|
|
331
|
-
error('Invalid backsight azimuth type', 3, 4);
|
|
332
|
-
}
|
|
333
|
-
if (!/[-CB ]/.test(line[4])) {
|
|
334
|
-
error('Invalid backsight inclination type', 4, 5);
|
|
335
|
-
}
|
|
336
529
|
trip = {
|
|
337
|
-
header: {
|
|
530
|
+
header: _objectSpread({
|
|
338
531
|
name: tripName || '',
|
|
339
532
|
comment: tripComment && tripComment.join('\n') || null,
|
|
340
533
|
section: section,
|
|
341
534
|
date: tripDate,
|
|
342
|
-
team: tripTeam
|
|
343
|
-
|
|
344
|
-
azimuthUnit: azimuthUnit,
|
|
345
|
-
inclinationUnit: inclinationUnit,
|
|
346
|
-
backsightAzimuthCorrected: backsightAzimuthCorrected,
|
|
347
|
-
backsightInclinationCorrected: backsightInclinationCorrected,
|
|
348
|
-
hasBacksightAzimuth: hasBacksightAzimuth,
|
|
349
|
-
hasBacksightInclination: hasBacksightInclination
|
|
350
|
-
},
|
|
535
|
+
team: tripTeam
|
|
536
|
+
}, parseUnits()),
|
|
351
537
|
shots: []
|
|
352
538
|
};
|
|
353
539
|
trips.push(trip);
|
|
354
|
-
_context.next =
|
|
540
|
+
_context.next = 113;
|
|
355
541
|
break;
|
|
356
|
-
case
|
|
542
|
+
case 45:
|
|
357
543
|
if (!trip) {
|
|
358
|
-
_context.next =
|
|
544
|
+
_context.next = 113;
|
|
359
545
|
break;
|
|
360
546
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
inches =
|
|
364
|
-
if (inches)
|
|
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;
|
|
365
551
|
|
|
366
552
|
// rigorously check the values in all the columns to make sure this
|
|
367
553
|
// is really a survey shot line, just in case any stray comments are
|
|
368
554
|
// not properly delimited.
|
|
369
555
|
|
|
370
556
|
// from station name
|
|
371
|
-
if (/\S/.test(line.substring(
|
|
372
|
-
_context.next =
|
|
557
|
+
if (/\S/.test((_line = line).substring.apply(_line, (0, _toConsumableArray2["default"])(ranges.fromStation)))) {
|
|
558
|
+
_context.next = 52;
|
|
373
559
|
break;
|
|
374
560
|
}
|
|
375
561
|
return _context.abrupt("return", 0);
|
|
376
|
-
case
|
|
377
|
-
fromStr = validate(
|
|
562
|
+
case 52:
|
|
563
|
+
fromStr = validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.fromStation).concat(['from station', isValidStation]));
|
|
378
564
|
from = fromStr.trim(); // Sadly I have found negative LRUD values in Chip's format and apparently
|
|
379
565
|
// his program doesn't fail on them, so I have to accept them here
|
|
380
566
|
// isValidOptFloat instead of isValidOptUFloat
|
|
381
|
-
lStr = validate(
|
|
382
|
-
rStr = validate(
|
|
383
|
-
uStr = validate(
|
|
384
|
-
dStr = validate(
|
|
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]));
|
|
385
571
|
if (!errored) {
|
|
386
|
-
_context.next =
|
|
572
|
+
_context.next = 60;
|
|
387
573
|
break;
|
|
388
574
|
}
|
|
389
575
|
return _context.abrupt("return", 0);
|
|
390
|
-
case
|
|
391
|
-
up = parseLrud(uStr,
|
|
392
|
-
down = parseLrud(dStr,
|
|
393
|
-
left = parseLrud(lStr,
|
|
394
|
-
right = parseLrud(rStr,
|
|
395
|
-
toStr = line.substring(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));
|
|
396
582
|
if (toStr.trim()) {
|
|
397
|
-
_context.next =
|
|
583
|
+
_context.next = 69;
|
|
398
584
|
break;
|
|
399
585
|
}
|
|
400
586
|
_shot = {
|
|
401
587
|
from: from,
|
|
402
588
|
to: null,
|
|
403
589
|
kind: _FrcsShot.FrcsShotKind.Normal,
|
|
404
|
-
distance: new _unitized.UnitizedNumber(0,
|
|
590
|
+
distance: new _unitized.UnitizedNumber(0, distanceUnit),
|
|
405
591
|
frontsightAzimuth: null,
|
|
406
592
|
backsightAzimuth: null,
|
|
407
593
|
frontsightInclination: null,
|
|
@@ -415,20 +601,20 @@ function _parseFrcsSurveyFile() {
|
|
|
415
601
|
excludeDistance: true,
|
|
416
602
|
comment: getComment()
|
|
417
603
|
};
|
|
418
|
-
|
|
604
|
+
addShot(_shot);
|
|
419
605
|
return _context.abrupt("return", 0);
|
|
420
|
-
case
|
|
606
|
+
case 69:
|
|
421
607
|
if (!isValidStation(toStr)) {
|
|
422
|
-
error('Invalid station name'
|
|
608
|
+
error.apply(void 0, ['Invalid station name'].concat((0, _toConsumableArray2["default"])(ranges.toStation)));
|
|
423
609
|
}
|
|
424
610
|
fromLruds = commentFromStationLruds.get(from);
|
|
425
611
|
if (fromLruds) {
|
|
426
612
|
commentFromStationLruds["delete"](from);
|
|
427
613
|
} else {
|
|
428
|
-
fromLrudMatch = new RegExp("^\\s+".concat(fromStr.trim().replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "((\\s+(\\d+(\\.\\d*)?|\\.\\d+)){4})")).exec(line.substring(
|
|
614
|
+
fromLrudMatch = new RegExp("^\\s+".concat(fromStr.trim().replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "((\\s+(\\d+(\\.\\d*)?|\\.\\d+)){4})")).exec(line.substring(maxRange));
|
|
429
615
|
if (fromLrudMatch) {
|
|
430
616
|
_fromLrudMatch$1$trim = fromLrudMatch[1].trim().split(/\s+/g).map(function (s) {
|
|
431
|
-
return parseLrud(s,
|
|
617
|
+
return parseLrud(s, distanceUnit);
|
|
432
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];
|
|
433
619
|
fromLruds = {
|
|
434
620
|
left: _left,
|
|
@@ -439,52 +625,54 @@ function _parseFrcsSurveyFile() {
|
|
|
439
625
|
}
|
|
440
626
|
}
|
|
441
627
|
comment = getComment(); // azimuth and inclination
|
|
442
|
-
azmFsStr = validate(
|
|
443
|
-
azmBsStr = validate(
|
|
444
|
-
incFsStr = line.substring(
|
|
445
|
-
incBsStr = line.substring(
|
|
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));
|
|
446
632
|
if (!errored) {
|
|
447
|
-
_context.next =
|
|
633
|
+
_context.next = 79;
|
|
448
634
|
break;
|
|
449
635
|
}
|
|
450
636
|
return _context.abrupt("return", 0);
|
|
451
|
-
case
|
|
637
|
+
case 79:
|
|
452
638
|
if (!inches) {
|
|
453
|
-
_context.next =
|
|
639
|
+
_context.next = 94;
|
|
454
640
|
break;
|
|
455
641
|
}
|
|
456
|
-
feetStr = line.substring(
|
|
457
|
-
inchesStr = line.substring(
|
|
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
|
|
458
644
|
if (!(!isValidUInt(feetStr) && !isValidUInt(inchesStr))) {
|
|
459
|
-
_context.next =
|
|
645
|
+
_context.next = 86;
|
|
460
646
|
break;
|
|
461
647
|
}
|
|
462
648
|
invalid = feetStr.trim() || inchesStr.trim();
|
|
463
|
-
error(invalid ? 'Invalid distance' : 'Missing distance',
|
|
649
|
+
error(invalid ? 'Invalid distance' : 'Missing distance', ranges.distanceFeet[0], ranges.distanceInches[1]);
|
|
464
650
|
return _context.abrupt("return", 0);
|
|
465
|
-
case
|
|
651
|
+
case 86:
|
|
466
652
|
// sometimes inches are omitted, hence the || 0...I'm assuming it's possible
|
|
467
653
|
// for feet to be omitted as well
|
|
468
654
|
distance = _unitized.Unitize.inches(parseFloat(inchesStr) || 0).add(_unitized.Unitize.feet(parseFloat(feetStr) || 0));
|
|
469
|
-
|
|
470
|
-
|
|
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 *.
|
|
471
658
|
// I think they might represent different values, but thisis confused by
|
|
472
659
|
// the fact that for ft/in shots, if there is a D or H flag it occupies the
|
|
473
660
|
// first column that can contain a * for decimal feet shots
|
|
474
|
-
excludeDistance =
|
|
475
|
-
isSplay =
|
|
476
|
-
_context.next =
|
|
661
|
+
excludeDistance = exclude === '*' || exclude === 's';
|
|
662
|
+
isSplay = exclude === 's';
|
|
663
|
+
_context.next = 100;
|
|
477
664
|
break;
|
|
478
|
-
case
|
|
665
|
+
case 94:
|
|
479
666
|
// decimal feet are not optional
|
|
480
|
-
_feetStr = validate(
|
|
481
|
-
distance = new _unitized.UnitizedNumber(parseFloat(_feetStr),
|
|
482
|
-
kind = parseKind(line[
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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:
|
|
486
674
|
if (kind !== _FrcsShot.FrcsShotKind.Normal) {
|
|
487
|
-
validate(
|
|
675
|
+
validate.apply(void 0, (0, _toConsumableArray2["default"])(ranges.frontsightInclination).concat(['vertical-distance', isValidFloat]));
|
|
488
676
|
}
|
|
489
677
|
|
|
490
678
|
// convert horizontal and diagonal shots to standard
|
|
@@ -494,35 +682,35 @@ function _parseFrcsSurveyFile() {
|
|
|
494
682
|
if (kind === _FrcsShot.FrcsShotKind.Horizontal) {
|
|
495
683
|
// distance is horizontal offset and incFsStr is vertical offset
|
|
496
684
|
horizontalDistance = distance;
|
|
497
|
-
h = horizontalDistance.get(
|
|
685
|
+
h = horizontalDistance.get(distanceUnit);
|
|
498
686
|
v = parseFloat(incFsStr);
|
|
499
|
-
verticalDistance = new _unitized.UnitizedNumber(v,
|
|
500
|
-
distance = new _unitized.UnitizedNumber(Math.sqrt(h * h + v * v),
|
|
687
|
+
verticalDistance = new _unitized.UnitizedNumber(v, distanceUnit);
|
|
688
|
+
distance = new _unitized.UnitizedNumber(Math.sqrt(h * h + v * v), distanceUnit);
|
|
501
689
|
frontsightInclination = _unitized.Angle.atan2(verticalDistance, horizontalDistance);
|
|
502
690
|
backsightInclination = null;
|
|
503
691
|
} else if (kind === _FrcsShot.FrcsShotKind.Diagonal) {
|
|
504
692
|
// distance is as usual, but incFsStr is vertical offset
|
|
505
|
-
d = distance.get(
|
|
693
|
+
d = distance.get(distanceUnit);
|
|
506
694
|
_v = parseFloat(incFsStr);
|
|
507
|
-
verticalDistance = new _unitized.UnitizedNumber(_v,
|
|
695
|
+
verticalDistance = new _unitized.UnitizedNumber(_v, distanceUnit);
|
|
508
696
|
frontsightInclination = _unitized.Angle.asin(_v / d);
|
|
509
697
|
backsightInclination = null;
|
|
510
698
|
} else {
|
|
511
699
|
// frontsight inclination
|
|
512
|
-
validate(
|
|
513
|
-
//
|
|
514
|
-
validate(
|
|
515
|
-
frontsightInclination = parseNumber(incFsStr,
|
|
516
|
-
backsightInclination = parseNumber(incBsStr,
|
|
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);
|
|
517
705
|
}
|
|
518
706
|
if (!errored) {
|
|
519
|
-
_context.next =
|
|
707
|
+
_context.next = 104;
|
|
520
708
|
break;
|
|
521
709
|
}
|
|
522
710
|
return _context.abrupt("return", 0);
|
|
523
|
-
case
|
|
524
|
-
frontsightAzimuth = parseAzimuth(azmFsStr,
|
|
525
|
-
backsightAzimuth = parseAzimuth(azmBsStr,
|
|
711
|
+
case 104:
|
|
712
|
+
frontsightAzimuth = parseAzimuth(azmFsStr, azimuthUnit);
|
|
713
|
+
backsightAzimuth = parseAzimuth(azmBsStr, azimuthUnit);
|
|
526
714
|
if (!frontsightInclination && !backsightInclination) {
|
|
527
715
|
frontsightInclination = _unitized.Unitize.degrees(0);
|
|
528
716
|
}
|
|
@@ -548,74 +736,75 @@ function _parseFrcsSurveyFile() {
|
|
|
548
736
|
if (fromLruds) shot.fromLruds = fromLruds;
|
|
549
737
|
if (horizontalDistance) shot.horizontalDistance = horizontalDistance;
|
|
550
738
|
if (verticalDistance) shot.verticalDistance = verticalDistance;
|
|
551
|
-
|
|
552
|
-
case
|
|
739
|
+
addShot(shot);
|
|
740
|
+
case 113:
|
|
553
741
|
case "end":
|
|
554
742
|
return _context.stop();
|
|
555
743
|
}
|
|
556
744
|
}, _loop);
|
|
557
745
|
});
|
|
558
746
|
_iterator = _asyncIterator(lines);
|
|
559
|
-
case
|
|
560
|
-
_context2.next =
|
|
747
|
+
case 30:
|
|
748
|
+
_context2.next = 32;
|
|
561
749
|
return _iterator.next();
|
|
562
|
-
case
|
|
750
|
+
case 32:
|
|
563
751
|
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
|
564
|
-
_context2.next =
|
|
752
|
+
_context2.next = 40;
|
|
565
753
|
break;
|
|
566
754
|
}
|
|
567
|
-
return _context2.delegateYield(_loop(), "t0",
|
|
568
|
-
case
|
|
755
|
+
return _context2.delegateYield(_loop(), "t0", 34);
|
|
756
|
+
case 34:
|
|
569
757
|
_ret = _context2.t0;
|
|
570
758
|
if (!(_ret === 0)) {
|
|
571
|
-
_context2.next =
|
|
759
|
+
_context2.next = 37;
|
|
572
760
|
break;
|
|
573
761
|
}
|
|
574
|
-
return _context2.abrupt("continue",
|
|
575
|
-
case
|
|
762
|
+
return _context2.abrupt("continue", 37);
|
|
763
|
+
case 37:
|
|
576
764
|
_iteratorAbruptCompletion = false;
|
|
577
|
-
_context2.next =
|
|
765
|
+
_context2.next = 30;
|
|
578
766
|
break;
|
|
579
|
-
case
|
|
580
|
-
_context2.next =
|
|
767
|
+
case 40:
|
|
768
|
+
_context2.next = 46;
|
|
581
769
|
break;
|
|
582
|
-
case
|
|
583
|
-
_context2.prev =
|
|
584
|
-
_context2.t1 = _context2["catch"](
|
|
770
|
+
case 42:
|
|
771
|
+
_context2.prev = 42;
|
|
772
|
+
_context2.t1 = _context2["catch"](27);
|
|
585
773
|
_didIteratorError = true;
|
|
586
774
|
_iteratorError = _context2.t1;
|
|
587
|
-
case
|
|
588
|
-
_context2.prev =
|
|
589
|
-
_context2.prev =
|
|
775
|
+
case 46:
|
|
776
|
+
_context2.prev = 46;
|
|
777
|
+
_context2.prev = 47;
|
|
590
778
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
591
|
-
_context2.next =
|
|
779
|
+
_context2.next = 51;
|
|
592
780
|
break;
|
|
593
781
|
}
|
|
594
|
-
_context2.next =
|
|
782
|
+
_context2.next = 51;
|
|
595
783
|
return _iterator["return"]();
|
|
596
|
-
case
|
|
597
|
-
_context2.prev =
|
|
784
|
+
case 51:
|
|
785
|
+
_context2.prev = 51;
|
|
598
786
|
if (!_didIteratorError) {
|
|
599
|
-
_context2.next =
|
|
787
|
+
_context2.next = 54;
|
|
600
788
|
break;
|
|
601
789
|
}
|
|
602
790
|
throw _iteratorError;
|
|
603
|
-
case
|
|
604
|
-
return _context2.finish(
|
|
605
|
-
case
|
|
606
|
-
return _context2.finish(
|
|
607
|
-
case
|
|
791
|
+
case 54:
|
|
792
|
+
return _context2.finish(51);
|
|
793
|
+
case 55:
|
|
794
|
+
return _context2.finish(46);
|
|
795
|
+
case 56:
|
|
608
796
|
return _context2.abrupt("return", {
|
|
609
797
|
cave: cave,
|
|
798
|
+
columns: columns,
|
|
610
799
|
location: location,
|
|
611
800
|
trips: trips,
|
|
612
801
|
errors: errors
|
|
613
802
|
});
|
|
614
|
-
case
|
|
803
|
+
case 57:
|
|
615
804
|
case "end":
|
|
616
805
|
return _context2.stop();
|
|
617
806
|
}
|
|
618
|
-
}, _callee, null, [[
|
|
807
|
+
}, _callee, null, [[27, 42, 46, 56], [47,, 51, 55]]);
|
|
619
808
|
}));
|
|
620
809
|
return _parseFrcsSurveyFile.apply(this, arguments);
|
|
621
810
|
}
|