open_iA 2021.08
A tool for the visual analysis and processing of volumetric datasets, with a focus on industrial computed tomography.
Classes | Public Types | Signals | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
iAScatterPlot Class Reference

Represents a single scatter plot in the scatter plot matrix (SPLOM). More...

#include <iAScatterPlot.h>

Inheritance diagram for iAScatterPlot:
[legend]
Collaboration diagram for iAScatterPlot:
[legend]

Classes

struct  Settings
 All settings of the plot in one struct. More...
 

Public Types

enum  HighlightDrawMode { Enlarged = 1 , CategoricalColor = 2 , Outline = 4 }
 
enum  SelectionMode { Rectangle , Polygon }
 

Signals

void currentPointModified (size_t index)
 Emitted when hovered over new point. More...
 
void selectionModified ()
 Emitted when selected points changed. More...
 
void transformModified (double scale, QPointF deltaOffset)
 Emitted when user transforms (scales, translates) More...
 

Public Member Functions

 iAScatterPlot (iAScatterPlotViewData *spViewData, iAChartParentWidget *parent, int numTicks=5, bool isMaximizedPlot=false)
 Constructor, initializes some core members. More...
 
 ~iAScatterPlot ()
 
void applyMarginToRanges ()
 Apply margins to ranges so that points are not stretched border-to-border. More...
 
void enter ()
 Mouse entered the plot's rectangle. More...
 
size_t getCurrentPoint () const
 Get the index of currently hovered point. More...
 
const size_t * getIndices () const
 Get indices of X and Y parameters. More...
 
QPointF getOffset () const
 Get current offset applied to the plot points. More...
 
QPointF getPointPosition (size_t index) const
 Get global position of a point by its index. More...
 
double getPointRadius () const
 Get point radius (magnified if plot is maximized) More...
 
size_t getPreviousIndex () const
 Get the index of previously hovered point or iASPLOMData::NoDataIdx. More...
 
size_t getPreviousPoint () const
 Get the index of point hovered over before previous. More...
 
QRect getRect () const
 Get rectangle where scatter plot contents are displayed. More...
 
double getScale () const
 Get current scale applied to the plot points. More...
 
bool hasData () const
 Check if data is already set to the plot. More...
 
void leave ()
 Mouse is hovering over the plot's rectangle. More...
 
QSharedPointer< iALookupTablelookupTable () const
 
void paintOnParent (QPainter &painter)
 Paint plot's contents on a SPLOM-parent. More...
 
void printTicksInfo (QList< double > *posX, QList< double > *posY, QList< QString > *textX, QList< QString > *textY) const
 Output positions and labels of plot ticks for X and Y axes. More...
 
void setCurrentPoint (size_t index)
 Set the index of currently hovered point. More...
 
void setData (size_t x, size_t y, QSharedPointer< iASPLOMData > &splomData)
 Set data to the scatter plot using indices of X and Y parameters and the raw SPLOM data. More...
 
void setHighlightColor (QColor hltCol)
 
void setHighlightColorTheme (iAColorTheme const *theme)
 
void setHighlightDrawMode (HighlightDrawModes drawMode)
 
void setIndices (size_t x, size_t y)
 Set the indices of the parameters to view. More...
 
void setLookupTable (QSharedPointer< iALookupTable > &lut, size_t colInd)
 Set color lookup table and the name of a color-coded parameter. More...
 
void setPointRadius (double radius)
 Set point radius (magnified if plot is maximized) More...
 
void setPreviewState (bool isPreviewPlot)
 Set if this plot is currently previewed (displayed in maximized plot view) More...
 
void setRect (QRect val)
 Set rectangle where scatter plot contents are displayed. More...
 
void setSelectionColor (QColor selCol)
 
void setTransform (double scale, QPointF newOffset)
 Set new transform: new scale and new offset. More...
 
void setTransformDelta (double scale, QPointF deltaOffset)
 Set new transform: new scale and change in the offset (delta) More...
 
void updatePoints ()
 
void SPLOMWheelEvent (QWheelEvent *event)
 Qt events are redirected from SPLOM to the active plot using these public event handlers. More...
 
void SPLOMMouseMoveEvent (QMouseEvent *event)
 
void SPLOMMousePressEvent (QMouseEvent *event)
 
void SPLOMMouseReleaseEvent (QMouseEvent *event)
 

Public Attributes

Settings settings
 

Protected Member Functions

double applyTransformX (double v) const
 Apply scaling and offset to X coordinate. More...
 
double applyTransformY (double v) const
 Apply scaling and offset to Y coordinate. More...
 
void calculateNiceSteps ()
 Calculates nice steps displayed parameter ranges. More...
 
void calculateNiceSteps (double *r, QList< double > *ticks)
 Calculates nice steps displayed parameter ranges given a range and a desired number of ticks. More...
 
QPoint cropLocalPos (QPoint locPos) const
 Make sure that local position is inside plot's rectangle. More...
 
void drawBorder (QPainter &painter)
 Draws plot's border. More...
 
void drawMaximizedLabels (QPainter &painter)
 Draws additional plot's labels (only maximized plot) More...
 
void drawPoint (QPainter &painter, double ptX, double ptY, int radius, QColor const &color)
 
void drawPoints (QPainter &painter)
 Draws plot's points (uses native OpenGL) More...
 
void drawSelectionPolygon (QPainter &painter)
 Draws selection-lasso polygon. More...
 
void drawTicks (QPainter &painter)
 Draws plot's ticks. More...
 
int getBinIndex (int x, int y) const
 Get global grid bin offset (index) using X and Y bin indices. More...
 
QPoint getLocalPos (QPoint pos) const
 Local (plot) position from global (SPLOM) More...
 
size_t getPointIndexAtPosition (QPointF mpos) const
 Get index of data point under cursor, iASPLOMData::NoDataIdx if none. More...
 
QPointF getPositionFromPointIndex (size_t idx) const
 Get position of a data point with a given index. More...
 
void initGrid ()
 Allocate lists for grid subdivision ( for point-picking acceleration) More...
 
int p2binx (double p) const
 Get grid bin index using parameter value X. More...
 
int p2biny (double p) const
 Get grid bin index using parameter value Y. More...
 
double p2tx (double pval) const
 Parameter scalar value to normalized X coordinate [0,1]. More...
 
double p2ty (double pval) const
 Parameter scalar value to normalized Y coordinate [0,1]. More...
 
double p2x (double pval) const
 Parameter scalar value to X coordinate (pixels) More...
 
double p2y (double pval) const
 Parameter scalar value to Y coordinate (pixels) More...
 
double revertTransformX (double v) const
 Revert scaling and offset to get X coordinate. More...
 
double revertTransformY (double v) const
 Revert scaling and offset to get Y coordinate. More...
 
void updateDrawRect ()
 Re-calculate dimensions of the plot's rectangle. More...
 
void updateGrid ()
 Fill subdivision grid with points ( for point-picking acceleration) More...
 
void updateSelectedPoints (bool append, bool remove)
 Update selected points; parameters specify whether to append or to remove from previous selection (or create new if both false). if both append and remove are true, then XOR logic is applied (of newly selected, those already selected will be de-selected, new ones will be added) More...
 
double x2p (double x) const
 X coordinate (pixels) to parameter value. More...
 
double y2p (double y) const
 Y coordinate (pixels) to parameter value. More...
 

Protected Attributes

size_t m_colInd
 index of color-coded parameter More...
 
size_t m_curInd
 index of currently selected point (iASPLOMData::NoDataIdx if none) More...
 
size_t m_curVisiblePts
 number of currently visible points More...
 
bool m_dragging
 indicates whether a drag operation is currently going on More...
 
QRect m_globRect
 plot's rectangle More...
 
int m_gridDims [2]
 dimensions of subdivision grid (point picking acceleration) More...
 
bool m_isMaximizedPlot
 flag telling if this plot itself is maximized (bigger plot) More...
 
bool m_isPlotActive
 flag indicating if the plot is active (user hovers mouse over) More...
 
