diff --git a/src/points.jl b/src/points.jl index 67bc303..6e880d7 100644 --- a/src/points.jl +++ b/src/points.jl @@ -16,7 +16,7 @@ struct LLA{T <: Number} lon::T alt::T end -LLA(lat, lon, alt=zero(lat)) = LLA(promote(lat, lon, alt)...) +LLA(lat::Number, lon::Number, alt::Number=zero(lat)) = LLA(promote(lat, lon, alt)...) LLA(;lat=NaN,lon=NaN,alt=0.0) = LLA(lat,lon,alt) # Constructor that is idependent of storage order Base.show(io::IO, lla::LLA) = print(io, "LLA(lat=$(lla.lat)°, lon=$(lla.lon)°, alt=$(lla.alt))") # Maybe show to nearest mm, or 6 decimel places? diff --git a/test/points.jl b/test/points.jl index 7defa64..e9fd2c6 100644 --- a/test/points.jl +++ b/test/points.jl @@ -5,6 +5,7 @@ @test LLA(lat = 1., lon = 1., alt = 0.) == lla @test LLA(1//1, 1, 0.) == lla @test LLA(1, 1) == LLA{Int}(1, 1, 0) + @test_throws MethodError LLA(missing, missing) latlon = LatLon(1., 1.) @test LatLon(lat = 1., lon = 1.) == latlon