mirror of
https://github.com/asherao/dcs-scratchpad.git
synced 2025-10-29 16:56:22 +00:00
cleanup trailing whitespace
This commit is contained in:
parent
ac33093bef
commit
ce373ff4c5
@ -32,41 +32,41 @@ function scratchpad_load()
|
||||
else
|
||||
latHemi = 'S'
|
||||
end
|
||||
|
||||
|
||||
if lon > 0 then
|
||||
lonHemi = 'E'
|
||||
else
|
||||
lonHemi = 'W'
|
||||
end
|
||||
|
||||
|
||||
lat = math.abs(lat)
|
||||
lon = math.abs(lon)
|
||||
|
||||
|
||||
local latDeg = math.floor(lat)
|
||||
local latMin = (lat - latDeg)*60
|
||||
|
||||
|
||||
local lonDeg = math.floor(lon)
|
||||
local lonMin = (lon - lonDeg)*60
|
||||
|
||||
|
||||
if DMS then -- degrees, minutes, and seconds.
|
||||
local oldLatMin = latMin
|
||||
latMin = math.floor(latMin)
|
||||
local latSec = round((oldLatMin - latMin)*60, acc)
|
||||
|
||||
|
||||
local oldLonMin = lonMin
|
||||
lonMin = math.floor(lonMin)
|
||||
local lonSec = round((oldLonMin - lonMin)*60, acc)
|
||||
|
||||
|
||||
if latSec == 60 then
|
||||
latSec = 0
|
||||
latMin = latMin + 1
|
||||
end
|
||||
|
||||
|
||||
if lonSec == 60 then
|
||||
lonSec = 0
|
||||
lonMin = lonMin + 1
|
||||
end
|
||||
|
||||
|
||||
local secFrmtStr -- create the formatting string for the seconds place
|
||||
if acc <= 0 then -- no decimal place.
|
||||
secFrmtStr = '%02d'
|
||||
@ -74,24 +74,24 @@ function scratchpad_load()
|
||||
local width = 3 + acc -- 01.310 - that's a width of 6, for example.
|
||||
secFrmtStr = '%0' .. width .. '.' .. acc .. 'f'
|
||||
end
|
||||
|
||||
|
||||
return string.format('%02d', latDeg) .. ' ' .. string.format('%02d', latMin) .. '\' ' .. string.format(secFrmtStr, latSec) .. '"' .. latHemi .. ' '
|
||||
.. string.format('%02d', lonDeg) .. ' ' .. string.format('%02d', lonMin) .. '\' ' .. string.format(secFrmtStr, lonSec) .. '"' .. lonHemi
|
||||
|
||||
|
||||
else -- degrees, decimal minutes.
|
||||
latMin = round(latMin, acc)
|
||||
lonMin = round(lonMin, acc)
|
||||
|
||||
|
||||
if latMin == 60 then
|
||||
latMin = 0
|
||||
latDeg = latDeg + 1
|
||||
end
|
||||
|
||||
|
||||
if lonMin == 60 then
|
||||
lonMin = 0
|
||||
lonDeg = lonDeg + 1
|
||||
end
|
||||
|
||||
|
||||
local minFrmtStr -- create the formatting string for the minutes place
|
||||
if acc <= 0 then -- no decimal place.
|
||||
minFrmtStr = '%02d'
|
||||
@ -99,10 +99,10 @@ function scratchpad_load()
|
||||
local width = 3 + acc -- 01.310 - that's a width of 6, for example.
|
||||
minFrmtStr = '%0' .. width .. '.' .. acc .. 'f'
|
||||
end
|
||||
|
||||
|
||||
return string.format('%02d', latDeg) .. ' ' .. string.format(minFrmtStr, latMin) .. '\'' .. latHemi .. ' '
|
||||
.. string.format('%02d', lonDeg) .. ' ' .. string.format(minFrmtStr, lonMin) .. '\'' .. lonHemi
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user