bool m_isPreviewPlot
 flag telling if a large version of this plot is shown maximized currently More...
 
QRectF m_locRect
 plot's local drawing rectangle More...
 
QSharedPointer< iALookupTablem_lut
 pointer to SPLOM-parent's lookup table More...
 
QRectF m_maxBtnRect
 rectangle of maximized button More...
 
int m_numTicks
 number of ticks More...
 
QPointF m_offset
 transform offset component More...
 
size_t m_paramIndices [2]
 indices of plot X, Y parameters More...
 
iAChartParentWidgetm_parentWidget
 the parent widget More...
 
QList< QList< size_t > > m_pointsGrid
 grid bins containing point indices More...
 
size_t m_prevInd
 index of previously selected point (iASPLOMData::NoDataIdx if none) More...
 
QPointF m_prevPos
 used for computing offset component More...
 
size_t m_prevPtInd
 index of point selected before (iASPLOMData::NoDataIdx if none, but keeps point index even if no point was selected in between) More...
 
double m_prX [2]
 
double m_prY [2]
 range of x and y parameter More...
 
double m_scale
 transform scale component More...
 
QPolygon m_selPoly
 polygon of selection lasso More...
 
QPoint m_selStart
 point where the selection started More...
 
QSharedPointer< iASPLOMDatam_splomData
 pointer to SPLOM-parent's data More...
 
QList< double > m_ticksX
 position of ticks X axis More...
 
QList< double > m_ticksY
 position of ticks Y axis More...
 
iAScatterPlotViewDatam_viewData
 selection/highlight/settings handler (if part of a SPLOM, the SPLOM-parent) More...
 

Detailed Description

Represents a single scatter plot in the scatter plot matrix (SPLOM).

The class is managed from the parent SPLOM. Draws its contents in a given rectangle on a parent SPLOM widget. Appearance can be customized via the public settings member.

Member Enumeration Documentation

◆ HighlightDrawMode

Enumerator
Enlarged 

whether to enlarge highlighted point

CategoricalColor 

if set, use categorical color to draw highlighted point

Outline 

if set, use categorical color for an outline around the actual point; using Enlarged, CategoricalColor AND Outline is redundant, only Enlarged and CategoricalColor will have the same effect

◆ SelectionMode

Enumerator
Rectangle 
Polygon 

Constructor & Destructor Documentation

◆ iAScatterPlot()

iAScatterPlot::iAScatterPlot ( iAScatterPlotViewData spViewData,
iAChartParentWidget parent,
int  numTicks = 5,
bool  isMaximizedPlot = false 
)

Constructor, initializes some core members.

Parameters
spViewDatadata on the current viewing configuration
parentthe parent widget
numTicksthe number of ticks in x and y direction
isMaximizedPlotwhether this is a maximized plot

◆ ~iAScatterPlot()

iAScatterPlot::~iAScatterPlot ( )

Member Function Documentation

◆ applyMarginToRanges()

void iAScatterPlot::applyMarginToRanges ( )

Apply margins to ranges so that points are not stretched border-to-border.

◆ applyTransformX()

double iAScatterPlot::applyTransformX ( double  v) const
protected

Apply scaling and offset to X coordinate.

◆ applyTransformY()

double iAScatterPlot::applyTransformY ( double  v) const
protected

Apply scaling and offset to Y coordinate.

◆ calculateNiceSteps() [1/2]

void iAScatterPlot::calculateNiceSteps ( )
protected

Calculates nice steps displayed parameter ranges.

◆ calculateNiceSteps() [2/2]

void iAScatterPlot::calculateNiceSteps ( double *  r,
QList< double > *  ticks 
)
protected

Calculates nice steps displayed parameter ranges given a range and a desired number of ticks.

◆ cropLocalPos()

QPoint iAScatterPlot::cropLocalPos ( QPoint  locPos) const
protected

Make sure that local position is inside plot's rectangle.

◆ currentPointModified

void iAScatterPlot::currentPointModified ( size_t  index)
signal

Emitted when hovered over new point.

◆ drawBorder()

void iAScatterPlot::drawBorder ( QPainter &  painter)
protected

