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

Manages 2D plot coordinate space, active zoom window, and interactive pan/zoom transitions. More...

#include <PlotViewportNavigator.hpp>

Public Member Functions

bool hasActiveZoom () const noexcept
 Checks if a custom zoom window is currently active.
void applyZoomRect (float start_x, float start_y, float end_x, float end_y, float canvas_w, float canvas_h, const correlation::analysis::Histogram &hist, const correlation::plotters::PlotConfig &config)
 Applies rectangular selection box zoom.
void applyPan (float delta_x, float delta_y, float mouse_x, float mouse_y, float canvas_w, float canvas_h, const correlation::analysis::Histogram &hist, const correlation::plotters::PlotConfig &config)
 Applies viewport translation pan by delta pixel displacement.
void applyWheelZoom (float mouse_x, float mouse_y, float delta, float canvas_w, float canvas_h, const correlation::analysis::Histogram &hist, const correlation::plotters::PlotConfig &config)
 Applies stepped or continuous zoom centered around mouse cursor.
void resetZoom () noexcept
 Resets zoom state to full automatic bounds.
ViewportLimits limits () const noexcept
 Returns currently active zoom window limits.
void setLimits (ViewportLimits limits) noexcept
 Sets explicit manual viewport limits.
void applyToConfig (correlation::plotters::PlotConfig &config) const noexcept
 Injects active zoom limits into target PlotConfig.

Static Public Member Functions

static correlation::plotters::detail::NiceScale computeXScale (const correlation::analysis::Histogram &hist, const correlation::plotters::PlotConfig &config)
 Computes standard or manual nice axis scale for the X dimension.
static correlation::plotters::detail::NiceScale computeYScale (const correlation::analysis::Histogram &hist, const correlation::plotters::PlotConfig &config)
 Computes standard or manual nice axis scale for the Y dimension across all visible partials.
static std::pair< real_t, real_t > screenToData (float screen_x, float screen_y, float canvas_w, float canvas_h, const correlation::analysis::Histogram &hist, const correlation::plotters::PlotConfig &config)
 Projects screen-space coordinates to data-space coordinates.
static std::pair< real_t, real_t > dataToScreen (real_t data_x, real_t data_y, float canvas_w, float canvas_h, const correlation::analysis::Histogram &hist, const correlation::plotters::PlotConfig &config)
 Projects data-space coordinates to screen-space coordinates.

Private Attributes

std::optional< real_t > zoom_x_min_
std::optional< real_t > zoom_x_max_
std::optional< real_t > zoom_y_min_
std::optional< real_t > zoom_y_max_

Detailed Description

Manages 2D plot coordinate space, active zoom window, and interactive pan/zoom transitions.

Member Function Documentation

◆ applyPan()

void correlation::app::PlotViewportNavigator::applyPan ( float delta_x,
float delta_y,
float mouse_x,
float mouse_y,
float canvas_w,
float canvas_h,
const correlation::analysis::Histogram & hist,
const correlation::plotters::PlotConfig & config )

Applies viewport translation pan by delta pixel displacement.

Parameters
[in]delta_xScreen horizontal pixel shift.
[in]delta_yScreen vertical pixel shift.
[in]mouse_xReference cursor X coordinate.
[in]mouse_yReference cursor Y coordinate.
[in]canvas_wCanvas width in pixels.
[in]canvas_hCanvas height in pixels.
[in]histActive histogram data.
[in]configBase plotting configuration.
Here is the call graph for this function:

◆ applyToConfig()

void correlation::app::PlotViewportNavigator::applyToConfig ( correlation::plotters::PlotConfig & config) const
noexcept

Injects active zoom limits into target PlotConfig.

Parameters
[in,out]configConfiguration structure to enrich.

◆ applyWheelZoom()

void correlation::app::PlotViewportNavigator::applyWheelZoom ( float mouse_x,
float mouse_y,
float delta,
float canvas_w,
float canvas_h,
const correlation::analysis::Histogram & hist,
const correlation::plotters::PlotConfig & config )

Applies stepped or continuous zoom centered around mouse cursor.

Parameters
[in]mouse_xFocus cursor X coordinate in pixels.
[in]mouse_yFocus cursor Y coordinate in pixels.
[in]deltaZoom displacement factor (>0 zooms in, <0 zooms out).
[in]canvas_wCanvas width in pixels.
[in]canvas_hCanvas height in pixels.
[in]histActive histogram data.
[in]configBase plotting configuration.
Here is the call graph for this function:

◆ applyZoomRect()

void correlation::app::PlotViewportNavigator::applyZoomRect ( float start_x,
float start_y,
float end_x,
float end_y,
float canvas_w,
float canvas_h,
const correlation::analysis::Histogram & hist,
const correlation::plotters::PlotConfig & config )

Applies rectangular selection box zoom.

Parameters
[in]start_xStarting drag X coordinate.
[in]start_yStarting drag Y coordinate.
[in]end_xEnding drag X coordinate.
[in]end_yEnding drag Y coordinate.
[in]canvas_wCanvas width in pixels.
[in]canvas_hCanvas height in pixels.
[in]histActive histogram data.
[in]configBase plotting configuration.
Here is the call graph for this function:

◆ computeXScale()

correlation::plotters::detail::NiceScale correlation::app::PlotViewportNavigator::computeXScale ( const correlation::analysis::Histogram & hist,
const correlation::plotters::PlotConfig & config )
staticnodiscard

Computes standard or manual nice axis scale for the X dimension.

Parameters
[in]histActive histogram data.
[in]configBase plotting configuration.
Returns
Formatted NiceScale with ticks and boundaries.
Here is the caller graph for this function:

◆ computeYScale()

correlation::plotters::detail::NiceScale correlation::app::PlotViewportNavigator::computeYScale ( const correlation::analysis::Histogram & hist,
const correlation::plotters::PlotConfig & config )
staticnodiscard

Computes standard or manual nice axis scale for the Y dimension across all visible partials.

Parameters
[in]histActive histogram data.
[in]configBase plotting configuration.
Returns
Formatted NiceScale with ticks and boundaries.
Here is the caller graph for this function:

◆ dataToScreen()

std::pair< real_t, real_t > correlation::app::PlotViewportNavigator::dataToScreen ( real_t data_x,
real_t data_y,
float canvas_w,
float canvas_h,
const correlation::analysis::Histogram & hist,
const correlation::plotters::PlotConfig & config )
staticnodiscard

Projects data-space coordinates to screen-space coordinates.

Parameters
[in]data_xData horizontal coordinate.
[in]data_yData vertical coordinate.
[in]canvas_wTotal canvas width in pixels.
[in]canvas_hTotal canvas height in pixels.
[in]histActive histogram data.
[in]configBase plotting configuration.
Returns
Pair containing (screen_x, screen_y) in pixels.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasActiveZoom()

bool correlation::app::PlotViewportNavigator::hasActiveZoom ( ) const
nodiscardnoexcept

Checks if a custom zoom window is currently active.

Returns
True if any zoom coordinate boundary is set.

◆ limits()

ViewportLimits correlation::app::PlotViewportNavigator::limits ( ) const
nodiscardnoexcept

Returns currently active zoom window limits.

Returns
ViewportLimits structure.
Here is the caller graph for this function:

◆ resetZoom()

void correlation::app::PlotViewportNavigator::resetZoom ( )
noexcept

Resets zoom state to full automatic bounds.

◆ screenToData()

std::pair< real_t, real_t > correlation::app::PlotViewportNavigator::screenToData ( float screen_x,
float screen_y,
float canvas_w,
float canvas_h,
const correlation::analysis::Histogram & hist,
const correlation::plotters::PlotConfig & config )
staticnodiscard

Projects screen-space coordinates to data-space coordinates.

Parameters
[in]screen_xScreen horizontal coordinate in pixels.
[in]screen_yScreen vertical coordinate in pixels.
[in]canvas_wTotal canvas width in pixels.
[in]canvas_hTotal canvas height in pixels.
[in]histActive histogram data.
[in]configBase plotting configuration.
Returns
Pair containing (data_x, data_y).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLimits()

void correlation::app::PlotViewportNavigator::setLimits ( ViewportLimits limits)
noexcept

Sets explicit manual viewport limits.

Parameters
[in]limitsManual boundary limits to apply.
Here is the call graph for this function:

Member Data Documentation

◆ zoom_x_max_

std::optional<real_t> correlation::app::PlotViewportNavigator::zoom_x_max_
private

◆ zoom_x_min_

std::optional<real_t> correlation::app::PlotViewportNavigator::zoom_x_min_
private

◆ zoom_y_max_

std::optional<real_t> correlation::app::PlotViewportNavigator::zoom_y_max_
private

◆ zoom_y_min_

std::optional<real_t> correlation::app::PlotViewportNavigator::zoom_y_min_
private

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