Spectrogram Class Reference

`#include <Spectrogram.h>`

Inheritance diagram for Spectrogram:

## Public Types

enum | ColorMapPolicy { GrayScale, Default, Custom }

## Public Member Functions

virtual QwtDoubleRect | boundingRect () const
void | clearLabels ()
int | colorBarWidth ()
LinearColorMap | colorMap ()
LinearColorMap * | colorMapPointer ()
ColorMapPolicy | colorMapPolicy ()
int | colorScaleAxis ()
virtual QPen | contourPen (double level) const
QList< QPen > | contourPenList ()
Spectrogram * | copy (Graph *g)
Graph * | graph ()
bool | hasColorScale ()
bool | hasLabels ()
bool | hasSelectedLabels ()
QColor | labelsColor ()
QFont | labelsFont ()
QList< PlotMarker * > | labelsList ()
double | labelsRotation ()
bool | labelsWhiteOut ()
double | labelsXOffset ()
double | labelsYOffset ()
int | levels ()
Matrix * | matrix ()
void | moveLabel (const QPoint &pos)
QwtDoubleInterval | range () const
QString | saveToString ()
| Used when saving a project file. More...
bool | selectedLabels (const QPoint &pos)
void | selectLabel (bool on)
void | setColorBarWidth (int width)
void | setColorMapPen (bool on=true)
void | setColorScaleAxis (int axis)
void | setContourLevels (const QwtValueList &levels)
void | setContourLinePen (int index, const QPen &pen)
void | setContourPenList (QList< QPen > lst)
void | setCustomColorMap (const LinearColorMap &map)
void | setDefaultColorMap ()
void | setGrayScale ()
void | setLabelOffset (int index, double x, double y)
void | setLabelsColor (const QColor &c)
void | setLabelsFont (const QFont &font)
void | setLabelsOffset (double x, double y)
void | setLabelsRotation (double angle)
void | setLabelsWhiteOut (bool whiteOut)
void | setLevelsNumber (int levels)
bool | setMatrix (Matrix *m, bool useFormula=false)
bool | setUseMatrixFormula (bool on=true)
virtual void | setVisible (bool on)
void | showColorScale (int axis, bool on=true)
void | showContourLineLabels (bool show=true)
| Spectrogram (Graph *graph, Matrix *m)
void | updateData ()
bool | useColorMapPen ()
bool | useMatrixFormula ()

## Protected Member Functions

void | createLabels ()
virtual void | drawContourLines (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtRasterData::ContourLines &lines) const
virtual QImage | renderImage (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtDoubleRect &rect) const
void | updateLabels (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtRasterData::ContourLines &lines) const

## Protected Attributes

int | color_axis
| Axis used to display the color scale. More...
LinearColorMap | color_map
ColorMapPolicy | color_map_policy
| Flags. More...
double | d_click_pos_x
| Keep track of the coordinates of the point where the user clicked when selecting the labels. More...
double | d_click_pos_y
bool | d_color_map_pen
| Flag telling if we use the color map to calculate the pen (QwtPlotSpectrogram::contourPen()). More...
Graph * | d_graph
| Pointer to the parent plot. More...
double | d_labels_angle
QColor | d_labels_color
| Labels color. More...
QFont | d_labels_font
| Labels font. More...
QList< PlotMarker * > | d_labels_list
| List of the text labels associated to this spectrogram. More...
double | d_labels_x_offset
double | d_labels_y_offset
Matrix * | d_matrix
| Pointer to the source data matrix. More...
QList< QPen > | d_pen_list
PlotMarker * | d_selected_label
| Keeps track of the plot marker on which the user clicked when selecting the labels. More...
bool | d_show_labels
| Flag telling if we display the labels. More...
bool | d_use_matrix_formula
| Flag telling that we evaluate the matrix expression instead of using the matrix data. More...
bool | d_white_out_labels
| Flag telling if we paint a white background for the labels. More...

## Member Enumeration Documentation

enum Spectrogram::ColorMapPolicy

Enumerator
GrayScale |
Default |
Custom |

## Constructor & Destructor Documentation

Spectrogram::Spectrogram | ( | Graph * | graph,
|  | Matrix * | m
| ) |  |

References range(), and setContourLevels().

Referenced by copy().

## Member Function Documentation

QwtDoubleRect Spectrogram::boundingRect | ( |  | ) | const

virtual

References Matrix::boundingRect(), and d_matrix.

Referenced by Graph::closestCurve().

void Spectrogram::clearLabels | ( |  | ) |

References d_labels_list.

Referenced by copy(), createLabels(), Graph::plotSpectrogram(), and Graph::restoreSpectrogram().

int Spectrogram::colorBarWidth | ( |  | ) |

References color_axis, and d_graph.

Referenced by PlotDialog::setActiveCurve().

LinearColorMap Spectrogram::colorMap | ( |  | ) |

inline

References color_map.

Referenced by PlotDialog::acceptParams(), Graph::plotSpectrogram(), PlotDialog::setActiveCurve(), setCustomColorMap(), setDefaultColorMap(), setGrayScale(), showColorScale(), and updateData().

LinearColorMap* Spectrogram::colorMapPointer | ( |  | ) |

inline

References color_map.

ColorMapPolicy Spectrogram::colorMapPolicy | ( |  | ) |

inline

References color_map_policy.

Referenced by PlotDialog::setActiveCurve().

int Spectrogram::colorScaleAxis | ( |  | ) |

inline

References color_axis.

Referenced by Graph::enablePanningMagnifier(), PlotDialog::setActiveCurve(), and Graph::updateSecondaryAxis().

QPen Spectrogram::contourPen | ( | double | level | ) | const

virtual

References d_color_map_pen, d_pen_list, and levels().

Referenced by drawContourLines(), ContourLinesEditor::insertLevel(), setContourLinePen(), and ContourLinesEditor::updateContents().

QList<QPen> Spectrogram::contourPenList | ( |  | ) |

inline

References d_pen_list.

Spectrogram * Spectrogram::copy | ( | Graph * | g | ) |

References clearLabels(), color_map, color_map_policy, d_color_map_pen, d_labels_angle, d_labels_color, d_labels_font, d_labels_list, d_labels_x_offset, d_labels_y_offset, d_pen_list, d_show_labels, d_white_out_labels, labelsList(), matrix(), setContourLevels(), setContourPenList(), setCustomColorMap(), PlotMarker::setLabelOffset(), Spectrogram(), PlotMarker::xLabelOffset(), and PlotMarker::yLabelOffset().

Referenced by Graph::copyCurves().

void Spectrogram::createLabels | ( |  | ) |

protected

References clearLabels(), d_graph, d_labels_angle, d_labels_color, d_labels_font, d_labels_list, d_show_labels, d_white_out_labels, and levels().

Referenced by setContourLevels().

void Spectrogram::drawContourLines | ( | QPainter * | p,
|  | const QwtScaleMap & | xMap,
|  | const QwtScaleMap & | yMap,
|  | const QwtRasterData::ContourLines & | lines
| ) |  | const

protected virtual

References contourPen(), d_show_labels, levels(), and updateLabels().

Graph* Spectrogram::graph | ( |  | ) |

inline

References d_graph.

bool Spectrogram::hasColorScale | ( |  | ) |

References color_axis, and d_graph.

Referenced by PlotDialog::setActiveCurve(), and showColorScale().

bool Spectrogram::hasLabels | ( |  | ) |

inline

References d_show_labels.

Referenced by PlotDialog::setActiveCurve().

bool Spectrogram::hasSelectedLabels | ( |  | ) |

References d_selected_label.

Referenced by PlotDialog::setActiveCurve().

QColor Spectrogram::labelsColor | ( |  | ) |

inline

References d_labels_color.

Referenced by PlotDialog::setActiveCurve().

QFont Spectrogram::labelsFont | ( |  | ) |

inline

References d_labels_font.

QList<PlotMarker *> Spectrogram::labelsList | ( |  | ) |

inline

References d_labels_list.

Referenced by copy().

double Spectrogram::labelsRotation | ( |  | ) |

inline

References d_labels_angle.

Referenced by PlotDialog::setActiveCurve().

bool Spectrogram::labelsWhiteOut | ( |  | ) |

inline

References d_white_out_labels.

Referenced by PlotDialog::setActiveCurve().

double Spectrogram::labelsXOffset | ( |  | ) |

inline

References d_labels_x_offset.

Referenced by PlotDialog::setActiveCurve().

double Spectrogram::labelsYOffset | ( |  | ) |

inline

References d_labels_y_offset.

Referenced by PlotDialog::setActiveCurve().

int Spectrogram::levels | ( |  | ) |

inline

Referenced by contourPen(), createLabels(), drawContourLines(), saveToString(), setContourLinePen(), and updateLabels().

Matrix* Spectrogram::matrix | ( |  | ) |

inline

References d_matrix.

Referenced by copy(), PlotDialog::setActiveCurve(), ApplicationWindow::showCurveWorksheet(), ApplicationWindow::showMatrixValuesDialog(), MultiLayer::sizeToString(), Graph::spectrogram(), and ApplicationWindow::updateMatrixPlots().

void Spectrogram::moveLabel | ( | const QPoint & | pos | ) |

References d_click_pos_x, d_click_pos_y, d_graph, d_labels_list, d_selected_label, Graph::notifyChanges(), PlotMarker::setLabelOffset(), PlotMarker::xLabelOffset(), and PlotMarker::yLabelOffset().

QwtDoubleInterval Spectrogram::range | ( |  | ) | const

References color_map, d_matrix, LinearColorMap::intensityRange(), and Matrix::range().

Referenced by ContourLinesEditor::insertLevel(), Graph::plotSpectrogram(), renderImage(), PlotDialog::setActiveCurve(), setCustomColorMap(), setDefaultColorMap(), setGrayScale(), setLevelsNumber(), showColorScale(), Spectrogram(), ContourLinesEditor::updateContents(), and updateData().

QImage Spectrogram::renderImage | ( | const QwtScaleMap & | xMap,
|  | const QwtScaleMap & | yMap,
|  | const QwtDoubleRect & | rect
| ) |  | const

protected virtual

References color_map, MatrixData::copy(), range(), MatrixData::rasterHint(), and MatrixData::value().

QString Spectrogram::saveToString | ( |  | ) |

Used when saving a project file.

References color_axis, color_map, color_map_policy, Custom, d_color_map_pen, d_graph, d_labels_angle, d_labels_color, d_labels_font, d_labels_list, d_labels_x_offset, d_labels_y_offset, d_matrix, d_pen_list, d_show_labels, d_use_matrix_formula, d_white_out_labels, PlotMarker::index(), levels(), PenStyleBox::styleIndex(), LinearColorMap::toXmlString(), PlotMarker::xLabelOffset(), and PlotMarker::yLabelOffset().

bool Spectrogram::selectedLabels | ( | const QPoint & | pos | ) |

References d_click_pos_x, d_click_pos_y, d_graph, d_labels_angle, d_labels_list, d_selected_label, Graph::hasActiveTool(), and selectLabel().

Referenced by Graph::closestCurve().

void Spectrogram::selectLabel | ( | bool | on | ) |

References d_graph, d_labels_color, d_labels_font, d_labels_list, d_selected_label, Graph::deselect(), Graph::notifyColorChange(), and Graph::notifyFontChange().

Referenced by Graph::closestCurve(), and selectedLabels().

void Spectrogram::setColorBarWidth | ( | int | width | ) |

References color_axis, and d_graph.

Referenced by PlotDialog::acceptParams(), and Graph::copyCurves().

void Spectrogram::setColorMapPen | ( | bool | on = `true` | ) |

References d_color_map_pen, and d_pen_list.

Referenced by PlotDialog::acceptParams(), and Graph::restoreSpectrogram().

void Spectrogram::setColorScaleAxis | ( | int | axis | ) |

inline

References color_axis.

Referenced by Graph::plotSpectrogram().

void Spectrogram::setContourLevels | ( | const QwtValueList & | levels | ) |

References createLabels().

Referenced by copy(), Graph::restoreSpectrogram(), PlotDialog::setEquidistantLevels(), setLevelsNumber(), Spectrogram(), and ContourLinesEditor::updateContourLevels().

void Spectrogram::setContourLinePen | ( | int | index,
|  | const QPen & | pen
| ) |  |

References contourPen(), d_color_map_pen, d_graph, d_pen_list, and levels().

void Spectrogram::setContourPenList | ( | QList< QPen > | lst | ) |

References d_color_map_pen, and d_pen_list.

Referenced by copy(), Graph::restoreSpectrogram(), and ContourLinesEditor::updateContourPens().

void Spectrogram::setCustomColorMap | ( | const LinearColorMap & | map | ) |

References color_axis, color_map, color_map_policy, colorMap(), Custom, d_graph, and range().

Referenced by PlotDialog::acceptParams(), copy(), ApplicationWindow::plotSpectrogram(), and Graph::restoreSpectrogram().

void Spectrogram::setDefaultColorMap | ( |  | ) |

References MdiSubWindow::applicationWindow(), color_axis, color_map, color_map_policy, colorMap(), ApplicationWindow::d_3D_color_map, d_graph, Default, Graph::multiLayer(), and range().

Referenced by PlotDialog::acceptParams(), Graph::plotSpectrogram(), and Graph::restoreSpectrogram().

void Spectrogram::setGrayScale | ( |  | ) |

References color_axis, color_map, color_map_policy, colorMap(), d_graph, GrayScale, and range().

Referenced by PlotDialog::acceptParams(), Graph::plotSpectrogram(), and Graph::restoreSpectrogram().

void Spectrogram::setLabelOffset | ( | int | index,
|  | double | x,
|  | double | y
| ) |  |

References d_labels_list, and PlotMarker::setLabelOffset().

Referenced by Graph::restoreSpectrogram().

void Spectrogram::setLabelsColor | ( | const QColor & | c | ) |

References d_labels_color, and d_labels_list.

Referenced by PlotDialog::applyLabelsFormatToItem(), and Graph::restoreSpectrogram().

void Spectrogram::setLabelsFont | ( | const QFont & | font | ) |

References d_labels_font, and d_labels_list.

Referenced by Graph::restoreSpectrogram().

void Spectrogram::setLabelsOffset | ( | double | x,
|  | double | y
| ) |  |

References d_labels_x_offset, and d_labels_y_offset.

Referenced by PlotDialog::applyLabelsFormatToItem(), and Graph::restoreSpectrogram().

void Spectrogram::setLabelsRotation | ( | double | angle | ) |

References d_labels_angle, d_labels_list, and PlotMarker::setAngle().

Referenced by PlotDialog::applyLabelsFormatToItem(), and Graph::restoreSpectrogram().

void Spectrogram::setLabelsWhiteOut | ( | bool | whiteOut | ) |

References d_labels_list, and d_white_out_labels.

Referenced by PlotDialog::applyLabelsFormatToItem(), and Graph::restoreSpectrogram().

void Spectrogram::setLevelsNumber | ( | int | levels | ) |

References range(), and setContourLevels().

Referenced by Graph::restoreSpectrogram().

bool Spectrogram::setMatrix | ( | Matrix * | m,
|  | bool | useFormula = `false`
| ) |  |

References Matrix::canCalculate(), d_graph, d_matrix, d_use_matrix_formula, Graph::multiLayer(), and updateData().

Referenced by PlotDialog::acceptParams().

bool Spectrogram::setUseMatrixFormula | ( | bool | on = `true` | ) |

References Matrix::canCalculate(), d_matrix, d_use_matrix_formula, and updateData().

Referenced by Graph::restoreSpectrogram().

void Spectrogram::setVisible | ( | bool | on | ) |

virtual

References d_labels_list.

Referenced by Graph::copyCurves(), and Graph::restoreSpectrogram().

void Spectrogram::showColorScale | ( | int | axis,
|  | bool | on = `true`
| ) |  |

References color_axis, colorMap(), d_graph, Graph::enableAxis(), hasColorScale(), range(), and Graph::updateLayout().

Referenced by PlotDialog::acceptParams(), and Graph::copyCurves().

void Spectrogram::showContourLineLabels | ( | bool | show = `true` | ) |

References d_graph, d_labels_list, and d_show_labels.

Referenced by PlotDialog::acceptParams(), PlotDialog::applyLabelsFormatToItem(), and Graph::restoreSpectrogram().

void Spectrogram::updateData | ( |  | ) |

References color_axis, colorMap(), d_graph, d_matrix, d_use_matrix_formula, and range().

Referenced by setMatrix(), setUseMatrixFormula(), and ApplicationWindow::updateMatrixPlots().

void Spectrogram::updateLabels | ( | QPainter * | p,
|  | const QwtScaleMap & | xMap,
|  | const QwtScaleMap & | yMap,
|  | const QwtRasterData::ContourLines & | lines
| ) |  | const

protected

References d_graph, d_labels_list, d_labels_x_offset, d_labels_y_offset, levels(), PlotMarker::xLabelOffset(), and PlotMarker::yLabelOffset().

Referenced by drawContourLines().

bool Spectrogram::useColorMapPen | ( |  | ) |

inline

References d_color_map_pen.

Referenced by PlotDialog::setActiveCurve().

bool Spectrogram::useMatrixFormula | ( |  | ) |

inline

References d_use_matrix_formula.

Referenced by PlotDialog::setActiveCurve().

## Member Data Documentation

int Spectrogram::color_axis

protected

Axis used to display the color scale.

Referenced by colorBarWidth(), colorScaleAxis(), hasColorScale(), saveToString(), setColorBarWidth(), setColorScaleAxis(), setCustomColorMap(), setDefaultColorMap(), setGrayScale(), showColorScale(), and updateData().

LinearColorMap Spectrogram::color_map

protected

Referenced by colorMap(), colorMapPointer(), copy(), range(), renderImage(), saveToString(), setCustomColorMap(), setDefaultColorMap(), and setGrayScale().

ColorMapPolicy Spectrogram::color_map_policy

protected

Flags.

Referenced by colorMapPolicy(), copy(), saveToString(), setCustomColorMap(), setDefaultColorMap(), and setGrayScale().

double Spectrogram::d_click_pos_x

protected

Keep track of the coordinates of the point where the user clicked when selecting the labels.

Referenced by moveLabel(), and selectedLabels().

double Spectrogram::d_click_pos_y

protected

Referenced by moveLabel(), and selectedLabels().

bool Spectrogram::d_color_map_pen

protected

Flag telling if we use the color map to calculate the pen (QwtPlotSpectrogram::contourPen()).

Referenced by contourPen(), copy(), saveToString(), setColorMapPen(), setContourLinePen(), setContourPenList(), and useColorMapPen().

Graph* Spectrogram::d_graph

protected

Pointer to the parent plot.

Referenced by colorBarWidth(), createLabels(), graph(), hasColorScale(), moveLabel(), saveToString(), selectedLabels(), selectLabel(), setColorBarWidth(), setContourLinePen(), setCustomColorMap(), setDefaultColorMap(), setGrayScale(), setMatrix(), showColorScale(), showContourLineLabels(), updateData(), and updateLabels().

double Spectrogram::d_labels_angle

protected

Referenced by copy(), createLabels(), labelsRotation(), saveToString(), selectedLabels(), and setLabelsRotation().

QColor Spectrogram::d_labels_color

protected

Labels color.

Referenced by copy(), createLabels(), labelsColor(), saveToString(), selectLabel(), and setLabelsColor().

QFont Spectrogram::d_labels_font

protected

Labels font.

Referenced by copy(), createLabels(), labelsFont(), saveToString(), selectLabel(), and setLabelsFont().

QList<PlotMarker *> Spectrogram::d_labels_list

protected

List of the text labels associated to this spectrogram.

Referenced by clearLabels(), copy(), createLabels(), labelsList(), moveLabel(), saveToString(), selectedLabels(), selectLabel(), setLabelOffset(), setLabelsColor(), setLabelsFont(), setLabelsRotation(), setLabelsWhiteOut(), setVisible(), showContourLineLabels(), and updateLabels().

double Spectrogram::d_labels_x_offset

protected

Referenced by copy(), labelsXOffset(), saveToString(), setLabelsOffset(), and updateLabels().

double Spectrogram::d_labels_y_offset

protected

Referenced by copy(), labelsYOffset(), saveToString(), setLabelsOffset(), and updateLabels().

Matrix* Spectrogram::d_matrix

protected

Pointer to the source data matrix.

Referenced by boundingRect(), matrix(), range(), saveToString(), setMatrix(), setUseMatrixFormula(), and updateData().

QList<QPen> Spectrogram::d_pen_list

protected

Referenced by contourPen(), contourPenList(), copy(), saveToString(), setColorMapPen(), setContourLinePen(), and setContourPenList().

PlotMarker* Spectrogram::d_selected_label

protected

Keeps track of the plot marker on which the user clicked when selecting the labels.

Referenced by hasSelectedLabels(), moveLabel(), selectedLabels(), and selectLabel().

bool Spectrogram::d_show_labels

protected

Flag telling if we display the labels.

Referenced by copy(), createLabels(), drawContourLines(), hasLabels(), saveToString(), and showContourLineLabels().

bool Spectrogram::d_use_matrix_formula

protected

Flag telling that we evaluate the matrix expression instead of using the matrix data.

Referenced by saveToString(), setMatrix(), setUseMatrixFormula(), updateData(), and useMatrixFormula().

bool Spectrogram::d_white_out_labels

protected

Flag telling if we paint a white background for the labels.

Referenced by copy(), createLabels(), labelsWhiteOut(), saveToString(), and setLabelsWhiteOut().

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

- qtiplot/src/plot2D/Spectrogram.h
- qtiplot/src/plot2D/Spectrogram.cpp