Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
PlotExportManager.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
14
15#include <atomic>
16#include <expected>
17#include <functional>
18#include <map>
19#include <span>
20#include <string>
21#include <thread>
22#include <vector>
23
24namespace correlation::app {
25
31public:
35 using StatusCallback = std::function<void(const std::string &)>;
36
41
46
51
62 [[nodiscard]] static std::expected<void, std::string>
63 savePlot(const std::string &filepath, const std::string &plot_name,
65 std::span<const PinnedRun> pinned_runs,
66 const std::map<std::string, real_t> &ashcroft_weights = {});
67
79 void exportPlotAsync(const std::string &default_base_path, const std::string &plot_name,
81 correlation::plotters::PlotConfig config, std::vector<PinnedRun> pinned_runs,
82 std::map<std::string, real_t> ashcroft_weights, StatusCallback on_status);
83
88 [[nodiscard]] bool isDialogActive() const noexcept;
89
90private:
91 std::jthread dialog_thread_;
92 std::atomic<bool> dialog_active_{false};
93};
94
95} // namespace correlation::app
Manager for distribution function calculations (RDF, PAD, S(Q), etc.).
Manages curve visibility, custom colors, pinned runs, and toggle models for plots.
Common types, configuration structures, and palette/formatting utilities for SVG plotting.
void exportPlotAsync(const std::string &default_base_path, const std::string &plot_name, const correlation::analysis::Histogram *hist, correlation::plotters::PlotConfig config, std::vector< PinnedRun > pinned_runs, std::map< std::string, real_t > ashcroft_weights, StatusCallback on_status)
Launches the native OS save dialog on a background worker and executes the save on completion.
Definition PlotExportManager.cpp:65
PlotExportManager()
Default constructor.
PlotExportManager(PlotExportManager &&)=delete
bool isDialogActive() const noexcept
Checks if a native save file dialog is currently active.
Definition PlotExportManager.cpp:32
static std::expected< void, std::string > savePlot(const std::string &filepath, const std::string &plot_name, const correlation::analysis::Histogram *hist, correlation::plotters::PlotConfig config, std::span< const PinnedRun > pinned_runs, const std::map< std::string, real_t > &ashcroft_weights={})
Saves a plot synchronously to a destination filepath.
Definition PlotExportManager.cpp:34
PlotExportManager(const PlotExportManager &)=delete
std::function< void(const std::string &)> StatusCallback
Callback type for reporting export results or user cancellations.
Definition PlotExportManager.hpp:35
std::atomic< bool > dialog_active_
Definition PlotExportManager.hpp:92
PlotExportManager & operator=(PlotExportManager &&)=delete
~PlotExportManager()
Destructor. Joins active dialog thread if running.
Definition PlotExportManager.cpp:26
std::jthread dialog_thread_
Definition PlotExportManager.hpp:91
PlotExportManager & operator=(const PlotExportManager &)=delete
Definition AppController.hpp:27
Container for a single calculated distribution function.
Definition DistributionFunctions.hpp:226
Theme and layout configuration for the plot.
Definition PlotTypes.hpp:42