Skip to content

Commit a39af6e

Browse files
committed
- Initial version (based on ModiaPlot_WGLMakie.jl)
0 parents  commit a39af6e

File tree

7 files changed

+186
-0
lines changed

7 files changed

+186
-0
lines changed

.github/workflows/TagBot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: TagBot
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
7+
inputs:
8+
lookback:
9+
default: 3
10+
permissions:
11+
contents: write
12+
jobs:
13+
TagBot:
14+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: JuliaRegistries/TagBot@v1
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Manifest.toml

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021-2022 DLR Institute of System Dynamics and Control
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Project.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name = "SignalTablesInterface_WGLMakie"
2+
uuid = "749bcd42-40b2-4908-9ca0-95341da8b98b"
3+
4+
version = "0.1.0"
5+
6+
[deps]
7+
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
8+
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
9+
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
10+
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
11+
SignalTables = "3201582d-3078-4276-ba5d-0a1254d79d7c"
12+
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
13+
WGLMakie = "276b4fcb-3e11-5398-bf8b-a0c2d153d008"
14+
15+
[compat]
16+
Colors = "0.12, 0.11, 0.10"
17+
DataFrames = "1, 0.22, 0.21, 0.20, 0.19"
18+
WGLMakie = "0.6"
19+
Measurements = "2"
20+
MonteCarloMeasurements = "1, 0.10"
21+
SignalTables = "0.3"
22+
Unitful = "1"
23+
julia = "1.7"
24+
25+
26+
[extras]
27+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
28+
29+
[targets]
30+
test = ["Test"]

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SignalTablesInterface_WGLMakie
2+
3+
This package is an interface from [SignalTables](https://github.com/ModiaSim/SignalTables.jl) to
4+
[WGLMakie](https://github.com/JuliaPlots/Makie.jl) (= Julia interface to backend WGLMakie of Makie.jl)
5+
in order to be able to perform convenient line plots in SignalTables via GLMakie.
6+
7+
This package is usually not directly used, but is activated via package
8+
[SignalTables](https://github.com/ModiaSim/SignalTables.jl).
9+
For details of the installation and the usage,
10+
see the [SignalTables documentation](https://modiasim.github.io/SignalTables.jl/stable/index.html).
11+
12+
13+
## Main developer
14+
15+
[Martin Otter](https://rmc.dlr.de/sr/en/staff/martin.otter/),
16+
[DLR - Institute of System Dynamics and Control](https://www.dlr.de/sr/en)
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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

test/runtests.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module SignalTablesInterface_WGLMakie_runtests
2+
3+
import SignalTables
4+
using Test
5+
6+
@testset "Test SignalTablesInterface_WGLMakie/test" begin
7+
SignalTables.usePlotPackage("WGLMakie")
8+
include("$(SignalTables.path)/test/include_all.jl")
9+
SignalTables.usePreviousPlotPackage()
10+
end
11+
12+
end

0 commit comments

Comments
 (0)