/** Load tree tab state from a Mantid project file
 * @param lines :: lines from the project file to load state from
 */
void InstrumentWidgetTreeTab::loadFromProject(const std::string &lines) {
  API::TSVSerialiser tsv(lines);

  if (!tsv.selectSection("treetab"))
    return;

  std::string tabLines;
  tsv >> tabLines;
  API::TSVSerialiser tab(tabLines);

  if (tab.selectLine("SelectedComponent")) {
    std::string componentName;
    tab >> componentName;
    selectComponentByName(QString::fromStdString(componentName));
  }
示例#2
0
/**
 * Load the state of the color map widget from a project file.
 * @param lines :: string representing the current state of the color map
 * widget.
 */
void ColorMapWidget::loadFromProject(const std::string &lines) {
  API::TSVSerialiser tsv(lines);

  int scaleType;
  double min, max, power;
  tsv.selectLine("ScaleType");
  tsv >> scaleType;
  tsv.selectLine("Power");
  tsv >> power;
  tsv.selectLine("MinValue");
  tsv >> min;
  tsv.selectLine("MaxValue");
  tsv >> max;

  setScaleType(scaleType);
  setNthPower(power);
  setMinValue(min);
  setMaxValue(max);
}
示例#3
0
/** Load shape 2D state from a Mantid project file
 * @param lines :: lines from the project file to load state from
 * @return a new shape2D with old state applied
 */
Shape2D *Shape2D::loadFromProject(const std::string &lines) {
  API::TSVSerialiser tsv(lines);

  if (!tsv.selectLine("Type"))
    return nullptr;

  std::string type;
  tsv >> type;

  Shape2D *shape = loadShape2DFromType(type, lines);
  if (!shape)
    return nullptr;

  if (tsv.selectLine("Properties")) {
    bool scalable, editing, selected, visible;
    tsv >> scalable >> editing >> selected >> visible;

    shape->setScalable(scalable);
    shape->edit(editing);
    shape->setSelected(selected);
    shape->setVisible(visible);
  }