diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml new file mode 100644 index 0000000..d6738dd --- /dev/null +++ b/.github/workflows/TagBot.yml @@ -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 }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b067edd --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/Manifest.toml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9c30b56 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..dde66a6 --- /dev/null +++ b/Project.toml @@ -0,0 +1,29 @@ +name = "SignalTablesInterface_CairoMakie" +uuid = "9a677d73-819a-4685-8db0-bdf9b06384c4" +authors = ["Martin.Otter@dlr.de "] +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"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..6b5c9dc --- /dev/null +++ b/README.md @@ -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) \ No newline at end of file diff --git a/src/SignalTablesInterface_CairoMakie.jl b/src/SignalTablesInterface_CairoMakie.jl new file mode 100644 index 0000000..47e54ca --- /dev/null +++ b/src/SignalTablesInterface_CairoMakie.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl new file mode 100644 index 0000000..db66b02 --- /dev/null +++ b/test/runtests.jl @@ -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