From 10caaacfacd2797869bf9f310207efe19da09252 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 7 Dec 2025 09:08:37 +0100 Subject: [PATCH] jfjoch_viewer: Access binary plot whenever possible --- reader/JFJochHttpReader.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/reader/JFJochHttpReader.cpp b/reader/JFJochHttpReader.cpp index 983282dc..37369b04 100644 --- a/reader/JFJochHttpReader.cpp +++ b/reader/JFJochHttpReader.cpp @@ -189,6 +189,17 @@ std::vector JFJochHttpReader::GetPlot_i(const std::string &plot_type, flo return {}; httplib::Client cli_cmd(addr); + + auto res_bin = cli_cmd.Get("/preview/plot.bin?type=" + plot_type); + if (res_bin && res_bin->status == httplib::StatusCode::OK_200) { + if (res_bin->body.size() % sizeof(float) != 0) { + throw std::runtime_error("Input size is not a multiple of sizeof(float)"); + } + std::vector v(res_bin->body.size() / sizeof(float)); + std::memcpy(v.data(), res_bin->body.data(), res_bin->body.size()); + return v; + } + auto res = cli_cmd.Get("/preview/plot?binning=1&experimental_coord=false&fill=" + std::to_string(fill_value) + "&type=" + plot_type);