Engauge Digitizer  2
Public Member Functions | Friends | List of all members
ExportFileRelations Class Reference

Strategy class for exporting to a file. This strategy is external to the Document class so that class is simpler. More...

#include <ExportFileRelations.h>

Inheritance diagram for ExportFileRelations:
Inheritance graph
Collaboration diagram for ExportFileRelations:
Collaboration graph

Public Member Functions

 ExportFileRelations ()
 Single constructor. More...
 
void exportToFile (const DocumentModelExportFormat &modelExportOverride, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str, unsigned int &numWritesSoFar) const
 Export Document points according to the settings. More...
 
- Public Member Functions inherited from ExportFileAbstractBase
 ExportFileAbstractBase ()
 Single constructor. More...
 
virtual ~ExportFileAbstractBase ()
 

Friends

class TestExport
 

Additional Inherited Members

- Protected Member Functions inherited from ExportFileAbstractBase
QStringList curvesToInclude (const DocumentModelExportFormat &modelExportOverride, const Document &document, const QStringList &curvesGraphsNames, CurveConnectAs curveConnectAs1, CurveConnectAs curveConnectAs2) const
 Identify curves to include in export. The specified DocumentModelExportFormat overrides same data in Document for previewing window. More...
 
void destroy2DArray (QVector< QVector< QString *> > &array) const
 Deallocate memory for array. More...
 
QString gnuplotComment () const
 Gnuplot comment delimiter. More...
 
void insertLineSeparator (bool isFirst, ExportHeader exportHeader, QTextStream &str) const
 Insert line(s) between successive sets of curves. More...
 
double linearlyInterpolateYRadiusFromTwoPoints (double xThetaValue, const DocumentModelCoords &modelCoords, const QPointF &posGraphBefore, const QPointF &posGraph) const
 Interpolate (if xThetaValue is between posGraphBefore.x() and posGraph.x()) or extrapolate (if xThetaValue < posGraphBefore.x() or xThetaValue > posGraph.x()) the given x/theta value using the two specified graph points. More...
 
QString wrapInDoubleQuotesIfNeeded (const DocumentModelExportFormat &modelExportOverride, const QString &valueString) const
 RFC 4180 says if values are delimited by a comma AND a value has commas in it (for locale like English/Switzerland when dealing with numbers) then double quotes are required for the value. More...
 

Detailed Description

Strategy class for exporting to a file. This strategy is external to the Document class so that class is simpler.

Definition at line 26 of file ExportFileRelations.h.

Constructor & Destructor Documentation

◆ ExportFileRelations()

ExportFileRelations::ExportFileRelations ( )

Single constructor.

Definition at line 30 of file ExportFileRelations.cpp.

31 {
32 }

Member Function Documentation

◆ exportToFile()

void ExportFileRelations::exportToFile ( const DocumentModelExportFormat modelExportOverride,
const Document document,
const MainWindowModel modelMainWindow,
const Transformation transformation,
QTextStream &  str,
unsigned int &  numWritesSoFar 
) const

Export Document points according to the settings.

The DocumentModelExportFormat inside the Document is ignored so DlgSettingsExport can supply its own DocumentModelExportFormat when previewing what would be exported.

Definition at line 223 of file ExportFileRelations.cpp.

229 {
230  LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::exportToFile";
231 
232  // Log coordinates must be temporarily transformed to linear coordinates
233  bool isLogXTheta = (document.modelCoords().coordScaleXTheta() == COORD_SCALE_LOG);
234  bool isLogYRadius = (document.modelCoords().coordScaleYRadius() == COORD_SCALE_LOG);
235 
236  // Identify curves to be included
237  QStringList curvesIncluded = curvesToInclude (modelExportOverride,
238  document,
239  document.curvesGraphsNames(),
242 
243  // Delimiter
244  const QString delimiter = exportDelimiterToText (modelExportOverride.delimiter(),
245  modelExportOverride.header() == EXPORT_HEADER_GNUPLOT);
246 
247  // Export in one of two layouts
248  if (modelExportOverride.layoutFunctions() == EXPORT_LAYOUT_ALL_PER_LINE) {
249  exportAllPerLineXThetaValuesMerged (modelExportOverride,
250  document,
251  modelMainWindow,
252  curvesIncluded,
253  delimiter,
254  transformation,
255  isLogXTheta,
256  isLogYRadius,
257  str,
258  numWritesSoFar);
259  } else {
260  exportOnePerLineXThetaValuesMerged (modelExportOverride,
261  document,
262  modelMainWindow,
263  curvesIncluded,
264  delimiter,
265  transformation,
266  isLogXTheta,
267  isLogYRadius,
268  str,
269  numWritesSoFar);
270  }
271 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
QStringList curvesToInclude(const DocumentModelExportFormat &modelExportOverride, const Document &document, const QStringList &curvesGraphsNames, CurveConnectAs curveConnectAs1, CurveConnectAs curveConnectAs2) const
Identify curves to include in export. The specified DocumentModelExportFormat overrides same data in ...
CoordScale coordScaleXTheta() const
Get method for linear/log scale on x/theta.
ExportDelimiter delimiter() const
Get method for delimiter.
CoordScale coordScaleYRadius() const
Get method for linear/log scale on y/radius.
ExportHeader header() const
Get method for header.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
ExportLayoutFunctions layoutFunctions() const
Get method for functions layout.
QString exportDelimiterToText(ExportDelimiter exportDelimiter, bool isGnuplotDelimiter)
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
Definition: Document.cpp:695
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
Definition: Document.cpp:349

Friends And Related Function Documentation

◆ TestExport

friend class TestExport
friend

Definition at line 29 of file ExportFileRelations.h.


The documentation for this class was generated from the following files: