Skip to content

Commit

Permalink
updates for 1.0, drop 0.6 support (#18)
Browse files Browse the repository at this point in the history
* bump REQUIRE to julia 0.7

* femtocleaning

* update REQUIRE and remove Nullable

* update CI to test 0.7 and 1.0

* indicate not all VLRs are shown and use undef in writestring

* final deprecation warnings, fix test
visr authored Aug 17, 2018
1 parent ee7f13c commit e6833f4
Showing 12 changed files with 46 additions and 49 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -4,7 +4,8 @@ os:
- linux
- osx
julia:
- 0.6
- 0.7
- 1.0
- nightly
matrix:
allow_failures:
13 changes: 5 additions & 8 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
julia 0.6
ColorTypes 0.3.3
Dates
FixedPointNumbers 0.3.2
FileIO 0.3.0
GeometryTypes 0.4.0
Compat 0.29
Nullables
julia 0.7
ColorTypes 0.7
FixedPointNumbers 0.5
FileIO 1.0
GeometryTypes 0.6
43 changes: 23 additions & 20 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
- julia_version: 0.7
- julia_version: 1.0
- julia_version: nightly

matrix:
allow_failures:
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
platform:
- x86 # 32-bit
- x64 # 64-bit

# # Uncomment the following lines to allow failures on nightly julia
# # (tests will run but not make your overall status red)
# matrix:
# allow_failures:
# - julia_version: nightly

branches:
only:
@@ -22,19 +26,18 @@ notifications:
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"LasIO\"); Pkg.build(\"LasIO\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"LasIO\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"

# # Uncomment to support code coverage upload. Should only be enabled for packages
# # which would have coverage gaps without running on Windows
# on_success:
# - echo "%JL_CODECOV_SCRIPT%"
# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"
4 changes: 0 additions & 4 deletions src/LasIO.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
__precompile__()

module LasIO

using Base.Meta
using Compat
using Dates
using FileIO
using FixedPointNumbers
using ColorTypes
using GeometryTypes # for conversion
using Nullables

export

1 change: 1 addition & 0 deletions src/fileio.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Mmap

function pointformat(header::LasHeader)
id = header.data_format_id
4 changes: 2 additions & 2 deletions src/header.jl
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ function Base.show(io::IO, header::LasHeader)
if !isempty(header.variable_length_records)
nrecords = min(10, size(header.variable_length_records, 1))

println(io, string("\tvariable_length_records = "))
println(io, string("\tvariable_length_records (max 10) = "))
for vlr in header.variable_length_records[1:nrecords]
println(io, "\t\t($(vlr.user_id), $(vlr.record_id)) => ($(vlr.description), $(sizeof(vlr.data)) bytes...)")
end
@@ -139,7 +139,7 @@ function Base.read(io::IO, ::Type{LasHeader})
data_format_id = read(io, UInt8)
data_record_length = read(io, UInt16)
records_count = read(io, UInt32)
point_return_count = read!(io, zeros(UInt32, 5))
point_return_count = read!(io, Vector{UInt32}(undef, 5))
x_scale = read(io, Float64)
y_scale = read(io, Float64)
z_scale = read(io, Float64)
2 changes: 1 addition & 1 deletion src/meta.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"Generate read (unpack) method for structs."
function generate_read(T::Type)
fc = @compat fieldcount(T)
fc = fieldcount(T)
types = [fieldtype(T, i) for i = 1:fc]

# Create unpack function expression
2 changes: 1 addition & 1 deletion src/point.jl
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ struct PointVector{T} <: AbstractArray{T,1}
n = length(data) ÷ pointsize

# IOBuffer takes (data, readable, writable)
new{T}(IOBuffer(data, true, false), n, pointsize)
new{T}(IOBuffer(data; read=true, write=false), n, pointsize)
end
end

8 changes: 3 additions & 5 deletions src/srs.jl
Original file line number Diff line number Diff line change
@@ -108,10 +108,10 @@ function epsg_code(header::LasHeader)
end
vlrs = header.variable_length_records
ind = findfirst(x -> x.record_id == id_geokeydirectorytag, vlrs)
if ind == 0
return Nullable{Int}()
if ind === nothing
nothing
else
Nullable{Int}(vlrs[ind].data.keys[3].value_offset)
vlrs[ind].data.keys[3].value_offset
end
end

@@ -144,8 +144,6 @@ function epsg_code!(header::LasHeader, epsg::Integer)
header
end

epsg_code!(header::LasHeader, epsg::Nullable{<:Integer}) = epsg_code!(header, get(epsg))

function read_vlr_data(io::IO, record_id::Integer, nb::Integer)
if record_id == id_geokeydirectorytag
return read(io, GeoKeys)
7 changes: 4 additions & 3 deletions test/benchmark.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using FileIO
using LasIO
using BenchmarkTools, Compat
using Mmap
using BenchmarkTools

workdir = dirname(@__FILE__)
# source: http://www.liblas.org/samples/
@@ -38,7 +39,7 @@ function test_orignal()

n = header.records_count
pointtype = pointformat(header)
pointdata = Vector{pointtype}(n)
pointdata = Vector{pointtype}(undef, n)
for i=1:n
pointdata[i] = read_original(s, pointtype)
end
@@ -53,7 +54,7 @@ function test_new()

n = header.records_count
pointtype = pointformat(header)
pointdata = Vector{pointtype}(n)
pointdata = Vector{pointtype}(undef, n)
for i=1:n
pointdata[i] = read(s, pointtype)
end
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using FileIO
using LasIO
using Base.Test
using Test

include("stream.jl")

@@ -123,8 +123,8 @@ end
@test typeof(srsheader.variable_length_records[2].data) == LasIO.GeoDoubleParamsTag
@test typeof(srsheader.variable_length_records[3].data) == LasIO.GeoAsciiParamsTag

@test isnull(LasIO.epsg_code(header))
@test LasIO.epsg_code(srsheader) === Nullable{Int}(32617)
@test LasIO.epsg_code(header) === nothing
@test LasIO.epsg_code(srsheader) === UInt16(32617)
# set the SRS. Note: this will not change points, but merely set SRS-metadata.
epsgheader = deepcopy(srsheader)
LasIO.epsg_code!(epsgheader, 32633) # set to WGS 84 / UTM zone 33N, not the actual SRS
2 changes: 1 addition & 1 deletion test/stream.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using FileIO
using LasIO
using Base.Test
using Test

workdir = dirname(@__FILE__)
# source: http://www.liblas.org/samples/

0 comments on commit e6833f4

Please sign in to comment.