jfjoch_viewer: Access binary plot whenever possible

This commit is contained in:
2025-12-07 09:08:37 +01:00
parent 6d12773b28
commit 10caaacfac

View File

@@ -189,6 +189,17 @@ std::vector<float> 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<float> 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);