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