diff --git a/images/position.svg b/images/position.svg new file mode 100644 index 0000000..249434f --- /dev/null +++ b/images/position.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/js/src/lang.js b/js/src/lang.js index 420faba..4dbbb9c 100644 --- a/js/src/lang.js +++ b/js/src/lang.js @@ -135,4 +135,30 @@ export default class uLang { return ((d > 0) ? (`${d} ${this.unit('unitDay')} `) : '') + ((`00${h}`).slice(-2)) + ':' + ((`00${m}`).slice(-2)) + ':' + ((`00${s}`).slice(-2)) + ''; } + + /** + * @param {uPosition} pos + * @return {string} + */ + getLocaleCoordinates(pos) { + return `${uLang.coordStr(pos.longitude, true)} ${uLang.coordStr(pos.latitude, false)}`; + } + + /** + * @param {number} pos + * @param {boolean} isLon + * @return {string} + */ + static coordStr(pos, isLon) { + const ipos = Math.floor(pos); + const dec = ((pos - ipos) * 60).toFixed(1); + let dir; + + if (isLon) { + dir = pos < 0 ? 'W' : 'E'; + } else { + dir = pos < 0 ? 'S' : 'N'; + } + return `${ipos}° ${dec}'${dir}`; + } } diff --git a/js/src/mapviewmodel.js b/js/src/mapviewmodel.js index 50b68bb..d89808d 100644 --- a/js/src/mapviewmodel.js +++ b/js/src/mapviewmodel.js @@ -188,6 +188,7 @@ export default class MapViewModel extends ViewModel { ${(pos.speed !== null) ? `${$._('speed')}${$.getLocaleSpeed(pos.speed, true)}
` : ''} ${(pos.altitude !== null) ? `${$._('altitude')}${$.getLocaleAltitude(pos.altitude, true)}
` : ''} ${(pos.accuracy !== null) ? `${$._('accuracy')}${$.getLocaleAccuracy(pos.accuracy, true)}${provider}
` : ''} + ${$._('position')}${$.getLocaleCoordinates(pos)}
${stats}
${$._('pointof', id + 1, count)}
${editLink}
`; const node = document.createElement('div'); @@ -259,4 +260,5 @@ export default class MapViewModel extends ViewModel { this.api.updateSize(); } } + } diff --git a/lang/en.php b/lang/en.php index 1f7adcc..371289a 100644 --- a/lang/en.php +++ b/lang/en.php @@ -62,6 +62,7 @@ $lang["close"] = "close"; $lang["time"] = "Time"; $lang["speed"] = "Speed"; $lang["accuracy"] = "Accuracy"; +$lang["position"] = "Position"; $lang["altitude"] = "Altitude"; $lang["ttime"] = "Total time"; $lang["aspeed"] = "Average speed";