# gcu::SpectrumView Class Reference

`#include <gcu/spectrumview.h>`

List of all members.

## Public Member Functions

| SpectrumView (SpectrumDocument *pDoc)
| Constructor.
virtual | ~SpectrumView ()
| Destructor.
void | SetAxisBounds (GogAxisType target, double min, double max, bool inverted)
void | SetAxisLabel (GogAxisType target, char const *unit)
void | ShowAxis (GogAxisType target, bool show)
void | InvertAxis (GogAxisType target, bool inverted)
void | Render (cairo_t *cr, double width, double height)
void | OnMinChanged ()
void | OnMaxChanged ()
void | OnXRangeChanged ()
GogSeries * | NewSeries (bool new_plot)
void | SaveAsImage (std::string const &filename, char const *mime_type, unsigned width, unsigned height) const
SpectrumDocument * | GetDoc (void)
GtkWidget * | GetWidget (void)
GtkWidget * | GetOptionBox (void)
GogSeries * | GetSeries (void)

## Detailed Description

The view class used for spectra. This API is still quite unstable and might change in the future.

Definition at line 40 of file spectrumview.h.

## Constructor & Destructor Documentation

gcu::SpectrumView::SpectrumView | ( | SpectrumDocument * | pDoc | ) |

Constructor.

Parameters:

  | pDoc,: | a pointer to the SpectrumDocument instance.

Creates a view for the document.

virtual gcu::SpectrumView::~SpectrumView | ( |  | ) | `[virtual]`

Destructor.

The destructor of SpectrumView.

## Member Function Documentation

void gcu::SpectrumView::SetAxisBounds | ( | GogAxisType | target,
|  | double | min,
|  | double | max,
|  | bool | inverted |
| ) |  |  |

Parameters:

  | target | an axis type.
  | min | the mimimum value to show.
  | max | the maximum value to show.
  | inverted | whether to invert the axis.

Sets the scale of the first axis of the selected type.

void gcu::SpectrumView::SetAxisLabel | ( | GogAxisType | target,
|  | char const * | unit |
| ) |  |  |

Parameters:

  | target | an axis type.
  | unit | a text (might be a unit).

Sets the text for the label of the first axis of the selected type.

void gcu::SpectrumView::ShowAxis | ( | GogAxisType | target,
|  | bool | show |
| ) |  |  |

Parameters:

  | target | an axis type.
  | show | whether to show the axis or not

Used to show or hide the first axis of either GOG_AXIS_X or GOG_AXIS_Y types.

void gcu::SpectrumView::InvertAxis | ( | GogAxisType | target,
|  | bool | inverted |
| ) |  |  |

Parameters:

  | target | an axis type.
  | inverted | whether to invert the axis scale or not

Used to invert the first axis of either GOG_AXIS_X or GOG_AXIS_Y types.

void gcu::SpectrumView::Render | ( | cairo_t * | cr,
|  | double | width,
|  | double | height |
| ) |  |  |

Parameters:

  | cr | the cairo_t* to which render.
  | width | the width of the rendering area.
  | height | the height of the rendering area.

Renders the chart to cr.

void gcu::SpectrumView::OnMinChanged | ( |  | ) |

Called by the framework if the minimum has changed for the x-axis.

void gcu::SpectrumView::OnMaxChanged | ( |  | ) |

Called by the framework if the maximum has changed for the x-axis.

void gcu::SpectrumView::OnXRangeChanged | ( |  | ) |

Called by the framework if the range has changed for the x-axis.

GogSeries* gcu::SpectrumView::NewSeries | ( | bool | new_plot | ) |

Parameters:

  | new_plot | if true, a new plot is created (this is not yet implemented). Creates a new GogSeries for the chart.

void gcu::SpectrumView::SaveAsImage | ( | std::string const & | filename,
|  | char const * | mime_type,
|  | unsigned | width,
|  | unsigned | height |
| ) |  |  | const

Parameters:

  | filename | the name of the file.
  | mime_type | the requested mime type.
  | width | the width of the generated image.
  | height | the height of the generated image.

Export the view contents as an image. The size of the new image is defined by the width and height parameters. Supported ilage file format include svg, png, jpeg, ps, eps, and pdf, and possibly a few other bitmap formats.

gcu::SpectrumView::GetDoc | ( | void |  | ) | `[inline]`

Returns:
  the associated document.

Definition at line 142 of file spectrumview.h.

gcu::SpectrumView::GetWidget | ( | void |  | ) | `[inline]`

Returns:
  the widget used to display the spectrum.

Definition at line 146 of file spectrumview.h.

gcu::SpectrumView::GetOptionBox | ( | void |  | ) | `[inline]`

Returns:
  a GtkBox to which an optional user interface might be added.

Definition at line 150 of file spectrumview.h.

gcu::SpectrumView::GetSeries | ( | void |  | ) | `[inline]`

Returns:
  the first GogSeries* created for the view.

Definition at line 154 of file spectrumview.h.

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

- spectrumview.h