Skip to content

Commit

Permalink
add distanceToSelf output option to "Traffic" section (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
humppafreak authored Jul 12, 2024
1 parent 01317ae commit 680efd2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions calcs/cpa_tcpa.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ module.exports = function (app, plugin) {
'Calculate for all vessels within this range (m), negative to disable filter',
default: 1852
},
distanceToSelf: {
type: 'boolean',
title:
'Calculate distance to self for all vessels',
default: true
},
timelimit: {
type: 'number',
title:
Expand Down Expand Up @@ -121,6 +127,26 @@ module.exports = function (app, plugin) {
},
{ latitude: vesselPos.latitude, longitude: vesselPos.longitude }
)

if (
plugin.properties.traffic.distanceToSelf
) {
app.debug('distance of ' + vessel + ' to self: ' + distance)
app.handleMessage(plugin.id, {
context: 'vessels.' + vessel,
updates: [
{
values: [
{
path: 'navigation.distanceToSelf',
value: distance
}
]
}
]
})
}

if (
distance >= plugin.properties.traffic.range &&
plugin.properties.traffic.range >= 0
Expand Down

0 comments on commit 680efd2

Please sign in to comment.