Skip to content

Commit

Permalink
Initial version (based on ModiaResult_CairoMakie)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinOtter committed Jul 4, 2022
0 parents commit 37c7096
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: TagBot
on:
issue_comment:
types:
- created
workflow_dispatch:
inputs:
lookback:
default: 3
permissions:
contents: write
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Manifest.toml
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021-2022 DLR Institute of System Dynamics and Control

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 29 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name = "SignalTablesInterface_CairoMakie"
uuid = "9a677d73-819a-4685-8db0-bdf9b06384c4"
authors = ["[email protected] <[email protected]>"]
version = "0.1.0"

[deps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
SignalTables = "3201582d-3078-4276-ba5d-0a1254d79d7c"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
CairoMakie = "0.8"
Colors = "0.12, 0.11, 0.10"
DataFrames = "1, 0.22, 0.21, 0.20, 0.19"
Measurements = "2"
MonteCarloMeasurements = "1, 0.10"
SignalTables = "0.3"
Unitful = "1"
julia = "1.7"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SignalTablesInterface_CairoMakie

This package is an interface from [SignalTables](https://github.com/ModiaSim/SignalTables.jl) to
[CairoMakie](https://github.com/JuliaPlots/Makie.jl) (= Julia interface to backend CairoMakie of Makie.jl)
in order to be able to perform convenient line plots in SignalTables via CairoMakie.

This package is usually not directly used, but is activated via package
[SignalTables](https://github.com/ModiaSim/SignalTables.jl).
For details of the installation and the usage,
see the [SignalTables documentation](https://modiasim.github.io/SignalTables.jl/stable/index.html).


## Main developer

[Martin Otter](https://rmc.dlr.de/sr/en/staff/martin.otter/),
[DLR - Institute of System Dynamics and Control](https://www.dlr.de/sr/en)
64 changes: 64 additions & 0 deletions src/SignalTablesInterface_CairoMakie.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
module SignalTablesInterface_CairoMakie


# Constants
const headingSize = 10

const path = dirname(dirname(@__FILE__)) # Absolute path of package directory
const Version = "0.1.0"
const Date = "2022-07-04"

println("Importing SignalTablesInterface_CairoMakie Version $Version ($Date) - this takes some time due to CairoMakie import")

import SignalTables
import Colors
import Measurements
import MonteCarloMeasurements
using Unitful

using CairoMakie
include("$(SignalTables.path)/src/AbstractPlotInterface.jl")

const showFigureStringInDiagram = false
const callDisplayFunction = false
const reusePossible = true

const Makie_Point2f = isdefined(CairoMakie, :Point2f) ? Point2f : Point2f0
include("$(SignalTables.path)/src/makie.jl")


showFigure(figureNumber::Int) = nothing

function saveFigure(figureNumber::Int, fileName; kwargs...)::Nothing
if haskey(figures, figureNumber)
fig = figures[figureNumber].fig
fullFileName = joinpath(pwd(), fileName)
println("... save plot in file: \"$fullFileName\"")
save(fileName, fig; kwargs...)
else
@info "saveFigure: figure $figureNumber is not defined."
end
return nothing
end


function closeFigure(figureNumber::Int)::Nothing
delete!(figures,figureNumber)
return nothing
end


"""
closeAllFigures()
Close all figures.
"""
function closeAllFigures()::Nothing
if length(figures) > 0
empty!(figures)
end
return nothing
end


end
12 changes: 12 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module SignalTablesInterface_CairoMakie_runtests

import SignalTables
using Test

@testset "Test SignalTablesInterface_CairoMakie/test" begin
SignalTables.usePlotPackage("CairoMakie")
include("$(SignalTables.path)/test/include_all.jl")
SignalTables.usePreviousPlotPackage()
end

end

0 comments on commit 37c7096

Please sign in to comment.