コード例 #1
0
void ExportFileFunctions::exportToFile (const DocumentModelExportFormat &modelExportOverride,
                                        const Document &document,
                                        const MainWindowModel &modelMainWindow,
                                        const Transformation &transformation,
                                        QTextStream &str) const
{
  LOG4CPP_INFO_S ((*mainCat)) << "ExportFileFunctions::exportToFile";

  // Identify curves to be included
  QStringList curvesIncluded = curvesToInclude (modelExportOverride,
                                                document,
                                                document.curvesGraphsNames(),
                                                CONNECT_AS_FUNCTION_SMOOTH,
                                                CONNECT_AS_FUNCTION_STRAIGHT);

  // Delimiter
  const QString delimiter = exportDelimiterToText (modelExportOverride.delimiter());

  // Get x/theta values to be used
  CallbackGatherXThetaValuesFunctions ftor (modelExportOverride,
                                            curvesIncluded,
                                            transformation);
  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
                                                                                                     &CallbackGatherXThetaValuesFunctions::callback);
  document.iterateThroughCurvesPointsGraphs(ftorWithCallback);

  ExportXThetaValuesMergedFunctions exportXTheta (modelExportOverride,
                                                  ftor.xThetaValuesRaw(),
                                                  transformation);
  ExportValuesXOrY xThetaValuesMerged = exportXTheta.xThetaValues ();

  // Skip if every curve was a relation
  if (xThetaValuesMerged.count() > 0) {

    // Export in one of two layouts
    if (modelExportOverride.layoutFunctions() == EXPORT_LAYOUT_ALL_PER_LINE) {
      exportAllPerLineXThetaValuesMerged (modelExportOverride,
                                          document,
                                          modelMainWindow,
                                          curvesIncluded,
                                          xThetaValuesMerged,
                                          delimiter,
                                          transformation,
                                          str);
    } else {
      exportOnePerLineXThetaValuesMerged (modelExportOverride,
                                          document,
                                          modelMainWindow,
                                          curvesIncluded,
                                          xThetaValuesMerged,
                                          delimiter,
                                          transformation,
                                          str);
    }
  }
}
コード例 #2
0
QString ExportFileAbstractBase::wrapInDoubleQuotesIfNeeded (const DocumentModelExportFormat &modelExportOverride,
                                                            const QString &valueString) const
{
  QString newValueString = valueString;

  if ((modelExportOverride.delimiter () == EXPORT_DELIMITER_COMMA) &&
      (valueString.indexOf (",") >= 0)) {

    // Eliminate ambiguities according to RFC 4180
    newValueString = QString ("\"%1\"").arg (valueString);
  }

  return newValueString;
}
コード例 #3
0
DocumentModelExportFormat::DocumentModelExportFormat(const DocumentModelExportFormat &other) :
  m_curveNamesNotExported (other.curveNamesNotExported()),
  m_pointsSelectionFunctions (other.pointsSelectionFunctions()),
  m_pointsIntervalFunctions (other.pointsIntervalFunctions()),
  m_pointsIntervalUnitsFunctions (other.pointsIntervalUnitsFunctions()),
  m_pointsSelectionRelations (other.pointsSelectionRelations()),
  m_pointsIntervalRelations (other.pointsIntervalRelations()),
  m_pointsIntervalUnitsRelations (other.pointsIntervalUnitsRelations()),
  m_layoutFunctions (other.layoutFunctions()),
  m_delimiter (other.delimiter()),
  m_header (other.header()),
  m_xLabel (other.xLabel ())
{

}
コード例 #4
0
void ExportFileRelations::exportToFile (const DocumentModelExportFormat &modelExportOverride,
                                        const Document &document,
                                        const MainWindowModel &modelMainWindow,
                                        const Transformation &transformation,
                                        QTextStream &str) const
{
  LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::exportToFile";

  // Identify curves to be included
  QStringList curvesIncluded = curvesToInclude (modelExportOverride,
                                                document,
                                                document.curvesGraphsNames(),
                                                CONNECT_AS_RELATION_SMOOTH,
                                                CONNECT_AS_RELATION_STRAIGHT);

  // Delimiter
  const QString delimiter = exportDelimiterToText (modelExportOverride.delimiter(),
                                                   modelExportOverride.header() == EXPORT_HEADER_GNUPLOT);

  // Export in one of two layouts
  if (modelExportOverride.layoutFunctions() == EXPORT_LAYOUT_ALL_PER_LINE) {
    exportAllPerLineXThetaValuesMerged (modelExportOverride,
                                        document,
                                        modelMainWindow,
                                        curvesIncluded,
                                        delimiter,
                                        transformation,
                                        str);
  } else {
    exportOnePerLineXThetaValuesMerged (modelExportOverride,
                                        document,
                                        modelMainWindow,
                                        curvesIncluded,
                                        delimiter,
                                        transformation,
                                        str);
  }
}