Exemplo n.º 1
0
void Equation::save(QXmlStreamWriter &s) {
  s.writeStartElement(staticTypeTag);
  // Reparse the equation, then write it back out in text so that we can update
  // any vectors or scalars that had name changes, but we don't get affected by
  // the optimizer
  if (!_equation.isEmpty()) {
    QMutexLocker ml(&Equations::mutex());
    yylex_destroy();
    yy_scan_string(parseableEquation());
    ParsedEquation = 0L;
    int rc = yyparse(store());
    Equations::Node *en = static_cast<Equations::Node*>(ParsedEquation);
    if (rc == 0 && en) {
      if (!en->takeVectors(VectorsUsed)) {
        Debug::self()->log(i18n("Equation [%1] failed to find its vectors when saving.  Resulting Kst file may have issues.").arg(_equation), Debug::Warning);
      }
      QString etext = en->text();
      s.writeAttribute("expression", etext);
    }
    delete en;
    ParsedEquation = 0L;
  }

  if (_xInVector) {
    s.writeAttribute("xvector", _xInVector->Name());
  }
  if (_doInterp) {
    s.writeAttribute("interpolate", "true");
  }
  saveNameInfo(s, VNUM|ENUM|XNUM);
  s.writeEndElement();
}
Exemplo n.º 2
0
void Curve::save(QXmlStreamWriter &s) {
  s.writeStartElement(staticTypeTag);
  s.writeAttribute("xvector", _inputVectors[XVECTOR]->Name());
  s.writeAttribute("yvector", _inputVectors[YVECTOR]->Name());
  if (_inputVectors.contains(EXVECTOR)) {
    s.writeAttribute("errorxvector", _inputVectors[EXVECTOR]->Name());
  }
  if (_inputVectors.contains(EYVECTOR)) {
    s.writeAttribute("erroryvector", _inputVectors[EYVECTOR]->Name());
  }
  if (_inputVectors.contains(EXMINUSVECTOR)) {
    s.writeAttribute("errorxminusvector", _inputVectors[EXMINUSVECTOR]->Name());
  }
  if (_inputVectors.contains(EYMINUSVECTOR)) {
    s.writeAttribute("erroryminusvector", _inputVectors[EYMINUSVECTOR]->Name());
  }
  s.writeAttribute("color", Color.name());

  s.writeAttribute("haslines", QVariant(HasLines).toString());
  s.writeAttribute("linewidth", QString::number(LineWidth));
  s.writeAttribute("linestyle", QString::number(LineStyle));

  s.writeAttribute("haspoints", QVariant(HasPoints).toString());
  s.writeAttribute("pointtype", QString::number(PointType));
  s.writeAttribute("pointdensity", QString::number(PointDensity));

  s.writeAttribute("hasbars", QVariant(HasBars).toString());
  s.writeAttribute("barstyle", QString::number(BarStyle));
  s.writeAttribute("ignoreautoscale", QVariant(_ignoreAutoScale).toString());

  saveNameInfo(s, CNUM);

  s.writeEndElement();
}
Exemplo n.º 3
0
/** Save data string information */
void DataString::save(QXmlStreamWriter &s) {
  if (_dp->dataSource()) {
    s.writeStartElement("datastring");
    _dp->saveFilename(s);
    s.writeAttribute("field", _dp->_field);

    saveNameInfo(s, XNUM);
    s.writeEndElement();
  }
}
Exemplo n.º 4
0
/** Save data scalar information */
void VScalar::save(QXmlStreamWriter &s) {
  if (dataSource()) {
    s.writeStartElement("vscalar");
    saveFilename(s);

    s.writeAttribute("field", _field);
    s.writeAttribute("f0", QString::number(_f0));

    saveNameInfo(s, SCALARNUM);
    s.writeEndElement();
  }
}
Exemplo n.º 5
0
void Histogram::save(QXmlStreamWriter &xml) {
    xml.writeStartElement(staticTypeTag);
    xml.writeAttribute("vector", _inputVectors[RAWVECTOR]->Name());
    xml.writeAttribute("numberofbins", QString::number(_NumberOfBins));
    xml.writeAttribute("realtimeautobin", QVariant(_realTimeAutoBin).toString());
    xml.writeAttribute("min", QString::number(_MinX));
    xml.writeAttribute("max", QString::number(_MaxX));
    xml.writeAttribute("normalizationmode", QString::number(_NormalizationMode));
    saveNameInfo(xml, VNUM|HNUM|XNUM);

    xml.writeEndElement();
}
void String::save(QXmlStreamWriter &s) {
    s.writeStartElement("string");
    if (_orphan) {
        s.writeAttribute("orphan", "true");
    }
    if (_editable) {
        s.writeAttribute("editable", "true");
    }
    s.writeAttribute("value", value());
    saveNameInfo(s, TNUM);
    s.writeEndElement();
}
void BasicPlugin::save(QXmlStreamWriter &stream) {
  stream.writeStartElement(staticTypeTag);
  stream.writeAttribute("type", _pluginName);
  saveNameInfo(stream, VNUM|PNUM|XNUM);

  writeVectors(_inputVectors, "inputvector", stream, &NamedObject::Name);
  writeVectors(_inputScalars, "inputscalar", stream, &NamedObject::Name);
  writeVectors(_inputStrings, "inputstring", stream, &NamedObject::Name);
  writeVectors(_outputVectors, "outputvector", stream, &Primitive::slaveName);
  writeVectors(_outputScalars, "outputscalar", stream, &Primitive::slaveName);
  writeVectors(_outputStrings, "outputstring", stream, &Primitive::slaveName);

  stream.writeEndElement();
}
void String::save(QXmlStreamWriter &s) {
  if (provider()) { // Don't save datasource- or vector-derived strings
    return;
  }
  s.writeStartElement("string");
  if (_orphan) {
    s.writeAttribute("orphan", "true");
  }
  if (_editable) {
    s.writeAttribute("editable", "true");
  }
  s.writeAttribute("value", value());
  saveNameInfo(s, TNUM);
  s.writeEndElement();
}
Exemplo n.º 9
0
void GeneratedMatrix::save(QXmlStreamWriter &xml) {
  xml.writeStartElement(staticTypeTag);
  xml.writeAttribute("xmin", QString::number(minX()));
  xml.writeAttribute("ymin", QString::number(minY()));
  xml.writeAttribute("nx", QString::number(xNumSteps()));
  xml.writeAttribute("ny", QString::number(yNumSteps()));
  xml.writeAttribute("xstep", QString::number(xStepSize()));
  xml.writeAttribute("ystep", QString::number(yStepSize()));
  xml.writeAttribute("gradzmin", QString::number(_gradZMin));
  xml.writeAttribute("gradzmax", QString::number(_gradZMax));
  xml.writeAttribute("xdirection", QVariant(_xDirection).toString());
  saveNameInfo(xml, VECTORNUM|MATRIXNUM|SCALARNUM);

  xml.writeEndElement();

}
/** Save vector information */
void EditableVector::save(QXmlStreamWriter &s) {
  s.writeStartElement("editablevector");
  saveNameInfo(s, VNUM|XNUM);

  if (_saveData) {
    QByteArray qba(length()*sizeof(double), '\0');
    QDataStream qds(&qba, QIODevice::WriteOnly);

    for (int i = 0; i < length(); i++) {
      qds << _v[i];
    }

    s.writeTextElement("data", qCompress(qba).toBase64());
  }
  s.writeEndElement();
}
Exemplo n.º 11
0
/** Save data scalar information */
void VScalar::save(QXmlStreamWriter &s) {
  if (_file) {
    s.writeStartElement("vscalar");

    _file->readLock();
    s.writeAttribute("provider", _file->Name());
    DataPrimitive::saveFilename(_file->fileName(), s);
    _file->unlock();

    s.writeAttribute("field", _field);
    s.writeAttribute("f0", QString::number(_f0));

    saveNameInfo(s, XNUM);
    s.writeEndElement();
  }
}
Exemplo n.º 12
0
void CSD::save(QXmlStreamWriter &s) {
  s.writeStartElement(staticTypeTag);
  s.writeAttribute("vector", _inputVectors[CSD_INVECTOR]->Name());
  s.writeAttribute("samplerate", QString::number(_frequency));
  s.writeAttribute("gaussiansigma", QString::number(_gaussianSigma));
  s.writeAttribute("average", QVariant(_average).toString());
  s.writeAttribute("fftlength", QString::number(int(ceil(log(double(_length*2)) / log(2.0)))));
  s.writeAttribute("removemean", QVariant(_removeMean).toString());
  s.writeAttribute("apodize", QVariant(_apodize).toString());
  s.writeAttribute("apodizefunction", QString::number(_apodizeFxn));
  s.writeAttribute("windowsize", QString::number(_windowSize));
  s.writeAttribute("vectorunits", _vectorUnits);
  s.writeAttribute("rateunits", _rateUnits);
  s.writeAttribute("outputtype", QString::number(_outputType));
  saveNameInfo(s,VNUM|XNUM|MNUM|CSDNUM);

  s.writeEndElement();
}
Exemplo n.º 13
0
void PSD::save(QXmlStreamWriter &s) {
  s.writeStartElement(staticTypeTag);
  s.writeAttribute("vector", _inputVectors[INVECTOR]->Name());
  s.writeAttribute("samplerate", QString::number(_Frequency));
  s.writeAttribute("gaussiansigma", QString::number(_gaussianSigma));
  s.writeAttribute("average", QVariant(_Average).toString());
  s.writeAttribute("fftlength", QString::number(int(ceil(log(double(_PSDLength*2)) / log(2.0)))));
  s.writeAttribute("removemean", QVariant(_RemoveMean).toString());
  s.writeAttribute("apodize", QVariant(_Apodize).toString());
  s.writeAttribute("apodizefunction", QString::number(_apodizeFxn));
  s.writeAttribute("interpolateholes", QVariant(_interpolateHoles).toString());
  s.writeAttribute("vectorunits", _vectorUnits);
  s.writeAttribute("rateunits", _rateUnits);
  s.writeAttribute("outputtype", QString::number(_Output));
  saveNameInfo(s, VNUM|PSDNUM|XNUM);

  s.writeEndElement();
}
void EditableMatrix::save(QXmlStreamWriter &xml) {

  QByteArray qba(_zSize*sizeof(double), '\0');
  QDataStream qds(&qba, QIODevice::WriteOnly);

  for (int i = 0; i < _zSize; i++) {
    qds << _z[i];
  }

  xml.writeStartElement(staticTypeTag);
  xml.writeAttribute("xmin", QString::number(minX()));
  xml.writeAttribute("ymin", QString::number(minY()));
  xml.writeAttribute("nx", QString::number(xNumSteps()));
  xml.writeAttribute("ny", QString::number(yNumSteps()));
  xml.writeAttribute("xstep", QString::number(xStepSize()));
  xml.writeAttribute("ystep", QString::number(yStepSize()));
  xml.writeTextElement("data", qCompress(qba).toBase64());
  saveNameInfo(xml, VNUM|MNUM|XNUM);
  xml.writeEndElement();
}
Exemplo n.º 15
0
void DataMatrix::save(QXmlStreamWriter &xml) {
  if (file()) {
    xml.writeStartElement(staticTypeTag);

    saveFilename(xml);

    xml.writeAttribute("field", _field);
    xml.writeAttribute("reqxstart", QString::number(_reqXStart));
    xml.writeAttribute("reqystart", QString::number(_reqYStart));
    xml.writeAttribute("reqnx", QString::number(_reqNX));
    xml.writeAttribute("reqny", QString::number(_reqNY));
    xml.writeAttribute("doave", QVariant(_doAve).toString());
    xml.writeAttribute("doskip", QVariant(_doSkip).toString());
    xml.writeAttribute("skip", QString::number(_skip));
    xml.writeAttribute("xmin", QString::number(minX()));
    xml.writeAttribute("ymin", QString::number(minY()));
    xml.writeAttribute("xstep", QString::number(xStepSize()));
    xml.writeAttribute("ystep", QString::number(yStepSize()));
    saveNameInfo(xml, VNUM|MNUM|XNUM);

    xml.writeEndElement();
  }
}
Exemplo n.º 16
0
void Image::save(QXmlStreamWriter &s) {
  s.writeStartElement(staticTypeTag);
  if (_inputMatrices.contains(THEMATRIX)) {
    s.writeAttribute("matrix", _inputMatrices[THEMATRIX]->Name());
  }

  if (!_pal.paletteData().isEmpty()) {
    s.writeAttribute("palettename", _pal.paletteName());
  }

  s.writeAttribute("hascolormap", QVariant(_hasColorMap).toString());
  s.writeAttribute("lowerthreshold", QString::number(_zLower));
  s.writeAttribute("upperthreshold", QString::number(_zUpper));

  s.writeAttribute("hascontourmap", QVariant(_hasContourMap).toString());
  s.writeAttribute("numcontourlines", QString::number(_numContourLines));
  s.writeAttribute("contourweight", QString::number(_contourWeight));
  s.writeAttribute("contourcolor", _contourColor.name());

  s.writeAttribute("autothreshold", QVariant(_autoThreshold).toString());
  saveNameInfo(s, INUM);
  s.writeEndElement();
}