Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
OODebug::PlotOverlay Class Reference
Inheritance diagram for OODebug::PlotOverlay:
Core::Reflect< Base >

Public Types

enum class  PlotType : int { Bars , Scatter , Array }
 

Public Member Functions

 PlotOverlay (Visualization::Item *associatedItem, const StyleType *style=itemStyles().get(), PlotType type=PlotType::Bars, QStringList variableNames={})
 
void addValue (double value)
 
void addValue (double xValue, double yValue)
 
void addValues (double xValue, QList< double > yValues)
 
void clear ()
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
 
template<typename ValueType >
void updateArrayValues (const QList< ValueType > &values, const QList< int > &indices)
 

Protected Member Functions

virtual void determineChildren () override
 
virtual void updateGeometry (int availableWidth, int availableHeight) override
 

Private Member Functions

void addValue (double value, QList< double > &valueList, double &minVal, double &maxVal)
 
void drawAxes (QPainter *painter)
 
void drawLegend (QPainter *painter)
 
int drawnTextHeight ()
 
int drawnTextWidth (const QString &text)
 
void drawTextVerticalCenteredAt (QPainter *painter, const QPointF &pos, QString label)
 
void drawTics (QPainter *painter)
 
void drawXTic (QPainter *painter, const QPointF &pos, QString label)
 
void drawYTic (QPainter *painter, const QPointF &pos, QString label)
 
void plotArray (QPainter *painter)
 
void plotBars (QPainter *painter)
 
void plotScatter (QPainter *painter)
 
void setBrushColor (QPainter *painter, QColor color)
 Changes the brush on painter to a brush with the color. More...
 
QPointF toPlotCoordinates (QPointF position)
 
double valueRange (int dimension)
 

Private Attributes

std::function< void(PlotOverlay *, QPainter *)> plotFunction_ {}
 
QRect plotRegion_
 
QStringList variableNames_
 
double xMax_ {}
 
double xMin_ {}
 
QList< double > xValues_
 
double yMax_ {}
 
double yMin_ {}
 
QList< QList< double > > yValues_
 

Static Private Attributes

static const QList< Qt::GlobalColor > PLOT_COLORS = {Qt::red, Qt::blue, Qt::green, Qt::cyan, Qt::magenta}
 

Additional Inherited Members

- Protected Types inherited from Core::Reflect< Base >
using Super = Reflect< Base >
 

Member Enumeration Documentation

◆ PlotType

enum OODebug::PlotOverlay::PlotType : int
strong
Enumerator
Bars 
Scatter 
Array 

Constructor & Destructor Documentation

◆ PlotOverlay()

OODebug::PlotOverlay::PlotOverlay ( Visualization::Item associatedItem,
const StyleType *  style = itemStyles().get(),
PlotType  type = PlotType::Bars,
QStringList  variableNames = {} 
)

Member Function Documentation

◆ addValue() [1/3]

void OODebug::PlotOverlay::addValue ( double  value)

◆ addValue() [2/3]

void OODebug::PlotOverlay::addValue ( double  value,
QList< double > &  valueList,
double &  minVal,
double &  maxVal 
)
private

◆ addValue() [3/3]

void OODebug::PlotOverlay::addValue ( double  xValue,
double  yValue 
)

◆ addValues()

void OODebug::PlotOverlay::addValues ( double  xValue,
QList< double >  yValues 
)

◆ clear()

void OODebug::PlotOverlay::clear ( )

◆ determineChildren()

void OODebug::PlotOverlay::determineChildren ( )
overrideprotectedvirtual

◆ drawAxes()

void OODebug::PlotOverlay::drawAxes ( QPainter *  painter)
private

◆ drawLegend()

void OODebug::PlotOverlay::drawLegend ( QPainter *  painter)
private

◆ drawnTextHeight()

int OODebug::PlotOverlay::drawnTextHeight ( )
private

◆ drawnTextWidth()

int OODebug::PlotOverlay::drawnTextWidth ( const QString &  text)
private

◆ drawTextVerticalCenteredAt()

void OODebug::PlotOverlay::drawTextVerticalCenteredAt ( QPainter *  painter,
const QPointF &  pos,
QString  label 
)
private

◆ drawTics()

void OODebug::PlotOverlay::drawTics ( QPainter *  painter)
private

◆ drawXTic()

void OODebug::PlotOverlay::drawXTic ( QPainter *  painter,
const QPointF &  pos,
QString  label 
)
private

◆ drawYTic()

void OODebug::PlotOverlay::drawYTic ( QPainter *  painter,
const QPointF &  pos,
QString  label 
)
private

◆ paint()

void OODebug::PlotOverlay::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = nullptr 
)
overridevirtual

◆ plotArray()

void OODebug::PlotOverlay::plotArray ( QPainter *  painter)
private

◆ plotBars()

void OODebug::PlotOverlay::plotBars ( QPainter *  painter)
private

◆ plotScatter()

void OODebug::PlotOverlay::plotScatter ( QPainter *  painter)
private

◆ setBrushColor()

void OODebug::PlotOverlay::setBrushColor ( QPainter *  painter,
QColor  color 
)
private

Changes the brush on painter to a brush with the color.

◆ toPlotCoordinates()

QPointF OODebug::PlotOverlay::toPlotCoordinates ( QPointF  position)
private

◆ updateArrayValues()

template<typename ValueType >
void OODebug::PlotOverlay::updateArrayValues ( const QList< ValueType > &  values,
const QList< int > &  indices 
)
inline

◆ updateGeometry()

void OODebug::PlotOverlay::updateGeometry ( int  availableWidth,
int  availableHeight 
)
overrideprotectedvirtual

◆ valueRange()

double OODebug::PlotOverlay::valueRange ( int  dimension)
private

Member Data Documentation

◆ PLOT_COLORS

const QList< Qt::GlobalColor > OODebug::PlotOverlay::PLOT_COLORS = {Qt::red, Qt::blue, Qt::green, Qt::cyan, Qt::magenta}
staticprivate

◆ plotFunction_

std::function<void(PlotOverlay*, QPainter*)> OODebug::PlotOverlay::plotFunction_ {}
private

◆ plotRegion_

QRect OODebug::PlotOverlay::plotRegion_
private

◆ variableNames_

QStringList OODebug::PlotOverlay::variableNames_
private

◆ xMax_

double OODebug::PlotOverlay::xMax_ {}
private

◆ xMin_

double OODebug::PlotOverlay::xMin_ {}
private

◆ xValues_

QList<double> OODebug::PlotOverlay::xValues_
private

◆ yMax_

double OODebug::PlotOverlay::yMax_ {}
private

◆ yMin_

double OODebug::PlotOverlay::yMin_ {}
private

◆ yValues_

QList<QList<double> > OODebug::PlotOverlay::yValues_
private