Skip to content

Commit

Permalink
feature: added display DM.mmmm and Rhumbline.position to pathlist (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamHoulder authored May 9, 2021
1 parent 1110afd commit a77acda
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/ui/widgets/digitalposition.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,26 @@ function displayDMS(value, coordType, displayUnit) {
return result;
}


function displayDDM(value, coordType, displayUnit) {
var valDeg, degPadSize, valMin, valDecMin, result, coordDir

if (!value) {
return '--.--'
}

coordDir = getCoordDir(value, coordType)
degPadSize = (coordType === coordTypeLongitude) ? 3 : 2
value = parseFloat(value);
value = Math.abs(value);
valDeg = String(Math.floor(value)).padStart(degPadSize, '0')
result = valDeg + '\u00b0' + ' '
valDecMin = Number((value - valDeg) *60).toFixed(4);
result += String(valDecMin).padStart(7, '0') + "'" +' ' + coordDir
return result;
}


function displayDD(value, coordType, displayUnit, displaySign) {
var degPadSize, result, coordDir;

Expand Down Expand Up @@ -97,6 +117,14 @@ var positionFormats = [
label: "DDirM'S''ddd",
fontSize: 15
}
},
function(positionObject) {
return {
latitude: displayDDM(positionObject.latitude, coordTypeLatitude, false),
longitude: displayDDM(positionObject.longitude, coordTypeLongitude, false),
label: "D\u00b0 M.mmmm' Dir",
fontSize: 15
}
}
]

Expand Down Expand Up @@ -225,6 +253,8 @@ export default {
'navigation.position',
'navigation.courseGreatCircle.nextPoint.position',
'navigation.courseGreatCircle.previousPoint.position',
'navigation.courseRhumbline.nextPoint',
'navigation.courseRhumbline.previousPoint',
'navigation.anchor.position'
]
}

0 comments on commit a77acda

Please sign in to comment.