@@ -15,7 +15,7 @@ using Interpolations: linear_interpolation
1515using IntervalSets
1616
1717import GridVisualize: initialize!, save, reveal, gridplot!, scalarplot!, vectorplot!, streamplot!, customplot!, movie, plot_triangulateio!
18- using GridVisualize: MakieType , GridVisualizer, SubVisualizer
18+ using GridVisualize: AbstractMakieType , GridVisualizer, SubVisualizer
1919using GridVisualize: isolevels, cellcolors, num_cellcolors, vectorsample, quiverdata, regionmesh, bfacesegments
2020
2121using ExtendableGrids
@@ -24,7 +24,7 @@ using Observables
2424
2525include (" flippablelayout.jl" )
2626
27- function initialize! (p:: GridVisualizer , :: Type{MakieType} )
27+ function initialize! (p:: GridVisualizer , :: Type{MakieType} ) where {MakieType <: AbstractMakieType }
2828 XMakie = p. context[:Plotter ]
2929
3030 # Prepare flippable layout
5757add_scene! (ctx, ax) = ctx[:flayout ][ctx[:subplot ]. .. ] = ax
5858
5959# Revealing the visualizer just returns the figure
60- function reveal (p:: GridVisualizer , :: Type{MakieType} )
60+ function reveal (p:: GridVisualizer , :: Type{MakieType} ) where {MakieType <: AbstractMakieType }
6161 XMakie = p. context[:Plotter ]
6262 layout = p. context[:layout ]
6363 # For 1D plots the legend should be rendered only once,
@@ -84,18 +84,18 @@ function reveal(p::GridVisualizer, ::Type{MakieType})
8484 end
8585end
8686
87- function reveal (ctx:: SubVisualizer , TP:: Type{MakieType} )
87+ function reveal (ctx:: SubVisualizer , TP:: Type{MakieType} ) where {MakieType <: AbstractMakieType }
8888 FlippableLayout. yieldwait (ctx[:flayout ])
8989 if ctx[:show ] || ctx[:reveal ]
9090 return reveal (ctx[:GridVisualizer ], TP)
9191 end
9292 return nothing
9393end
9494
95- function save (fname, p:: GridVisualizer , :: Type{MakieType} )
95+ function save (fname, p:: GridVisualizer , :: Type{MakieType} ) where {MakieType <: AbstractMakieType }
9696 return p. context[:Plotter ]. save (fname, p. context[:figure ])
9797end
98- function save (fname, scene, XMakie, :: Type{MakieType} )
98+ function save (fname, scene, XMakie, :: Type{MakieType} ) where {MakieType <: AbstractMakieType }
9999 return isnothing (scene) ? nothing : XMakie. save (fname, scene)
100100end
101101
@@ -107,7 +107,7 @@ function movie(
107107 file = nothing ,
108108 format = " gif" ,
109109 kwargs... ,
110- )
110+ ) where {MakieType <: AbstractMakieType }
111111 Plotter = vis. context[:Plotter ]
112112 if ! isnothing (file)
113113 format = lstrip (splitext (file)[2 ], ' .' )
@@ -275,7 +275,7 @@ function scenecorners1d(grid, gridscale)
275275 return [Point2f (xmin * gridscale, - 5 * h), Point2f (xmax * gridscale, 5 * h)]
276276end
277277
278- function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{1}} , grid)
278+ function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{1}} , grid) where {MakieType <: AbstractMakieType }
279279 XMakie = ctx[:Plotter ]
280280 nregions = num_cellregions (grid)
281281 nbregions = num_bfaceregions (grid)
352352# #######################################################################
353353# 1D function
354354
355- function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{1}} , grids, parentgrid, funcs)
355+ function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{1}} , grids, parentgrid, funcs) where {MakieType <: AbstractMakieType }
356356 XMakie = ctx[:Plotter ]
357357
358358 nfuncs = length (funcs)
@@ -598,7 +598,7 @@ function set_plot_data!(ctx, key, data)
598598 return haskey (ctx, key) ? ctx[key][] = data : ctx[key] = Observable (data)
599599end
600600
601- function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid)
601+ function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid) where {MakieType <: AbstractMakieType }
602602 XMakie = ctx[:Plotter ]
603603
604604 nregions = num_cellcolors (grid, ctx[:cellcoloring ])
@@ -711,7 +711,7 @@ function makescene2d(ctx, key)
711711end
712712
713713# 2D function
714- function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grids, parentgrid, funcs)
714+ function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grids, parentgrid, funcs) where {MakieType <: AbstractMakieType }
715715 XMakie = ctx[:Plotter ]
716716 gridscale = ctx[:gridscale ]
717717
@@ -849,7 +849,7 @@ function scalarplot!(ctx, TP::Type{MakieType}, ::Type{Val{2}}, grids, parentgrid
849849end
850850
851851# 2D vector
852- function vectorplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid, func)
852+ function vectorplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid, func) where {MakieType <: AbstractMakieType }
853853 XMakie = ctx[:Plotter ]
854854
855855 rc, rv = vectorsample (grid, func; gridscale = ctx[:gridscale ], rasterpoints = ctx[:rasterpoints ], offset = ctx[:offset ])
@@ -894,7 +894,7 @@ function vectorplot!(ctx, TP::Type{MakieType}, ::Type{Val{2}}, grid, func)
894894 return reveal (ctx, TP)
895895end
896896
897- function streamplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid, func)
897+ function streamplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid, func) where {MakieType <: AbstractMakieType }
898898 XMakie = ctx[:Plotter ]
899899
900900 rc, rv = vectorsample (
@@ -1060,7 +1060,7 @@ pgup/pgdown: coarse control control value
10601060 h: print this message
10611061"""
10621062
1063- function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{3}} , grid)
1063+ function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{3}} , grid) where {MakieType <: AbstractMakieType }
10641064 function make_mesh (pts, fcs)
10651065 if pkgversion (GeometryBasics) < v " 0.5"
10661066 return GeometryBasics. Mesh (meta (pts; normals = normals (pts, fcs)), fcs)
@@ -1253,7 +1253,7 @@ function gridplot!(ctx, TP::Type{MakieType}, ::Type{Val{3}}, grid)
12531253end
12541254
12551255# 3d function
1256- function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{3}} , grids, parentgrid, funcs)
1256+ function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{3}} , grids, parentgrid, funcs) where {MakieType <: AbstractMakieType }
12571257 levels, crange, colorbarticks = isolevels (ctx, funcs)
12581258 ctx[:crange ] = crange
12591259 ctx[:colorbarticks ] = colorbarticks
@@ -1494,7 +1494,7 @@ end
14941494# Thanks! lines(x, y, axis = (targetlimits = lims,)) indeed makes the limits update.^
14951495# I found that autolimits!(axis) gave good results, even better than me manually computing limits!
14961496
1497- function customplot! (ctx, TP:: Type{MakieType} , func)
1497+ function customplot! (ctx, TP:: Type{MakieType} , func) where {MakieType <: AbstractMakieType }
14981498 XMakie = ctx[:Plotter ]
14991499 if ! haskey (ctx, :scene )
15001500 ctx[:scene ] = XMakie. Axis (
@@ -1519,7 +1519,7 @@ function plot_triangulateio!(
15191519 voronoi = nothing ,
15201520 circumcircles = false ,
15211521 kwargs...
1522- )
1522+ ) where {MakieType <: AbstractMakieType }
15231523 XMakie = ctx[:Plotter ]
15241524
15251525 function frgb (Plotter, i, max; pastel = false )
0 commit comments