Draws plot's border.

◆ drawMaximizedLabels()

void iAScatterPlot::drawMaximizedLabels ( QPainter &  painter)
protected

Draws additional plot's labels (only maximized plot)

◆ drawPoint()

void iAScatterPlot::drawPoint ( QPainter &  painter,
double  ptX,
double  ptY,
int  radius,
QColor const &  color 
)
protected

◆ drawPoints()

void iAScatterPlot::drawPoints ( QPainter &  painter)
protected

Draws plot's points (uses native OpenGL)

◆ drawSelectionPolygon()

void iAScatterPlot::drawSelectionPolygon ( QPainter &  painter)
protected

Draws selection-lasso polygon.

◆ drawTicks()

void iAScatterPlot::drawTicks ( QPainter &  painter)
protected

Draws plot's ticks.

◆ enter()

void iAScatterPlot::enter ( )

Mouse entered the plot's rectangle.

◆ getBinIndex()

int iAScatterPlot::getBinIndex ( int  x,
int  y 
) const
protected

Get global grid bin offset (index) using X and Y bin indices.

◆ getCurrentPoint()

size_t iAScatterPlot::getCurrentPoint ( ) const

Get the index of currently hovered point.

◆ getIndices()

const size_t * iAScatterPlot::getIndices ( ) const
inline

Get indices of X and Y parameters.

◆ getLocalPos()

QPoint iAScatterPlot::getLocalPos ( QPoint  pos) const
protected

Local (plot) position from global (SPLOM)

◆ getOffset()

QPointF iAScatterPlot::getOffset ( ) const
inline

Get current offset applied to the plot points.

◆ getPointIndexAtPosition()

size_t iAScatterPlot::getPointIndexAtPosition ( QPointF  mpos) const
protected

Get index of data point under cursor, iASPLOMData::NoDataIdx if none.

◆ getPointPosition()

QPointF iAScatterPlot::getPointPosition ( size_t  index) const

Get global position of a point by its index.

◆ getPointRadius()

double iAScatterPlot::getPointRadius ( ) const

Get point radius (magnified if plot is maximized)

◆ getPositionFromPointIndex()

QPointF iAScatterPlot::getPositionFromPointIndex ( size_t  idx) const
protected

Get position of a data point with a given index.

◆ getPreviousIndex()

size_t iAScatterPlot::getPreviousIndex ( ) const

Get the index of previously hovered point or iASPLOMData::NoDataIdx.

◆ getPreviousPoint()

size_t iAScatterPlot::getPreviousPoint ( ) const

Get the index of point hovered over before previous.

◆ getRect()

QRect iAScatterPlot::getRect ( ) const
inline

Get rectangle where scatter plot contents are displayed.

◆ getScale()

double iAScatterPlot::getScale ( ) const
inline

Get current scale applied to the plot points.

◆ hasData()

bool iAScatterPlot::hasData ( ) const

Check if data is already set to the plot.

◆ initGrid()

void iAScatterPlot::initGrid ( )
protected

Allocate lists for grid subdivision ( for point-picking acceleration)

◆ leave()

void iAScatterPlot::leave ( )

Mouse is hovering over the plot's rectangle.

◆ lookupTable()

QSharedPointer< iALookupTable > iAScatterPlot::lookupTable ( ) const

◆ p2binx()

int iAScatterPlot::p2binx ( double  p) const
protected

Get grid bin index using parameter value X.

◆ p2biny()

int iAScatterPlot::p2biny ( double  p) const
protected

Get grid bin index using parameter value Y.

◆ p2tx()

double iAScatterPlot::p2tx ( double  pval) const
protected

Parameter scalar value to normalized X coordinate [0,1].

◆ p2ty()

double iAScatterPlot::p2ty ( double  pval) const
protected

Parameter scalar value to normalized Y coordinate [0,1].

◆ p2x()

double iAScatterPlot::p2x ( double  pval) const
protected

Parameter scalar value to X coordinate (pixels)

◆ p2y()

double iAScatterPlot::p2y ( double  pval) const
protected

