Example #1
0
/** Calculate and show the full (integrated) line, using the latest
 * integrated workspace. The apply() method must have been called
 * before calling this. */
void LineViewer::showFull()
{
  if (!m_sliceWS) return;
  MatrixWorkspace_const_sptr sliceMatrix = boost::dynamic_pointer_cast<const MatrixWorkspace>(m_sliceWS);
  if (sliceMatrix)
  {
    MantidQwtMatrixWorkspaceData curveData(sliceMatrix, 0, false /*not logScale*/);
    m_fullCurve->setData(curveData);
    Unit_const_sptr unit = sliceMatrix->getAxis(0)->unit();
    std::string title = unit->caption() + " (" + unit->label() + ")";
    m_plot->setAxisTitle( QwtPlot::xBottom, QString::fromStdString(title));;
    title = sliceMatrix->YUnit() + " (" + sliceMatrix->YUnitLabel() + ")";
    m_plot->setAxisTitle( QwtPlot::yLeft, QString::fromStdString(title));;
  }
  else
  {
    MantidQwtIMDWorkspaceData curveData(m_sliceWS, false,
        VMD(), VMD(), m_lineOptions->getNormalization());
    curveData.setPreviewMode(false);
    curveData.setPlotAxisChoice(m_lineOptions->getPlotAxis());
    m_fullCurve->setData(curveData);
    m_plot->setAxisTitle( QwtPlot::xBottom, QString::fromStdString( curveData.getXAxisLabel() ));;
    m_plot->setAxisTitle( QwtPlot::yLeft, QString::fromStdString( curveData.getYAxisLabel() ));;
  }

  if (m_previewCurve->isVisible())
  {
    m_previewCurve->setVisible(false);
    m_previewCurve->detach();
    m_fullCurve->attach(m_plot);
  }
  m_fullCurve->setVisible(true);
  m_plot->replot();
  m_plot->setTitle("Integrated Line Plot");
}