|
| 1 | +module SignalTablesInterface_WGLMakie |
| 2 | + |
| 3 | +# Constants |
| 4 | +const headingSize = 10 |
| 5 | + |
| 6 | +const path = dirname(dirname(@__FILE__)) # Absolute path of package directory |
| 7 | +const Version = "0.1.0" |
| 8 | +const Date = "2022-07-04" |
| 9 | + |
| 10 | +println("Importing SignalTablesInterface_WGLMakie Version $Version ($Date) - this takes some time due to WGLMakie import") |
| 11 | + |
| 12 | +import SignalTables |
| 13 | +import Colors |
| 14 | +import Measurements |
| 15 | +import MonteCarloMeasurements |
| 16 | +using Unitful |
| 17 | + |
| 18 | +using WGLMakie |
| 19 | +include("$(SignalTables.path)/src/AbstractPlotInterface.jl") |
| 20 | + |
| 21 | +const showFigureStringInDiagram = true |
| 22 | +const callDisplayFunction = true |
| 23 | +const reusePossible = false |
| 24 | + |
| 25 | +const Makie_Point2f = isdefined(WGLMakie, :Point2f) ? Point2f : Point2f0 |
| 26 | +include("$(SignalTables.path)/src/makie.jl") |
| 27 | + |
| 28 | + |
| 29 | +function showFigure(figureNumber::Int)::Nothing |
| 30 | + #println("... in showFigure") |
| 31 | + if haskey(figures, figureNumber) |
| 32 | + matrixFigure = figures[figureNumber] |
| 33 | + fig = matrixFigure.fig |
| 34 | + display(fig) |
| 35 | + else |
| 36 | + @info "showFigure: figure $figureNumber is not defined." |
| 37 | + end |
| 38 | + return nothing |
| 39 | +end |
| 40 | + |
| 41 | + |
| 42 | +function saveFigure(figureNumber::Int, fileName; kwargs...)::Nothing |
| 43 | + #println("... in saveFigure") |
| 44 | + if haskey(figures, figureNumber) |
| 45 | + #fig = figures[figureNumber].fig |
| 46 | + #fullFileName = joinpath(pwd(), fileName) |
| 47 | + #println("... save plot in file: \"$fullFileName\"") |
| 48 | + @info "saveFigure($figureNumber, \"$fileName\") is ignored since WLGMakie.save(..) leads to errors." |
| 49 | + #save(fileName, fig; kwargs...) |
| 50 | + #display(fig) |
| 51 | + else |
| 52 | + @info "saveFigure: figure $figureNumber is not defined." |
| 53 | + end |
| 54 | + return nothing |
| 55 | +end |
| 56 | + |
| 57 | + |
| 58 | +function closeFigure(figureNumber::Int)::Nothing |
| 59 | + #println("... in closeFigure") |
| 60 | + delete!(figures,figureNumber) |
| 61 | + if length(figures) > 0 |
| 62 | + dictElement = first(figures) |
| 63 | + display(dictElement[2].fig) |
| 64 | + else |
| 65 | + fig = Figure() |
| 66 | + display(fig) |
| 67 | + end |
| 68 | + return nothing |
| 69 | +end |
| 70 | + |
| 71 | + |
| 72 | +""" |
| 73 | + closeAllFigures() |
| 74 | +
|
| 75 | +Close all figures. |
| 76 | +""" |
| 77 | +function closeAllFigures()::Nothing |
| 78 | + #println("... in closeAllFigures") |
| 79 | + if length(figures) > 0 |
| 80 | + empty!(figures) |
| 81 | + fig = Figure() |
| 82 | + display(fig) |
| 83 | + end |
| 84 | + return nothing |
| 85 | +end |
| 86 | + |
| 87 | +end |
0 commit comments