Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::app::PlotSeriesManager Class Reference

Manages curve visibility, custom palette colors, pinned comparison runs, and Slint toggle models. More...

#include <PlotSeriesManager.hpp>

Public Member Functions

 PlotSeriesManager ()=default
 Default constructor.
void setCurveVisible (int curve_id, bool visible)
 Toggles the visibility of a curve by its toggle index.
void setAllCurvesVisible (bool visible, std::string_view filter="")
 Sets the visibility for all currently tracked toggle curves. If a filter is specified or active, sets visibility only for matching curves.
void invertCurveVisibility (std::string_view filter="")
 Inverts the visibility of curves. If a filter is specified or active, inverts only matching curves.
void setFilterText (std::string_view filter)
 Sets the active substring search filter for curve toggles.
std::string_view getFilterText () const noexcept
 Retrieves the active substring search filter.
bool isCurveVisible (const std::string &key, bool default_val=true) const
 Checks if a specific curve key is visible.
const std::map< std::string, bool > & getCurveVisibilityMap () const noexcept
 Retrieves the complete curve visibility map.
void setCustomColor (int curve_id, const std::string &color_hex)
 Sets a custom hex color for a curve by its toggle index.
const std::map< std::string, std::string > & getCustomColors () const noexcept
 Retrieves the map of custom curve colors.
void pinCurrentRun (const std::map< std::string, correlation::analysis::Histogram > &hists)
 Pins the provided histogram dataset as a comparison overlay run.
void clearPinnedRuns () noexcept
 Clears all pinned comparison runs.
const std::vector< PinnedRun > & getPinnedRuns () const noexcept
 Retrieves all pinned comparison runs.
size_t getPinnedRunsCount () const noexcept
 Retrieves the count of pinned comparison runs.
void setShowDifference (bool show) noexcept
 Sets whether the overlaid difference curve Y_diff is shown.
bool shouldShowDifference () const noexcept
 Queries whether the overlaid difference curve is visible.
const std::vector< std::string > & getCurrentToggleKeys () const noexcept
 Retrieves the currently ordered list of curve toggle keys.
std::shared_ptr< slint::VectorModel< CurveToggleItem > > generateToggleItems (const correlation::analysis::Histogram *hist, const correlation::plotters::PlotConfig &config, const std::map< std::string, real_t > &ashcroft_weights={})
 Generates the Slint VectorModel of CurveToggleItem for UI presentation.
const std::map< std::string, std::string > & getAssignedCurveColors () const noexcept
 Retrieves the active assigned colors for current histogram curves (defaults + custom).
void reset () noexcept
 Resets all series state (visibility overrides, custom colors, pinned runs, and flags).

Private Attributes

std::map< std::string, bool > curve_visibility_map_
std::map< std::string, std::string > custom_curve_colors_
std::map< std::string, std::string > assigned_curve_colors_
std::vector< std::string > current_toggle_keys_
std::vector< PinnedRun > pinned_runs_
std::string filter_text_
bool show_difference_curve_ {false}

Detailed Description

Manages curve visibility, custom palette colors, pinned comparison runs, and Slint toggle models.

Constructor & Destructor Documentation

◆ PlotSeriesManager()

correlation::app::PlotSeriesManager::PlotSeriesManager ( )
default

Default constructor.

Member Function Documentation

◆ clearPinnedRuns()

void correlation::app::PlotSeriesManager::clearPinnedRuns ( )
noexcept

Clears all pinned comparison runs.

◆ generateToggleItems()

std::shared_ptr< slint::VectorModel< CurveToggleItem > > correlation::app::PlotSeriesManager::generateToggleItems ( const correlation::analysis::Histogram * hist,
const correlation::plotters::PlotConfig & config,
const std::map< std::string, real_t > & ashcroft_weights = {} )
nodiscard

Generates the Slint VectorModel of CurveToggleItem for UI presentation.

Parameters
[in]histPointer to the current active analytical histogram.
[in]configActive plot rendering configuration for default palette colors.
[in]ashcroft_weightsMap of partial labels to their Ashcroft-Langreth weights.
Returns
Shared pointer to Slint VectorModel of CurveToggleItem.

◆ getAssignedCurveColors()

const std::map< std::string, std::string > & correlation::app::PlotSeriesManager::getAssignedCurveColors ( ) const
inlinenodiscardnoexcept

Retrieves the active assigned colors for current histogram curves (defaults + custom).

Returns
Const reference to assigned colors map.

◆ getCurrentToggleKeys()

const std::vector< std::string > & correlation::app::PlotSeriesManager::getCurrentToggleKeys ( ) const
inlinenodiscardnoexcept

Retrieves the currently ordered list of curve toggle keys.

Returns
Const reference to current toggle keys vector.

◆ getCurveVisibilityMap()

const std::map< std::string, bool > & correlation::app::PlotSeriesManager::getCurveVisibilityMap ( ) const
inlinenodiscardnoexcept

Retrieves the complete curve visibility map.

Returns
Const reference to the visibility map.

◆ getCustomColors()

const std::map< std::string, std::string > & correlation::app::PlotSeriesManager::getCustomColors ( ) const
inlinenodiscardnoexcept

Retrieves the map of custom curve colors.

Returns
Const reference to custom colors map.

◆ getFilterText()

std::string_view correlation::app::PlotSeriesManager::getFilterText ( ) const
inlinenodiscardnoexcept

Retrieves the active substring search filter.

Returns
Current filter string view.

◆ getPinnedRuns()

const std::vector< PinnedRun > & correlation::app::PlotSeriesManager::getPinnedRuns ( ) const
inlinenodiscardnoexcept

Retrieves all pinned comparison runs.

Returns
Const reference to vector of pinned runs.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPinnedRunsCount()

size_t correlation::app::PlotSeriesManager::getPinnedRunsCount ( ) const
inlinenodiscardnoexcept

Retrieves the count of pinned comparison runs.

Returns
Total pinned runs.

◆ invertCurveVisibility()

void correlation::app::PlotSeriesManager::invertCurveVisibility ( std::string_view filter = "")

Inverts the visibility of curves. If a filter is specified or active, inverts only matching curves.

Parameters
[in]filterOptional substring filter to restrict which curves are inverted.
Here is the call graph for this function:

◆ isCurveVisible()

bool correlation::app::PlotSeriesManager::isCurveVisible ( const std::string & key,
bool default_val = true ) const
nodiscard

Checks if a specific curve key is visible.

Parameters
[in]keyCurve key name.
[in]default_valDefault state returned if key is not explicitly registered.
Returns
True if curve is visible, false otherwise.
Here is the caller graph for this function:

◆ pinCurrentRun()

void correlation::app::PlotSeriesManager::pinCurrentRun ( const std::map< std::string, correlation::analysis::Histogram > & hists)

Pins the provided histogram dataset as a comparison overlay run.

Parameters
[in]histsMap of plot names to histograms.

◆ reset()

void correlation::app::PlotSeriesManager::reset ( )
noexcept

Resets all series state (visibility overrides, custom colors, pinned runs, and flags).

◆ setAllCurvesVisible()

void correlation::app::PlotSeriesManager::setAllCurvesVisible ( bool visible,
std::string_view filter = "" )

Sets the visibility for all currently tracked toggle curves. If a filter is specified or active, sets visibility only for matching curves.

Parameters
[in]visibleTarget visibility state for curves.
[in]filterOptional substring filter to restrict which curves are modified.

◆ setCurveVisible()

void correlation::app::PlotSeriesManager::setCurveVisible ( int curve_id,
bool visible )

Toggles the visibility of a curve by its toggle index.

Parameters
[in]curve_idIndex corresponding to the current toggle item.
[in]visibleTarget visibility state.

◆ setCustomColor()

void correlation::app::PlotSeriesManager::setCustomColor ( int curve_id,
const std::string & color_hex )

Sets a custom hex color for a curve by its toggle index.

Parameters
[in]curve_idIndex corresponding to the current toggle item.
[in]color_hexHex color string (e.g. "#RRGGBB").

◆ setFilterText()

void correlation::app::PlotSeriesManager::setFilterText ( std::string_view filter)

Sets the active substring search filter for curve toggles.

Parameters
[in]filterSubstring filter (e.g. "Fe", "O-H", "Total").

◆ setShowDifference()

void correlation::app::PlotSeriesManager::setShowDifference ( bool show)
inlinenoexcept

Sets whether the overlaid difference curve Y_diff is shown.

Parameters
[in]showTrue to show difference curve, false to hide.

◆ shouldShowDifference()

bool correlation::app::PlotSeriesManager::shouldShowDifference ( ) const
inlinenodiscardnoexcept

Queries whether the overlaid difference curve is visible.

Returns
True if difference curve is enabled.

Member Data Documentation

◆ assigned_curve_colors_

std::map<std::string, std::string> correlation::app::PlotSeriesManager::assigned_curve_colors_
private

◆ current_toggle_keys_

std::vector<std::string> correlation::app::PlotSeriesManager::current_toggle_keys_
private

◆ curve_visibility_map_

std::map<std::string, bool> correlation::app::PlotSeriesManager::curve_visibility_map_
private

◆ custom_curve_colors_

std::map<std::string, std::string> correlation::app::PlotSeriesManager::custom_curve_colors_
private

◆ filter_text_

std::string correlation::app::PlotSeriesManager::filter_text_
private

◆ pinned_runs_

std::vector<PinnedRun> correlation::app::PlotSeriesManager::pinned_runs_
private

◆ show_difference_curve_

bool correlation::app::PlotSeriesManager::show_difference_curve_ {false}
private

The documentation for this class was generated from the following files: