v2.0.0
Loading...
Searching...
No Matches
DISPLIB::Spline Class Reference

Spline class for histogram display using QPainter. More...

#include <spline.h>

Public Types

typedef QSharedPointer< SplineSPtr
typedef QSharedPointer< const SplineConstSPtr

Signals

void borderChanged (double leftThreshold, double middleThreshold, double rightThreshold)

Public Member Functions

 Spline (QWidget *parent=nullptr, const QString &title="Spline Histogram")
template<typename T>
void setData (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &matClassLimitData, const Eigen::Matrix< int, Eigen::Dynamic, 1 > &matClassFrequencyData)
template<typename T>
void setData (const Eigen::Matrix< T, 1, Eigen::Dynamic > &matClassLimitData, const Eigen::Matrix< int, 1, Eigen::Dynamic > &matClassFrequencyData)
template<typename T>
void updatePlot (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &matClassLimitData, const Eigen::VectorXi &matClassFrequencyData)
void mousePressEvent (QMouseEvent *event) override
template<typename T>
void splitCoefficientAndExponent (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &matClassLimitData, int iClassAmount, Eigen::VectorXd &vecCoefficientResults, Eigen::VectorXi &vecExponentValues)
void setThreshold (const QVector3D &vecThresholdValues)
const QVector3D & getThreshold ()
QVector3D correctionDisplayTrueValue (QVector3D vecOriginalValues, QString upOrDown)
void setColorMap (const QString &colorMap)

Public Attributes

Eigen::VectorXi m_vecResultExponentValues
double m_dMinAxisX
double m_dMaxAxisX

Protected Member Functions

void paintEvent (QPaintEvent *event) override
double dataToPixelX (double dataX) const
double dataToPixelY (double dataY) const
double pixelToDataX (double pixelX) const
int leftMargin () const
int rightMargin () const
int topMargin () const
int bottomMargin () const

Protected Attributes

QList< QPointF > m_seriesData
double m_dLeftThreshold
double m_dMiddleThreshold
double m_dRightThreshold
bool m_bHasData
bool m_bHasThresholds
int m_iMaximumFrequency
QString m_colorMap
QVector3D m_vecReturnVector

Detailed Description

Spline class for histogram display using QPainter.

Histogram display using QPainter with spline interpolation

Definition at line 78 of file spline.h.

Inheritance diagram for DISPLIB::Spline:
Inheritance graph

Member Typedef Documentation

◆ ConstSPtr

typedef QSharedPointer<const Spline> DISPLIB::Spline::ConstSPtr

Const shared pointer type for Spline class.

Definition at line 84 of file spline.h.

◆ SPtr

typedef QSharedPointer<Spline> DISPLIB::Spline::SPtr

Shared pointer type for Spline class.

Definition at line 83 of file spline.h.

Constructor & Destructor Documentation

◆ Spline()

Spline::Spline ( QWidget * parent = nullptr,
const QString & title = "Spline Histogram" )

The constructor for Spline

Parameters
[in]parentsets the behaviour of Spline as an object, defaults to no parent QWidget.
[in]titlestring to specify the title displayed on the histogram, defaults to "Spline Histogram".

Definition at line 68 of file spline.cpp.

Member Function Documentation

◆ borderChanged

void DISPLIB::Spline::borderChanged ( double leftThreshold,
double middleThreshold,
double rightThreshold )
signal

emit signal consisting of three threshold lines x-axis value if any one of them is changed

Parameters
[out]leftThresholdvalue of the left threshold line.
[out]middleThresholdvalue of the middle threshold line.
[out]rightThresholdvalue of the right threshold line.

◆ bottomMargin()

int DISPLIB::Spline::bottomMargin ( ) const
inlineprotected

Returns the bottom margin in pixels.

Definition at line 231 of file spline.h.

◆ correctionDisplayTrueValue()

QVector3D Spline::correctionDisplayTrueValue ( QVector3D vecOriginalValues,
QString upOrDown )

correctionDisplayTrueValue creates necessary adjustment of exponential multiplication with base 10

Parameters
[in]vecOriginalValuesQVector3D consisting of 3 original values.
[in]upOrDownChoice between "up" or "down" conversion direction.
Returns
returns QVector3D after necessary adjustment.

Definition at line 343 of file spline.cpp.

◆ dataToPixelX()

double Spline::dataToPixelX ( double dataX) const
protected

Converts data X coordinate to pixel X coordinate.

Definition at line 87 of file spline.cpp.

◆ dataToPixelY()

double Spline::dataToPixelY ( double dataY) const
protected

Converts data Y coordinate to pixel Y coordinate.

Definition at line 97 of file spline.cpp.

◆ getThreshold()

const QVector3D & Spline::getThreshold ( )

getThreshold retrieves the current threshold values

Returns
returns QVector3D corresponding to the x-axis value of the threshold lines.

Definition at line 331 of file spline.cpp.

◆ leftMargin()

int DISPLIB::Spline::leftMargin ( ) const
inlineprotected

Returns the left margin in pixels.

Definition at line 213 of file spline.h.

◆ mousePressEvent()

void Spline::mousePressEvent ( QMouseEvent * event)
override

constructor for mouse press event behaviour to create threshold lines and signal emit

Parameters
[in]eventmouse press input.

Definition at line 248 of file spline.cpp.

◆ paintEvent()

void Spline::paintEvent ( QPaintEvent * event)
overrideprotected

Paints the spline chart.

Parameters
[in]eventThe paint event.

Definition at line 116 of file spline.cpp.

◆ pixelToDataX()

double Spline::pixelToDataX ( double pixelX) const
protected

Converts pixel X coordinate to data X coordinate.

Definition at line 106 of file spline.cpp.

◆ rightMargin()

int DISPLIB::Spline::rightMargin ( ) const
inlineprotected

Returns the right margin in pixels.

Definition at line 219 of file spline.h.

◆ setColorMap()

void Spline::setColorMap ( const QString & colorMap)

setColorMap sets the color mapping on the histogram background

Parameters
[in]colorMapqstring of the color gradient from user input.

Definition at line 323 of file spline.cpp.

◆ setData() [1/2]

template<typename T>
void DISPLIB::Spline::setData ( const Eigen::Matrix< T, 1, Eigen::Dynamic > & matClassLimitData,
const Eigen::Matrix< int, 1, Eigen::Dynamic > & matClassFrequencyData )

Definition at line 271 of file spline.h.

◆ setData() [2/2]

template<typename T>
void DISPLIB::Spline::setData ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > & matClassLimitData,
const Eigen::Matrix< int, Eigen::Dynamic, 1 > & matClassFrequencyData )

creates a spline histogram from 2 vectors: class limits and class frequency

Parameters
[in]matClassLimitDatavector input filled with class limits.
[in]matClassFrequencyDatavector input filled with class frequency to the corresponding class.

Definition at line 260 of file spline.h.

◆ setThreshold()

void Spline::setThreshold ( const QVector3D & vecThresholdValues)

setThreshold takes in QVector3D value and creates the corresponding lines in the histogram

Parameters
[in]vecThresholdValuesQVector3D consisting of 3 values corresponding to the threshold lines.

Definition at line 289 of file spline.cpp.

◆ splitCoefficientAndExponent()

template<typename T>
void DISPLIB::Spline::splitCoefficientAndExponent ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & matClassLimitData,
int iClassAmount,
Eigen::VectorXd & vecCoefficientResults,
Eigen::VectorXi & vecExponentValues )

splitCoefficientAndExponent takes in QVector value of coefficient and exponent and normalizes them.

Parameters
[in]matClassLimitDatavector input filled with values of class limits.
[in]iClassAmountamount of classes in the histogram.
[out]vecCoefficientResultsvector filled with values of coefficient only.
[out]vecExponentValuesvector filled with values of exponent only.

Definition at line 317 of file spline.h.

◆ topMargin()

int DISPLIB::Spline::topMargin ( ) const
inlineprotected

Returns the top margin in pixels.

Definition at line 225 of file spline.h.

◆ updatePlot()

template<typename T>
void DISPLIB::Spline::updatePlot ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & matClassLimitData,
const Eigen::VectorXi & matClassFrequencyData )

Updates the spline with new data

Parameters
[in]matClassLimitDatavector input filled with class limits.
[in]matClassFrequencyDatavector input filled with class frequency to the corresponding class.

Definition at line 282 of file spline.h.

Member Data Documentation

◆ m_bHasData

bool DISPLIB::Spline::m_bHasData
protected

Whether data has been loaded.

Definition at line 237 of file spline.h.

◆ m_bHasThresholds

bool DISPLIB::Spline::m_bHasThresholds
protected

Whether thresholds have been set.

Definition at line 238 of file spline.h.

◆ m_colorMap

QString DISPLIB::Spline::m_colorMap
protected

Color map name for background gradient.

Definition at line 240 of file spline.h.

◆ m_dLeftThreshold

double DISPLIB::Spline::m_dLeftThreshold
protected

X-axis value of the left threshold line.

Definition at line 234 of file spline.h.

◆ m_dMaxAxisX

double DISPLIB::Spline::m_dMaxAxisX

Display value of the largest point on the series in x-axis.

Definition at line 180 of file spline.h.

◆ m_dMiddleThreshold

double DISPLIB::Spline::m_dMiddleThreshold
protected

X-axis value of the middle threshold line.

Definition at line 235 of file spline.h.

◆ m_dMinAxisX

double DISPLIB::Spline::m_dMinAxisX

Display value of the smallest point of the series in x-axis.

Definition at line 179 of file spline.h.

◆ m_dRightThreshold

double DISPLIB::Spline::m_dRightThreshold
protected

X-axis value of the right threshold line.

Definition at line 236 of file spline.h.

◆ m_iMaximumFrequency

int DISPLIB::Spline::m_iMaximumFrequency
protected

Highest value of frequency (y-axis).

Definition at line 239 of file spline.h.

◆ m_seriesData

QList<QPointF> DISPLIB::Spline::m_seriesData
protected

Spline data points (classMark, frequency).

Definition at line 233 of file spline.h.

◆ m_vecResultExponentValues

Eigen::VectorXi DISPLIB::Spline::m_vecResultExponentValues

Common exponent values for the entire histogram

Definition at line 178 of file spline.h.

◆ m_vecReturnVector

QVector3D DISPLIB::Spline::m_vecReturnVector
protected

Cached return value for getThreshold.

Definition at line 241 of file spline.h.


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