Skip to content

Commit

Permalink
use new uv transform
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Aug 14, 2024
1 parent c6c38f9 commit 18260e2
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

0 comments on commit 18260e2

Please sign in to comment.