Skip to content

Commit

Permalink
use new uv transform (#107)
Browse files Browse the repository at this point in the history
* use new uv transform

* trigger ci via git

* remove entry to doc

---------

Co-authored-by: Lazaro Alonso <[email protected]>
  • Loading branch information
SimonDanisch and lazarusA authored Aug 14, 2024
1 parent c6c38f9 commit 13478e2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ HTTP = "1"
ImageIO = "0.6"
LRUCache = "1"
LinearAlgebra = "1"
Makie = "0.21"
Makie = "0.21.6"
MapTiles = "1"
OrderedCollections = "1"
Proj = "1"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/map-3d.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ delta = 0.3
ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
cfg = Tyler.PlotConfig(
preprocess=pc -> map(p -> p .* 2, pc),
shading=FastShading,
shading=FastShading, colorrange=(2000, 5000),
colormap=:alpine
)
m = Tyler.Map3D(ext; provider=ElevationProvider(nothing), plot_config=cfg)
Expand Down
4 changes: 2 additions & 2 deletions src/provider/elevation/elevation-provider.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ function fetch_tile(provider::ElevationProvider, dl::PathDownloader, tile::Tile)
mini = -450
maxi = 8700
elevation_img = collect(reverse(band; dims=2))
elevation_img .= Float32.(elevation_img) # .* (maxi - mini) .+ mini
elevation_img .= Float32.(elevation_img)
if isnothing(provider.color_provider)
return Tyler.ElevationData(elevation_img, Matrix{RGBf}(undef, 0, 0), Vec2d(mini, maxi))
end
foto_img = get!(provider.tile_cache, path) do
dl = provider.downloader[Threads.threadid()]
fetch_tile(provider.color_provider, dl, tile)
end
return Tyler.ElevationData(elevation_img, rotr90(foto_img), Vec2d(mini, maxi))
return Tyler.ElevationData(elevation_img, foto_img, Vec2d(mini, maxi))
end
9 changes: 5 additions & 4 deletions src/tile-plotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,12 @@ function create_tileplot!(config::PlotConfig, axis::AbstractAxis, data::Elevatio
# not so elegant with empty array, we may want to make this a bit nicer going forward
color = isempty(data.color) ? (;) : (color=data.color,)
mini, maxi = extrema(bounds)
uv_transform = isempty(data.color) ? Makie.automatic : Mat{2,3,Float32}(0, 1, 1, 0, 0, 0)
p = Makie.surface!(
axis.scene,
(mini[1], maxi[1]), (mini[2], maxi[2]), data.elevation;
color...,
uv_transform = uv_transform,
shading=Makie.NoShading,
inspectable=false,
colorrange=data.elevation_range,
Expand Down Expand Up @@ -230,7 +232,8 @@ function create_tileplot!(config::PlotConfig, axis::AbstractAxis, data::ImageDat
mini, maxi = extrema(bounds)
plot = Makie.image!(
axis.scene,
(mini[1], maxi[1]), (mini[2], maxi[2]), rotr90(data);
(mini[1], maxi[1]), (mini[2], maxi[2]), data;
uv_transform=Mat{2,3,Float32}(0, 1, 1, 0, 0, 0),
inspectable=false,
config.attributes...
)
Expand All @@ -241,11 +244,10 @@ function update_tile_plot!(plot::Makie.Image, ::PlotConfig, axis::AbstractAxis,
mini, maxi = extrema(bounds)
plot[1] = (mini[1], maxi[1])
plot[2] = (mini[2], maxi[2])
plot[3] = rotr90(data)
plot[3] = data
return
end


############################
#### PointCloudData Data plotting
####
Expand Down Expand Up @@ -317,7 +319,6 @@ function update_tile_plot!(plot::Makie.MeshScatter, ::MeshScatterPlotconfig, ::A
end



############################
#### Debug tile plotting (image only for now)
####
Expand Down

2 comments on commit 13478e2

@lazarusA
Copy link
Collaborator

Choose a reason for hiding this comment

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

@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/113149

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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 the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" 13478e29c13879a3ecb6b957f45d3857fe22e240
git push origin v0.2.0

Please sign in to comment.