open_iA 2025.6
Loading...
Searching...
No Matches
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 chartClick (double x, double y, Qt::KeyboardModifiers modifiers)
 Emitted when the mouse button is clicked in the chart.
 
void chartPress (double x, double y, Qt::KeyboardModifiers modifiers)
 Emitted when the mouse is pressed in the chart (and no selection or fixed point selection happened)
 
void currentPointModified (size_t index)
 Emitted when hovered over new point.
 
void selectionModified ()
 Emitted when selected points changed.
 
void transformModified (double scale, QPointF deltaOffset)
 Emitted when user transforms (scales, translates)
 

Public Member Functions

 iAScatterPlot (iAScatterPlotViewData *spViewData, iAChartParentWidget *parent, int numTicks=5, bool isMaximizedPlot=false)
 Constructor, initializes some core members.
 
 ~iAScatterPlot ()
 
void applyMarginToRanges ()
 Apply margins to ranges so that points are not stretched border-to-border.
 
void enter ()
 Mouse entered the plot's rectangle.
 
size_t getCurrentPoint () const
 Get the index of currently hovered point.
 
const size_t * getIndices () const
 Get indices of X and Y parameters.
 
QPointF getOffset () const
 Get current offset applied to the plot points.
 
QPointF getPointPosition (size_t index) const
 Get global position of a point by its index.
 
double getPointRadius () const
 Get point radius (magnified if plot is maximized)
 
size_t getPreviousIndex () const
 Get the index of previously hovered point or iASPLOMData::NoDataIdx.
 
size_t getPreviousPoint () const
 Get the index of point hovered over before previous.
 
QRect getRect () const
 Get rectangle where scatter plot contents are displayed.
 
double getScale () const
 Get current scale applied to the plot points.
 
bool hasData () const
 Check if data is already set to the plot.
 
void leave ()
 Mouse is hovering over the plot's rectangle.
 
std::shared_ptr< iALookupTablelookupTable () const
 
double p2x (double pval) const
 Parameter scalar value to X coordinate (pixels)
 
void paintOnParent (QPainter &painter)
 Paint plot's contents on a SPLOM-parent.
 
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.
 
void resetYBounds ()
 
void setCurrentPoint (size_t index)
 Set the index of currently hovered point.
 
void setData (size_t x, size_t y, std::shared_ptr< iASPLOMData > &splomData)
 Set data to the scatter plot using indices of X and Y parameters and the raw SPLOM data.
 
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.
 
void setLookupTable (std::shared_ptr< iALookupTable > &lut, size_t colInd)
 Set color lookup table and the name of a color-coded parameter.
 
void setPointRadius (double radius)
 Set point radius (magnified if plot is maximized)
 
void setPreviewState (bool isPreviewPlot)
 Set if this plot is currently previewed (displayed in maximized plot view)
 
void setRect (QRect val)
 Set rectangle where scatter plot contents are displayed.
 
void setSelectionColor (QColor selCol)
 
void setTransform (double scale, QPointF newOffset)
 Set new transform: new scale and new offset.
 
void setTransformDelta (double scale, QPointF deltaOffset)
 Set new transform: new scale and change in the offset (delta)
 
void setYBounds (double yMin, double yMax)
 
void updatePoints ()
 
double const * yBounds () const
 
void SPLOMWheelEvent (QWheelEvent *event)
 Qt events are redirected from SPLOM to the active plot using these public event handlers.
 
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.
 
double applyTransformY (double v) const
 Apply scaling and offset to Y coordinate.
 
void calculateNiceSteps ()
 Calculates nice steps displayed parameter ranges.
 
void calculateNiceSteps (double *r, QList< double > *ticks)
 Calculates nice steps displayed parameter ranges given a range and a desired number of ticks.
 
QPoint cropLocalPos (QPoint locPos) const
 Make sure that local position is inside plot's rectangle.
 
void drawBorder (QPainter &painter)
 Draws plot's border.
 
void drawMaximizedLabels (QPainter &painter)
 Draws additional plot's labels (only maximized plot)
 
void drawPoint (QPainter &painter, double ptX, double ptY, int radius, QColor const &color)
 
void drawPoints (QPainter &painter)
 Draws plot's points (uses native OpenGL)
 
void drawSelectionPolygon (QPainter &painter)
 Draws selection-lasso polygon.
 
void drawTicks (QPainter &painter)
 Draws plot's ticks.
 
int getBinIndex (int x, int y) const
 Get global grid bin offset (index) using X and Y bin indices.
 
QPoint getLocalPos (QPoint pos) const
 Local (plot) position from global (SPLOM)
 
size_t getPointIndexAtPosition (QPointF mpos) const
 Get index of data point under cursor, iASPLOMData::NoDataIdx if none.
 
QPointF getPositionFromPointIndex (size_t idx) const
 Get position of a data point with a given index.
 
void initGrid ()
 Allocate lists for grid subdivision ( for point-picking acceleration)
 
int p2binx (double p) const
 Get grid bin index using parameter value X.
 
int p2biny (double p) const
 Get grid bin index using parameter value Y.
 
double p2tx (double pval) const
 Parameter scalar value to normalized X coordinate [0,1].
 
double p2ty (double pval) const
 Parameter scalar value to normalized Y coordinate [0,1].
 
double p2y (double pval) const
 Parameter scalar value to Y coordinate (pixels)
 
double revertTransformX (double v) const
 Revert scaling and offset to get X coordinate.
 
double revertTransformY (double v) const
 Revert scaling and offset to get Y coordinate.
 
void updateDrawRect ()
 Re-calculate dimensions of the plot's rectangle.
 
void updateGrid ()
 Fill subdivision grid with points ( for point-picking acceleration)
 
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)
 
double x2p (double x) const
 X coordinate (pixels) to parameter value.
 
double y2p (double y) const
 Y coordinate (pixels) to parameter value.
 

Protected Attributes

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

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.

◆ chartClick

void iAScatterPlot::chartClick ( double x,
double y,
Qt::KeyboardModifiers modifiers )
signal

Emitted when the mouse button is clicked in the chart.

◆ chartPress

void iAScatterPlot::chartPress ( double x,
double y,
Qt::KeyboardModifiers modifiers )
signal

Emitted when the mouse is pressed in the chart (and no selection or fixed point selection happened)

◆ 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()

std::shared_ptr< 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

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.

◆ resetYBounds()

void iAScatterPlot::resetYBounds ( )

◆ 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,
std::shared_ptr< 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 ( std::shared_ptr< 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)

◆ setYBounds()

void iAScatterPlot::setYBounds ( double yMin,
double yMax )

◆ 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.

◆ yBounds()

double const * iAScatterPlot::yBounds ( ) const

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

std::shared_ptr<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

std::shared_ptr<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: