Beispiel #1
0
std::string MatrixModel::saveToProject() {
  MantidQt::API::TSVSerialiser tsv;

  for (int row = 0; row < d_rows; ++row) {
    // Index to the first element of each row
    const int rowStart = d_cols * row;

    // If the row is empty, we can skip it
    bool emptyRow = true;
    for (int col = 0; col < d_cols; ++col)
      if (gsl_finite(d_data[rowStart + col])) {
        emptyRow = false;
        break;
      }

    if (emptyRow)
      continue;

    // Write out the values for the row
    tsv.writeLine(Mantid::Kernel::Strings::toString<int>(row));
    for (int col = 0; col < d_cols; ++col) {
      double val = d_data[rowStart + col];
      if (gsl_finite(val))
        tsv << QString::number(val, 'e', 16);
      else if (col + 1 < d_cols)
        tsv << ""; // If we're not the last element, put in an empty spacer
    }
  }

  return tsv.outputLines();
}
Beispiel #2
0
std::string Grid::saveToString() {
  MantidQt::API::TSVSerialiser tsv;
  tsv.writeLine("grid");

  tsv << xEnabled() << xMinEnabled();
  tsv << yEnabled() << yMinEnabled();

  tsv << majPenX().color().name();
  tsv << majPenX().style() - 1;
  tsv << majPenX().widthF();

  tsv << minPenX().color().name();
  tsv << minPenX().style() - 1;
  tsv << minPenX().widthF();

  tsv << majPenY().color().name();
  tsv << majPenY().style() - 1;
  tsv << majPenY().widthF();

  tsv << minPenY().color().name();
  tsv << minPenY().style() - 1;
  tsv << minPenY().widthF();

  tsv << xZeroLineEnabled() << yZeroLineEnabled();
  tsv << xAxis() << yAxis();
  tsv << testRenderHint(QwtPlotItem::RenderAntialiased);
  return tsv.outputLines();
}
std::string LinePlotOptions::saveToProject() const {
  MantidQt::API::TSVSerialiser tsv;

  tsv.writeLine("PlotAxis") << getPlotAxis();
  tsv.writeLine("LogYScale") << isLogScaledY();
  tsv.writeLine("Normalization") << static_cast<int>(getNormalization());

  return tsv.outputLines();
}