Parameter scalar value to Y coordinate (pixels)

◆ paintOnParent()

void iAScatterPlot::paintOnParent ( QPainter &  painter)

Paint plot's contents on a SPLOM-parent.

◆ printTicksInfo()

void iAScatterPlot::printTicksInfo ( QList< double > *  posX,
QList< double > *  posY,
QList< QString > *  textX,
QList< QString > *  textY 
) const

Output positions and labels of plot ticks for X and Y axes.

◆ revertTransformX()

double iAScatterPlot::revertTransformX ( double  v) const
protected

Revert scaling and offset to get X coordinate.

◆ revertTransformY()

double iAScatterPlot::revertTransformY ( double  v) const
protected

Revert scaling and offset to get Y coordinate.

◆ selectionModified

void iAScatterPlot::selectionModified ( )
signal

Emitted when selected points changed.

◆ setCurrentPoint()

void iAScatterPlot::setCurrentPoint ( size_t  index)

Set the index of currently hovered point.

◆ setData()

void iAScatterPlot::setData ( size_t  x,
size_t  y,
QSharedPointer< iASPLOMData > &  splomData 
)

Set data to the scatter plot using indices of X and Y parameters and the raw SPLOM data.

◆ setHighlightColor()

void iAScatterPlot::setHighlightColor ( QColor  hltCol)

◆ setHighlightColorTheme()

void iAScatterPlot::setHighlightColorTheme ( iAColorTheme const *  theme)

◆ setHighlightDrawMode()

void iAScatterPlot::setHighlightDrawMode ( HighlightDrawModes  drawMode)

◆ setIndices()

void iAScatterPlot::setIndices ( size_t  x,
size_t  y 
)

Set the indices of the parameters to view.

◆ setLookupTable()

void iAScatterPlot::setLookupTable ( QSharedPointer< iALookupTable > &  lut,
size_t  colInd 
)

Set color lookup table and the name of a color-coded parameter.

◆ setPointRadius()

void iAScatterPlot::setPointRadius ( double  radius)

Set point radius (magnified if plot is maximized)

◆ setPreviewState()

void iAScatterPlot::setPreviewState ( bool  isPreviewPlot)

Set if this plot is currently previewed (displayed in maximized plot view)

◆ setRect()

void iAScatterPlot::setRect ( QRect  val)

Set rectangle where scatter plot contents are displayed.

◆ setSelectionColor()

void iAScatterPlot::setSelectionColor ( QColor  selCol)

◆ setTransform()

void iAScatterPlot::setTransform ( double  scale,
QPointF  newOffset 
)

Set new transform: new scale and new offset.

◆ setTransformDelta()

void iAScatterPlot::setTransformDelta ( double  scale,
QPointF  deltaOffset 
)

Set new transform: new scale and change in the offset (delta)

◆ SPLOMMouseMoveEvent()

void iAScatterPlot::SPLOMMouseMoveEvent ( QMouseEvent *  event)

◆ SPLOMMousePressEvent()

void iAScatterPlot::SPLOMMousePressEvent ( QMouseEvent *  event)

◆ SPLOMMouseReleaseEvent()

void iAScatterPlot::SPLOMMouseReleaseEvent ( QMouseEvent *  event)

◆ SPLOMWheelEvent()

void iAScatterPlot::SPLOMWheelEvent ( QWheelEvent *  event)

Qt events are redirected from SPLOM to the active plot using these public event handlers.

◆ transformModified

void iAScatterPlot::transformModified ( double  scale,
QPointF  deltaOffset 
)
signal

Emitted when user transforms (scales, translates)

◆ updateDrawRect()

void iAScatterPlot::updateDrawRect ( )
protected

Re-calculate dimensions of the plot's rectangle.

◆ updateGrid()

void iAScatterPlot::updateGrid ( )
protected

Fill subdivision grid with points ( for point-picking acceleration)

◆ updatePoints()

void iAScatterPlot::updatePoints ( )

◆ updateSelectedPoints()

void iAScatterPlot::updateSelectedPoints ( bool  append,
bool  remove 
)
protected

