Skip to content

Commit

Permalink
feat: support @speleotica/frcsdata@4.0.0
Browse files Browse the repository at this point in the history
BREAKING CHANGE: drop support for @speleotica/frcsdata < 4.0.0
  • Loading branch information
jedwards1211 committed Nov 16, 2021
1 parent 1ce2b96 commit b2f3e36
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"dependencies": {
"@babel/runtime": "^7.1.5",
"@speleotica/compass": "^4.0.0",
"@speleotica/frcsdata": "^3.0.0",
"@speleotica/frcsdata": "^4.0.0",
"@speleotica/unitized": "^2.0.0"
},
"renovate": {
Expand Down
12 changes: 10 additions & 2 deletions src/cdata.fr
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TRICKY TRAVERSE AND THEN FIRST SURVEY IN UPPER CROWLWAY
DAN CROWL, KEITH ORTIZ, CHIP HOPPER, PETER QUICK, LARRY BEAN 14 FEB 1981
*
FI B DD
A2 A1 48 10 292.0 110.0-42.0 5 10 35 5
A2 A1 48 10 292.0 110.0-42.0 5 10 35 5 A1 2 7 3 4.5
A3 A2 12 5 333.5 153.5 35.0 3 1 15 5
A4 A3 4 2 0.0 0.0 90.0 3 1 10 10
*
Expand Down Expand Up @@ -51,4 +51,12 @@ FT CC DD
QAP5 QAP4 43.6 343.0 341.5 -5.0 -4.5 2 7 5 12
QAP6 QAP5 23.0 39.5 39.0 9.0 9.5 3 4 0 15
QAP7 QAP6 35.1 11.5 11.0 0.5 1.0 3 6 1 25
QAP8 QAP7 5.8 -90.0-90.0 2 4 6 20
QAP8 QAP7 5.8 -90.0-90.0 2 4 6 20
*
DOUG'S DEMISE (50 FT DROP), CHRIS CROSS, CRAWL ABOVE DROP
PETER QUICK, CHRIS GERACE, PHIL ODEN, CHIP HOPPER - 3-6-81
*
FT C DD
B30 B29 29.5H 320.0 321.0 0.5 2 3 4 2
B31 B30 13.7 360.0 360.0 40.0 2 4 6 9
B30sp B30 13.7 s 360.0 360.0 40.0 2 4 6
16 changes: 15 additions & 1 deletion src/convertToDat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DECLINATION: 0.00 FORMAT: DDDDLRUDLADadBT
FROM TO LEN BEAR INC LEFT RIGHT UP DOWN AZM2 INC2 FLAGS COMMENTS
AE20LRUD AE20 0.00 0.00 0.00 1.00 3.00 0.00 2.00 -999.00 -999.00 #|L#
AE20LRUD AE20 0.00 -999.00 -999.00 1.00 3.00 0.00 2.00 -999.00 -999.00
AE20 AE19 9.30 60.00 -36.00 2.00 12.00 0.00 20.00 240.00 -999.00 AE20 0 0 0 Bug-can't put before so put after-so can't m
AE19 AE18 24.50 0.00 -90.00 6.00 10.00 25.00 0.00 180.00 -999.00
AE18 AE17 8.00 350.50 17.00 3.00 5.00 0.00 0.00 170.50 -999.00
Expand All @@ -46,6 +46,7 @@ DECLINATION: 0.00 FORMAT: DIIDLRUDLADadBT
FROM TO LEN BEAR INC LEFT RIGHT UP DOWN AZM2 INC2 FLAGS COMMENTS
A1LRUD A1 0.00 -999.00 -999.00 2.00 7.00 3.00 4.50 -999.00 -999.00
A1 A2 48.83 292.00 -42.00 5.00 10.00 35.00 5.00 110.00 -999.00
A2 A3 12.42 333.50 35.00 3.00 1.00 15.00 5.00 153.50 -999.00
A3 A4 4.17 0.00 90.00 3.00 1.00 10.00 10.00 0.00 -999.00
Expand Down Expand Up @@ -82,6 +83,19 @@ FROM TO LEN BEAR INC LEFT RIGHT UP DOWN
QAP6 QAP7 35.10 11.50 0.50 3.00 6.00 1.00 25.00 191.00 -1.00
QAP7 QAP8 5.80 0.00 -90.00 2.00 4.00 6.00 20.00 -999.00 90.00
\f
Fisher Ridge Cave System
SURVEY NAME: 5
SURVEY DATE: 3 5 1983 COMMENT:DOUG'S DEMISE (50 FT DROP), CHRIS CROSS, CRAWL ABOVE DROP
SURVEY TEAM:
PETER QUICK;CHIP HOPPER
DECLINATION: 0.00 FORMAT: DDDDLRUDLADadBT
FROM TO LEN BEAR INC LEFT RIGHT UP DOWN AZM2 INC2 FLAGS COMMENTS
B29 B30 29.50 320.00 0.97 2.00 3.00 4.00 2.00 141.00 -999.00
B30 B31 13.70 0.00 40.00 2.00 4.00 6.00 9.00 180.00 -999.00
B30 B30sp 13.70 0.00 40.00 2.00 4.00 6.00 0.00 180.00 -999.00 #|L#
\f
`.replace(/\n/gm, '\r\n')
)
})
Expand Down
35 changes: 26 additions & 9 deletions src/convertToDat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,16 @@ export default function convertToDat({
? summaries.tripSummaries[index]
: undefined

const convertShot = (shot: FrcsShot): CompassShot => {
function* convertShot(shot: FrcsShot): Iterable<CompassShot> {
const { from, to, excludeDistance, comment } = shot
let {
distance,
frontsightAzimuth,
frontsightInclination,
backsightAzimuth,
backsightInclination,
left,
right,
up,
down,
} = shot
const { fromLruds, toLruds } = shot
if (backsightAzimuth && backsightAzimuthCorrected)
backsightAzimuth = Angle.opposite(backsightAzimuth)
if (backsightInclination && backsightInclinationCorrected)
Expand All @@ -127,13 +124,27 @@ export default function convertToDat({
}
}
if (distance == null) distance = new UnitizedNumber(0, distanceUnit)
if (fromLruds) {
const { left, right, up, down } = fromLruds
yield {
from: `${from}LRUD`,
to: from,
distance: new UnitizedNumber(0, distanceUnit),
left,
right,
up,
down,
}
}
if (!to) return
let { left, right, up, down } = toLruds || {}
if (left == null) left = new UnitizedNumber(0, distanceUnit)
if (right == null) right = new UnitizedNumber(0, distanceUnit)
if (up == null) up = new UnitizedNumber(0, distanceUnit)
if (down == null) down = new UnitizedNumber(0, distanceUnit)
return {
from: to ? from : `${from}LRUD`,
to: to ? to : from,
yield {
from,
to,
distance,
frontsightAzimuth,
frontsightInclination,
Expand All @@ -148,6 +159,12 @@ export default function convertToDat({
}
}

const convertedShots = []
for (const shot of shots) {
for (const converted of convertShot(shot))
convertedShots.push(converted)
}

return {
header: {
cave: survey.cave || '',
Expand Down Expand Up @@ -184,7 +201,7 @@ export default function convertToDat({
),
lrudAssociation: LrudAssociation.ToStation,
},
shots: shots.map(convertShot),
shots: convertedShots,
}
}
),
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1169,10 +1169,10 @@
"@speleotica/unitized" "^2.0.0"
lodash "^4.17.15"

"@speleotica/frcsdata@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@speleotica/frcsdata/-/frcsdata-3.0.0.tgz#8445adc9e3a44114b52cfb43e56be47053981a48"
integrity sha512-lhzgrm+4mliukzlkKx8W+1Q4bCYD7U67sU1aIJFJBO6nkWfWBim7hQc5nL3U/kaosy/k3cVWeiG1qJl17FBC2w==
"@speleotica/frcsdata@^4.0.0":
version "4.0.0"
resolved "https://registry.npmjs.org/@speleotica/frcsdata/-/frcsdata-4.0.0.tgz#92296abe1f0f3e36e2d5688b77fb9e39a0e1a1d5"
integrity sha512-nrj9mnLZ6J0xsdZTzEUcfWeLWFJQ4ZlLwQxL+3fM5MHIRFZQ8RKteYHOxU0ikwm27RE0VZWOHkR7CXEd/GxeiA==
dependencies:
"@babel/runtime" "^7.1.5"
"@speleotica/unitized" "^2.0.0"
Expand Down

0 comments on commit b2f3e36

Please sign in to comment.