Isis 3 Programmer Reference
Isis::ScatterPlotData Class Reference

This is the QwtRasterData for a scatter plot. More...

#include <ScatterPlotData.h>

Inheritance diagram for Isis::ScatterPlotData:
Inheritance graph
Collaboration diagram for Isis::ScatterPlotData:
Collaboration graph

Public Member Functions

 ScatterPlotData (Cube *xCube, int xCubeBand, int xBinCount, Cube *yCube, int yCubeBand, int yBinCount, QwtInterval sampleRange, QwtInterval lineRange)
 ScatterPlotDataConstructor.
 
 ScatterPlotData (const ScatterPlotData &other)
 This is an optimized copy constructor.
 
 ~ScatterPlotData ()
 Destructor.
 
virtual QwtRasterData * copy () const
 Returns a copy of the ScatterPlotData object.
 
virtual double value (double x, double y) const
 This gets called every time the scatter plot is re-drawn.
 
double xCubeMin () const
 Return the min DN value for the x-axis cube's data range.
 
double xCubeMax () const
 Return the max DN value for the y-axis cube's data range.
 
double yCubeMin () const
 Return the min DN value for the y-axis cube's data range.
 
double yCubeMax () const
 Return the max DN value for the y-axis cube's data range.
 
void swap (ScatterPlotData &other)
 This is part of the copy-and-swap paradigm.
 
QPair< double, double > binXY (int binIndex) const
 Get the center X/Y Dn values for the bin at index.
 
int binCount (int binIndex) const
 Get the count (number of values) which fall into the bin at index.
 
int numberOfBins () const
 Get the total number of bins (bin count in x * bin count in y).
 
QVector< double > discreteXValues () const
 Get a list of all of the x-bin center values for this scatter plot.
 
void alarm (double x, double y)
 Alarm the bin (highlight it) at the given x/y DN value.
 
void clearAlarms ()
 Forget all alarmed bins (viewport->plot).
 
QRectF pixelHint (const QRectF &area) const
 This is a hint given to qwt for how to render a pixel in the spectrogram.
 
ScatterPlotDataoperator= (const ScatterPlotData &other)
 Take the data from other and copy it into this.
 

Private Member Functions

int binCount (int xIndex, int yIndex) const
 Get the count (number of values) which fall into the bin at xIndex, yIndex.
 
int binIndex (int xIndex, int yIndex) const
 Get the single-index position given an x/y index position.
 
int binIndex (double x, double y) const
 Get the single-index position given an x/y dn value.
 
QPair< int, int > binXYIndices (int binIndex) const
 Get the 2D index index position given a 1D (flat) index position.
 
QPair< int, int > binXYIndices (double x, double y) const
 Get the 2D (x/y) index position given an x/y dn value.
 

Private Attributes

QScopedPointer< Stretchm_xDnToBinStretch
 Stretch 1.
 
QScopedPointer< Stretchm_yDnToBinStretch
 Stretch 2.
 
QScopedPointer< QVector< QVector< int > > > m_counts
 The bin counts stored by 2D (x/y) index position.
 
int m_maxCount
 The maximum value in m_counts, stored for efficiency.
 
QScopedPointer< QMap< int, bool > > m_alarmedBins
 map from bin index to alarm state (true for alarmed)
 
double m_xCubeMin
 The minimum DN value for the x cube.
 
double m_xCubeMax
 The maximum DN value for the x cube.
 
double m_yCubeMin
 The minimum DN value for the y cube.
 
double m_yCubeMax
 The maximum DN value for the y cube.
 

Detailed Description

This is the QwtRasterData for a scatter plot.

This gives Qwt values to put in each bin for a spectrogram, effectively making the scatter plot.

Author
????-??-?? Unknown
History
2016-06-21 Kris Becker - Properly forward declare QPair as struct not class

Definition at line 28 of file ScatterPlotData.h.

Constructor & Destructor Documentation

◆ ScatterPlotData() [1/2]

Isis::ScatterPlotData::ScatterPlotData ( Cube * xCube,
int xCubeBand,
int xBinCount,
Cube * yCube,
int yCubeBand,
int yBinCount,
QwtInterval sampleRange,
QwtInterval lineRange )

ScatterPlotDataConstructor.

Parameters
xCubeThe x-axis cube
xCubeBandThe x-axis cube's band to get DN values from
xBinCountThe resolution of the x-axis
yCubeThe y-axis cube
yCubeBandThe y-axis cube's band to get DN values from
yBinCountThe resolution of the y-axis
sampleRangeThe sample range to gather the histogram from, this is the same for the x cube and y cube.
lineRangeThe line range to gather the histogram from, this is the same for the x cube and y cube.

Definition at line 28 of file ScatterPlotData.cpp.

References Isis::IsSpecial(), m_maxCount, m_xCubeMax, m_xCubeMin, m_xDnToBinStretch, m_yCubeMax, m_yCubeMin, m_yDnToBinStretch, and value().

Referenced by copy().

◆ ScatterPlotData() [2/2]

Isis::ScatterPlotData::ScatterPlotData ( const ScatterPlotData & other)

This is an optimized copy constructor.

Copies are not zero-time, but they are pretty quick.

Parameters
otherThe ScatterPlotData to copy.

Definition at line 111 of file ScatterPlotData.cpp.

References m_alarmedBins, m_counts, m_maxCount, m_xCubeMax, m_xCubeMin, m_xDnToBinStretch, m_yCubeMax, m_yCubeMin, and m_yDnToBinStretch.

◆ ~ScatterPlotData()

Isis::ScatterPlotData::~ScatterPlotData ( )

Destructor.

Definition at line 128 of file ScatterPlotData.cpp.

Member Function Documentation

◆ alarm()

void Isis::ScatterPlotData::alarm ( double x,
double y )

Alarm the bin (highlight it) at the given x/y DN value.

This is for viewport->plot alarming.

Parameters
xThe x-dn value of the bin to alarm
yThe y-dn value of the bin to alarm

Definition at line 322 of file ScatterPlotData.cpp.

References binIndex().

◆ binCount() [1/2]

int Isis::ScatterPlotData::binCount ( int binIndex) const

Get the count (number of values) which fall into the bin at index.

Parameters
binIndexThe bin we're getting the data from
Returns
The total number of cube DNs which fall into the given bin

Definition at line 268 of file ScatterPlotData.cpp.

References binCount(), binIndex(), and binXYIndices().

Referenced by binCount(), and value().

◆ binCount() [2/2]

int Isis::ScatterPlotData::binCount ( int xIndex,
int yIndex ) const
private

Get the count (number of values) which fall into the bin at xIndex, yIndex.

Parameters
xIndexThe x index of the bin we're getting our data from
yIndexThe y index of the bin we're getting our data from
Returns
The total number of cube DNs which fall into the given bin

Definition at line 380 of file ScatterPlotData.cpp.

References m_counts.

◆ binIndex() [1/2]

int Isis::ScatterPlotData::binIndex ( double x,
double y ) const
private

Get the single-index position given an x/y dn value.

Parameters
xThe x-dn value of the bin
yThe y-dn value of the bin
Returns
The 1D (flat) index position

Definition at line 424 of file ScatterPlotData.cpp.

References binIndex(), and binXYIndices().

◆ binIndex() [2/2]

int Isis::ScatterPlotData::binIndex ( int xIndex,
int yIndex ) const
private

Get the single-index position given an x/y index position.

That is, get a 1D (flat) index from a 2D (x/y based) index.

Parameters
xIndexThe x index of the bin we're translating into a 1D index
yIndexThe y index of the bin we're translating into a 1D index
Returns
The 1D (flat) index position

Definition at line 401 of file ScatterPlotData.cpp.

References m_counts.

Referenced by alarm(), binCount(), binIndex(), binXYIndices(), and value().

◆ binXY()

QPair< double, double > Isis::ScatterPlotData::binXY ( int index) const

Get the center X/Y Dn values for the bin at index.

Parameters
indexThe bin to get the center X/Y DN Values for
Returns
The center DN value of the given bin

Definition at line 231 of file ScatterPlotData.cpp.

References binXYIndices(), m_counts, m_xCubeMax, m_xCubeMin, m_yCubeMax, m_yCubeMin, numberOfBins(), and Isis::IException::Programmer.

Referenced by Isis::PlotWindowBestFitDialog::refreshWidgetStates().

◆ binXYIndices() [1/2]

QPair< int, int > Isis::ScatterPlotData::binXYIndices ( double x,
double y ) const
private

Get the 2D (x/y) index position given an x/y dn value.

Parameters
xThe x-dn value of the bin
yThe y-dn value of the bin
Returns
The 2D (x/y) bin index position

Definition at line 466 of file ScatterPlotData.cpp.

References Isis::IsSpecial(), m_counts, m_xDnToBinStretch, and m_yDnToBinStretch.

◆ binXYIndices() [2/2]

QPair< int, int > Isis::ScatterPlotData::binXYIndices ( int binIndex) const
private

Get the 2D index index position given a 1D (flat) index position.

Parameters
binIndexThe 1D (flat) index of the bin
Returns
The x/y 2D index position

Definition at line 436 of file ScatterPlotData.cpp.

References binIndex(), m_counts, numberOfBins(), and Isis::IException::Programmer.

Referenced by binCount(), binIndex(), binXY(), and value().

◆ clearAlarms()

void Isis::ScatterPlotData::clearAlarms ( )

Forget all alarmed bins (viewport->plot).

Definition at line 332 of file ScatterPlotData.cpp.

References m_alarmedBins.

Referenced by Isis::ScatterPlotWindow::setMousePosition().

◆ copy()

QwtRasterData * Isis::ScatterPlotData::copy ( ) const
virtual

Returns a copy of the ScatterPlotData object.

Returns
A new instance this this class

Definition at line 137 of file ScatterPlotData.cpp.

References ScatterPlotData().

◆ discreteXValues()

QVector< double > Isis::ScatterPlotData::discreteXValues ( ) const

Get a list of all of the x-bin center values for this scatter plot.

Returns
A set of discrete x values, useful for things like fitting a line

Definition at line 296 of file ScatterPlotData.cpp.

References m_counts, m_xCubeMax, and m_xCubeMin.

◆ numberOfBins()

int Isis::ScatterPlotData::numberOfBins ( ) const

Get the total number of bins (bin count in x * bin count in y).

Returns
The total number of bins

Definition at line 279 of file ScatterPlotData.cpp.

References m_counts.

Referenced by binXY(), and binXYIndices().

◆ operator=()

ScatterPlotData & Isis::ScatterPlotData::operator= ( const ScatterPlotData & other)

Take the data from other and copy it into this.

This uses the copy-and-swap paradigm for exception safety.

Parameters
otherThe scatter plot data which needs copied to this
Returns
This returns *this.

Definition at line 364 of file ScatterPlotData.cpp.

References swap().

◆ pixelHint()

QRectF Isis::ScatterPlotData::pixelHint ( const QRectF & area) const

This is a hint given to qwt for how to render a pixel in the spectrogram.

Parameters
areaThis is ignored
Returns
The size of a pixel in the scatter plot

Definition at line 343 of file ScatterPlotData.cpp.

References m_xCubeMin, m_xDnToBinStretch, m_yCubeMin, and m_yDnToBinStretch.

◆ swap()

void Isis::ScatterPlotData::swap ( ScatterPlotData & other)

This is part of the copy-and-swap paradigm.

Swap member data with other.

Parameters
otherThe class to trade member data with

Definition at line 211 of file ScatterPlotData.cpp.

References m_alarmedBins, m_counts, m_maxCount, m_xCubeMax, m_xCubeMin, m_xDnToBinStretch, m_yCubeMax, m_yCubeMin, and m_yDnToBinStretch.

Referenced by operator=().

◆ value()

double Isis::ScatterPlotData::value ( double x,
double y ) const
virtual

This gets called every time the scatter plot is re-drawn.

This returns the counts for each DN (x), DN (y), or if the bin is alarmed this returns the max count.

Parameters
xThe X-Dn value
yThe Y-Dn value
Returns
The bin's colorizable-value

Definition at line 151 of file ScatterPlotData.cpp.

References binCount(), binIndex(), binXYIndices(), m_alarmedBins, m_maxCount, and value().

Referenced by ScatterPlotData(), and value().

◆ xCubeMax()

double Isis::ScatterPlotData::xCubeMax ( ) const

Return the max DN value for the y-axis cube's data range.

Returns
x axis cube data max DN value

Definition at line 181 of file ScatterPlotData.cpp.

References m_xCubeMax.

Referenced by Isis::ScatterPlotWindow::ScatterPlotWindow().

◆ xCubeMin()

double Isis::ScatterPlotData::xCubeMin ( ) const

Return the min DN value for the x-axis cube's data range.

Returns
x axis cube data min DN value

Definition at line 171 of file ScatterPlotData.cpp.

References m_xCubeMin.

Referenced by Isis::ScatterPlotWindow::ScatterPlotWindow().

◆ yCubeMax()

double Isis::ScatterPlotData::yCubeMax ( ) const

Return the max DN value for the y-axis cube's data range.

Returns
x axis cube data max DN value

Definition at line 201 of file ScatterPlotData.cpp.

References m_yCubeMax.

Referenced by Isis::ScatterPlotWindow::ScatterPlotWindow().

◆ yCubeMin()

double Isis::ScatterPlotData::yCubeMin ( ) const

Return the min DN value for the y-axis cube's data range.

Returns
y axis cube data min DN value

Definition at line 191 of file ScatterPlotData.cpp.

References m_yCubeMin.

Referenced by Isis::ScatterPlotWindow::ScatterPlotWindow().

Member Data Documentation

◆ m_alarmedBins

QScopedPointer< QMap<int, bool> > Isis::ScatterPlotData::m_alarmedBins
private

map from bin index to alarm state (true for alarmed)

Definition at line 81 of file ScatterPlotData.h.

Referenced by clearAlarms(), ScatterPlotData(), swap(), and value().

◆ m_counts

QScopedPointer< QVector< QVector<int> > > Isis::ScatterPlotData::m_counts
private

The bin counts stored by 2D (x/y) index position.

The first dimension is the y-index.

Definition at line 73 of file ScatterPlotData.h.

Referenced by binCount(), binIndex(), binXY(), binXYIndices(), binXYIndices(), discreteXValues(), numberOfBins(), ScatterPlotData(), and swap().

◆ m_maxCount

int Isis::ScatterPlotData::m_maxCount
private

The maximum value in m_counts, stored for efficiency.

Definition at line 76 of file ScatterPlotData.h.

Referenced by ScatterPlotData(), ScatterPlotData(), swap(), and value().

◆ m_xCubeMax

double Isis::ScatterPlotData::m_xCubeMax
private

The maximum DN value for the x cube.

Definition at line 86 of file ScatterPlotData.h.

Referenced by binXY(), discreteXValues(), ScatterPlotData(), ScatterPlotData(), swap(), and xCubeMax().

◆ m_xCubeMin

double Isis::ScatterPlotData::m_xCubeMin
private

The minimum DN value for the x cube.

Definition at line 84 of file ScatterPlotData.h.

Referenced by binXY(), discreteXValues(), pixelHint(), ScatterPlotData(), ScatterPlotData(), swap(), and xCubeMin().

◆ m_xDnToBinStretch

QScopedPointer<Stretch> Isis::ScatterPlotData::m_xDnToBinStretch
private

Stretch 1.

Definition at line 66 of file ScatterPlotData.h.

Referenced by binXYIndices(), pixelHint(), ScatterPlotData(), ScatterPlotData(), and swap().

◆ m_yCubeMax

double Isis::ScatterPlotData::m_yCubeMax
private

The maximum DN value for the y cube.

Definition at line 90 of file ScatterPlotData.h.

Referenced by binXY(), ScatterPlotData(), ScatterPlotData(), swap(), and yCubeMax().

◆ m_yCubeMin

double Isis::ScatterPlotData::m_yCubeMin
private

The minimum DN value for the y cube.

Definition at line 88 of file ScatterPlotData.h.

Referenced by binXY(), pixelHint(), ScatterPlotData(), ScatterPlotData(), swap(), and yCubeMin().

◆ m_yDnToBinStretch

QScopedPointer<Stretch> Isis::ScatterPlotData::m_yDnToBinStretch
private

Stretch 2.

Definition at line 67 of file ScatterPlotData.h.

Referenced by binXYIndices(), pixelHint(), ScatterPlotData(), ScatterPlotData(), and swap().


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