From bb81dd637aee96217838eddac3cc0b49790ea7f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 5 May 2024 16:28:20 +0200
Subject: [PATCH] community/libsurvive: add support for sciplot-0.3.0

---
 community/libsurvive/APKBUILD            |  4 ++-
 community/libsurvive/sciplot-0.3.0.patch | 42 ++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 community/libsurvive/sciplot-0.3.0.patch

diff --git a/community/libsurvive/APKBUILD b/community/libsurvive/APKBUILD
index 70a18ff93172..85558034ee81 100644
--- a/community/libsurvive/APKBUILD
+++ b/community/libsurvive/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Bart Ribbers <bribbers@disroot.org>
 pkgname=libsurvive
 pkgver=1.01
-pkgrel=4
+pkgrel=5
 pkgdesc="Open Source Lighthouse Tracking System"
 url="https://github.com/cntools/libsurvive"
 arch="all"
@@ -22,6 +22,7 @@ makedepends="$depends_dev
 subpackages="$pkgname-static $pkgname-dev $pkgname-bash-completion $pkgname-web::noarch"
 source="https://github.com/cntools/libsurvive/releases/download/v$pkgver/libsurvive-v$pkgver-source.zip
 	off64_t.patch
+	sciplot-0.3.0.patch
 	"
 options="!check" # Requires live test data
 builddir="$srcdir/$pkgname"
@@ -56,4 +57,5 @@ web() {
 sha512sums="
 6033d2524581bdefb0e1ed6e27c8044ba6ff32aa997845124c0b29d1a5a3f082a50605b2b654a642051ad0f22c6c8ad4ea8ca98888e28443d52ab68eb566effc  libsurvive-v1.01-source.zip
 35ec5f53027fcf69ce335794f5b3e01421bb9d2ffbfec571703cdd136216f3f85794774b788cccd844ca9a803a605b5d6d7124b9d49767ea0614c6b2c869791b  off64_t.patch
+c838efca5cdaabac903b435a50859232903723cc30a992755029e4c2fac3a2793f6eb866a1c95650c075c1da0ba9def917cffddb7ce10948aa213ed1cb79d8ac  sciplot-0.3.0.patch
 "
diff --git a/community/libsurvive/sciplot-0.3.0.patch b/community/libsurvive/sciplot-0.3.0.patch
new file mode 100644
index 000000000000..0bed0c228688
--- /dev/null
+++ b/community/libsurvive/sciplot-0.3.0.patch
@@ -0,0 +1,42 @@
+diff -upr libsurvive.orig/libs/cnkalman/include/cnkalman/ModelPlot.h libsurvive/libs/cnkalman/include/cnkalman/ModelPlot.h
+--- libsurvive.orig/libs/cnkalman/include/cnkalman/ModelPlot.h	2024-05-04 23:56:53.101787459 +0200
++++ libsurvive/libs/cnkalman/include/cnkalman/ModelPlot.h	2024-05-04 23:57:03.865002250 +0200
+@@ -13,8 +13,8 @@ namespace cnkalman {
+         std::string name;
+         int cnt = 0;
+ #ifdef HAS_SCIPLOT
+-        sciplot::Plot plot;
+-        sciplot::Plot map;
++        sciplot::Plot2D plot;
++        sciplot::Plot2D map;
+ #endif
+         ModelPlot(const std::string &name = "plot", bool show = false);
+ 
+diff -upr libsurvive.orig/libs/cnkalman/src/ModelPlot.cc libsurvive/libs/cnkalman/src/ModelPlot.cc
+--- libsurvive.orig/libs/cnkalman/src/ModelPlot.cc	2024-05-04 23:56:53.105123856 +0200
++++ libsurvive/libs/cnkalman/src/ModelPlot.cc	2024-05-04 23:58:30.067476028 +0200
+@@ -62,13 +62,19 @@ namespace cnkalman {
+         map.xrange(range[0], range[1]);
+         map.yrange(range[2], range[3]);
+ 
++        sciplot::Figure plot_fig = {{plot}};
++        sciplot::Canvas plot_canvas = {{plot_fig}};
++        sciplot::Figure map_fig = {{map}};
++        sciplot::Canvas map_canvas = {{map_fig}};
++
+         if (show) {
+-            plot.show();
+-            map.show();
++            plot_canvas.show();
++            map_canvas.show();
+         }
+-        plot.save(name + "-plot.svg");
+-        map.save(name + ".svg");
+-        map.save(name + ".png");
++
++        plot_canvas.save(name + "-plot.svg");
++        map_canvas.save(name + ".svg");
++        map_canvas.save(name + ".png");
+ #endif
+     }
+ 
-- 
GitLab