From c482118c945144aae5afabd786df190173a3c8b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20Hoffimann?= Date: Wed, 22 Nov 2023 15:47:03 -0300 Subject: [PATCH] Update to Makie.jl v0.20 --- Project.toml | 2 +- ext/geometryset.jl | 14 +++++++------- ext/optimized.jl | 6 +++--- ext/simplemesh.jl | 6 +++--- ext/utils.jl | 7 +++++-- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Project.toml b/Project.toml index 0b0f98709..b1274001a 100644 --- a/Project.toml +++ b/Project.toml @@ -28,7 +28,7 @@ Bessels = "0.2" CircularArrays = "1.3" Distances = "0.10" LinearAlgebra = "1.9" -Makie = "0.19" +Makie = "0.20" NearestNeighbors = "0.4" Random = "1.9" Rotations = "1.5.1" diff --git a/ext/geometryset.jl b/ext/geometryset.jl index eb7b56878..15a1948fa 100644 --- a/ext/geometryset.jl +++ b/ext/geometryset.jl @@ -9,10 +9,10 @@ function Makie.plot!(plot::Viz{<:Tuple{GeometrySet}}) color = plot[:color] alpha = plot[:alpha] colorscheme = plot[:colorscheme] - facetcolor = plot[:facetcolor] - showfacets = plot[:showfacets] pointsize = plot[:pointsize] segmentsize = plot[:segmentsize] + showfacets = plot[:showfacets] + facetcolor = plot[:facetcolor] # process color spec into colorant colorant = Makie.@lift process($color, $colorscheme, $alpha) @@ -41,10 +41,10 @@ function Makie.plot!(plot::Viz{<:Tuple{GeometrySet}}) inds = Makie.@lift findall(g -> paramdim(g) == rank, $geoms) if !isempty(inds[]) rset = Makie.@lift GeometrySet($geoms[$inds]) - if colorant[] isa AbstractVector - cset = Makie.@lift $colorant[$inds] + cset = if colorant[] isa AbstractVector + Makie.@lift $colorant[$inds] else - cset = colorant + colorant end viz!(plot, rset, color=cset) end @@ -58,10 +58,10 @@ function Makie.plot!(plot::Viz{<:Tuple{GeometrySet}}) elseif all(ranks[] .== 1) # all boundaries are point sets points = Makie.@lift mapreduce(collect, vcat, $bounds) - viz!(plot, (Makie.@lift GeometrySet($points)), color=facetcolor, showfacets=false, pointsize=pointsize) + viz!(plot, (Makie.@lift GeometrySet($points)), color=facetcolor, pointsize=pointsize) elseif all(ranks[] .== 2) # all boundaries are geometries - viz!(plot, (Makie.@lift GeometrySet($bounds)), color=facetcolor, showfacets=false, segmentsize=segmentsize) + viz!(plot, (Makie.@lift GeometrySet($bounds)), color=facetcolor, segmentsize=segmentsize) elseif all(ranks[] .== 3) # we already visualized the boundaries because # that is all we can do with 3D geometries diff --git a/ext/optimized.jl b/ext/optimized.jl index 512d8bc67..3513f364b 100644 --- a/ext/optimized.jl +++ b/ext/optimized.jl @@ -38,7 +38,7 @@ function Makie.plot!(plot::Viz{<:Tuple{SubCartesianGrid}}) # retrieve grid paramaters gparams = Makie.@lift let grid, _ = unview($subgrid) - dims = embeddim(grid) + dim = embeddim(grid) sp = spacing(grid) # coordinates of centroids @@ -46,10 +46,10 @@ function Makie.plot!(plot::Viz{<:Tuple{SubCartesianGrid}}) coords = [coord(e) .+ sp ./ 2 for e in $subgrid] # rectangle marker - marker = Makie.Rect{dims}(-1 .* sp, sp) + marker = Makie.Rect{dim}(-1 .* sp, sp) # enable shading in 3D - shading = dims == 3 + shading = dim == 3 ? Makie.FastShading : Makie.NoShading coords, marker, shading end diff --git a/ext/simplemesh.jl b/ext/simplemesh.jl index af80acb7a..5635d7a52 100644 --- a/ext/simplemesh.jl +++ b/ext/simplemesh.jl @@ -59,9 +59,9 @@ function vizmesh2D!(plot) color = plot[:color] alpha = plot[:alpha] colorscheme = plot[:colorscheme] - facetcolor = plot[:facetcolor] - showfacets = plot[:showfacets] segmentsize = plot[:segmentsize] + showfacets = plot[:showfacets] + facetcolor = plot[:facetcolor] # process color spec into colorant colorant = Makie.@lift process($color, $colorscheme, $alpha) @@ -136,7 +136,7 @@ function vizmesh2D!(plot) tmatrix = reduce(hcat, tconnec) |> transpose # enable shading in 3D - tshading = dim == 3 + tshading = dim == 3 ? Makie.FastShading : Makie.NoShading tcoords, tmatrix, tcolors, tshading end diff --git a/ext/utils.jl b/ext/utils.jl index a0fd8911e..c1497a64b 100644 --- a/ext/utils.jl +++ b/ext/utils.jl @@ -16,6 +16,8 @@ function vizmany!(plot, objs) colorscheme = plot[:colorscheme] pointsize = plot[:pointsize] segmentsize = plot[:segmentsize] + showfacets = plot[:showfacets] + facetcolor = plot[:facetcolor] object = Makie.@lift reduce(concat, $objs) colors = Makie.@lift mayberepeat($color, $objs) @@ -27,8 +29,9 @@ function vizmany!(plot, objs) color=colors, alpha=alphas, colorscheme=colorscheme, - showfacets=false, pointsize=pointsize, - segmentsize=segmentsize + segmentsize=segmentsize, + showfacets=showfacets, + facetcolor=facetcolor ) end