Skip to content

Commit

Permalink
Added boundingbox function.
Browse files Browse the repository at this point in the history
  • Loading branch information
evetion committed Jan 17, 2020
1 parent ca41de3 commit 72d437b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LazIO"
uuid = "c3605908-9f0f-11e8-0a72-0d361c15a277"
authors = ["Maarten Pronk <[email protected]>"]
version = "0.1.1"
version = "0.1.2"

[deps]
BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
Expand All @@ -13,12 +13,12 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
julia = "1.0"
BinaryProvider = "0.5"
FileIO = "1.2"
LasIO = "0.3"
Parameters = "0.12"
Tables = "0.2"
julia = "1.0"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
5 changes: 5 additions & 0 deletions src/dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,8 @@ function Base.close(ds::LazDataset)
LazIO.@check reader LazIO.laszip_close_reader(reader)
LazIO.@check reader LazIO.laszip_destroy(reader)
end

function LasIO.boundingbox(h::LazHeader)
(xmin = h.min_x, ymin = h.min_y, zmin = h.min_z, xmax = h.max_x, ymax = h.max_y, zmax = h.max_z)
end
LasIO.boundingbox(ds::LazDataset) = boundingbox(ds.header)
2 changes: 1 addition & 1 deletion src/laszip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Automatically generated using Clang.jl wrap_c, version 0.0.0

const laszip = replace(liblaszip, "_api" => "")
@info "Using laszip library at $liblaszip"
@debug "Using laszip library at $liblaszip"

# function renameat(arg1::Cint, arg2, arg3::Cint, arg4)
# ccall((:renameat, laszip), Cint, (Cint, Cstring, Cint, Cstring), arg1, arg2, arg3, arg4)
Expand Down
14 changes: 8 additions & 6 deletions test/testio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ laz_out = joinpath(workdir, "out.laz")
testfile = File{format"LAZ_"}(testfile_str)

header, pointdata_all = load(testfile)
@testset "header" begin
@testset "Header" begin
@test header.version_major == 1
@test header.version_minor == 2
@test header.data_format_id == 0
@test header.records_count == 497536
@test header.x_scale == 0.01
@test header.y_max == 379999.99
@test header.header_size == 227
@test LazIO.boundingbox(header) == (xmin = 1.44e6, ymin = 375000.03, zmin = 832.1800000000001, xmax = 1.44499996e6, ymax = 379999.99, zmax = 972.6700000000001)
end

@testset "ranges" begin
@testset "Range indexing" begin
_, pointdata_276 = load(testfile, range=276)
_, pointdata_array = load(testfile, range=[1,276,277,497536])
_, pointdata_colon = load(testfile, range=:)
Expand All @@ -38,10 +39,11 @@ end
@test ds isa LazIO.LazDataset
@test first(ds) isa LazIO.LazPoint
@inferred first(ds)
@test LazIO.boundingbox(ds) == (xmin = 1.44e6, ymin = 375000.03, zmin = 832.1800000000001, xmax = 1.44499996e6, ymax = 379999.99, zmax = 972.6700000000001)
close(ds)
end

@testset "Tables" begin
@testset "Table interface" begin
ds = LazIO.open(testfile_str)
@test Tables.istable(LazIO.LazDataset)
@test Tables.rowaccess(LazIO.LazDataset)
Expand All @@ -50,7 +52,7 @@ end
close(ds)
end

@testset "read, modify then write a single point to a new LAZ" begin
@testset "Writing" begin
# open reader
reader = Ref{Ptr{Cvoid}}(C_NULL)
LazIO.@check reader[] LazIO.laszip_create(reader)
Expand Down Expand Up @@ -106,7 +108,7 @@ end
rm(laz_out)
end

@testset "stream LazDataSet to LAZ" begin
@testset "Stream output (dataset)" begin
ds = LazIO.open(testfile_str)
laz_stream_out = joinpath(workdir, "out-stream.laz")

Expand Down Expand Up @@ -134,7 +136,7 @@ end
rm(laz_stream_out)
end

@testset "stream to LAZ" begin
@testset "Stream output (header)" begin
ds = LazIO.open(testfile_str)
laz_stream_out = joinpath(workdir, "out-stream2.laz")

Expand Down

2 comments on commit 72d437b

@evetion
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release Notes:

  • Added boundingbox function

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/8110

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.2 -m "<description of version>" 72d437bcea7e43f2f378c1827d24244659409396
git push origin v0.1.2

Please sign in to comment.