Update selected points; parameters specify whether to append or to remove from previous selection (or create new if both false). if both append and remove are true, then XOR logic is applied (of newly selected, those already selected will be de-selected, new ones will be added)

◆ x2p()

double iAScatterPlot::x2p ( double  x) const
protected

X coordinate (pixels) to parameter value.

◆ y2p()

double iAScatterPlot::y2p ( double  y) const
protected

Y coordinate (pixels) to parameter value.

Member Data Documentation

◆ m_colInd

size_t iAScatterPlot::m_colInd
protected

index of color-coded parameter

◆ m_curInd

size_t iAScatterPlot::m_curInd
protected

index of currently selected point (iASPLOMData::NoDataIdx if none)

◆ m_curVisiblePts

size_t iAScatterPlot::m_curVisiblePts
protected

number of currently visible points

◆ m_dragging

bool iAScatterPlot::m_dragging
protected

indicates whether a drag operation is currently going on

◆ m_globRect

QRect iAScatterPlot::m_globRect
protected

plot's rectangle

◆ m_gridDims

int iAScatterPlot::m_gridDims[2]
protected

dimensions of subdivision grid (point picking acceleration)

◆ m_isMaximizedPlot

bool iAScatterPlot::m_isMaximizedPlot
protected

flag telling if this plot itself is maximized (bigger plot)

◆ m_isPlotActive

bool iAScatterPlot::m_isPlotActive
protected

flag indicating if the plot is active (user hovers mouse over)

◆ m_isPreviewPlot

bool iAScatterPlot::m_isPreviewPlot
protected

flag telling if a large version of this plot is shown maximized currently

◆ m_locRect

QRectF iAScatterPlot::m_locRect
protected

plot's local drawing rectangle

◆ m_lut

QSharedPointer<iALookupTable> iAScatterPlot::m_lut
protected

pointer to SPLOM-parent's lookup table

◆ m_maxBtnRect

QRectF iAScatterPlot::m_maxBtnRect
protected

rectangle of maximized button

◆ m_numTicks

int iAScatterPlot::m_numTicks
protected

number of ticks

◆ m_offset

QPointF iAScatterPlot::m_offset
protected

transform offset component

◆ m_paramIndices

size_t iAScatterPlot::m_paramIndices[2]
protected

indices of plot X, Y parameters

◆ m_parentWidget

iAChartParentWidget* iAScatterPlot::m_parentWidget
protected

the parent widget

◆ m_pointsGrid

QList<QList<size_t> > iAScatterPlot::m_pointsGrid
protected

grid bins containing point indices

◆ m_prevInd

size_t iAScatterPlot::m_prevInd
protected

index of previously selected point (iASPLOMData::NoDataIdx if none)

◆ m_prevPos

QPointF iAScatterPlot::m_prevPos
protected

used for computing offset component

◆ m_prevPtInd

size_t iAScatterPlot::m_prevPtInd
protected

index of point selected before (iASPLOMData::NoDataIdx if none, but keeps point index even if no point was selected in between)

◆ m_prX

double iAScatterPlot::m_prX[2]
protected

◆ m_prY

double iAScatterPlot::m_prY[2]
protected

range of x and y parameter

◆ m_scale

double iAScatterPlot::m_scale
protected

transform scale component

◆ m_selPoly

QPolygon iAScatterPlot::m_selPoly
protected

polygon of selection lasso

◆ m_selStart

QPoint iAScatterPlot::m_selStart
protected

point where the selection started

◆ m_splomData

QSharedPointer<iASPLOMData> iAScatterPlot::m_splomData
protected

pointer to SPLOM-parent's data

◆ m_ticksX

QList<double> iAScatterPlot::m_ticksX
protected

position of ticks X axis

◆ m_ticksY

QList<double> iAScatterPlot::m_ticksY
protected

position of ticks Y axis

◆ m_viewData

iAScatterPlotViewData* iAScatterPlot::m_viewData
protected

selection/highlight/settings handler (if part of a SPLOM, the SPLOM-parent)

◆ settings

Settings iAScatterPlot::settings

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