Engauge Digitizer 2
Loading...
Searching...
No Matches
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.
void exportToFile (const DocumentModelExportFormat &modelExportOverride, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str, unsigned int &numWritesSoFar, bool &isOverrun) const
 Export Document points according to the settings.
Public Member Functions inherited from ExportFileAbstractBase
 ExportFileAbstractBase ()
 Single constructor.
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.
void destroy2DArray (QVector< QVector< QString * > > &array) const
 Deallocate memory for array.
QString gnuplotComment () const
 Gnuplot comment delimiter.
void insertLineSeparator (bool isFirst, ExportHeader exportHeader, QTextStream &str) const
 Insert line(s) between successive sets of curves.
double linearlyInterpolateYRadiusFromTwoPoints (double xThetaLinearized, 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.
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.

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,
bool & isOverrun ) 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.

230{
231 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::exportToFile";
232
233 // There are no known ways for relations to overflow the maximum points limit so
234 // this initialization value will not be overwritten
235 isOverrun = false;
236
237 // Log coordinates must be temporarily transformed to linear coordinates
238 bool isLogXTheta = (document.modelCoords().coordScaleXTheta() == COORD_SCALE_LOG);
239 bool isLogYRadius = (document.modelCoords().coordScaleYRadius() == COORD_SCALE_LOG);
240
241 // Identify curves to be included
242 QStringList curvesIncluded = curvesToInclude (modelExportOverride,
243 document,
244 document.curvesGraphsNames(),
247
248 // Delimiter
249 const QString delimiter = exportDelimiterToText (modelExportOverride.delimiter(),
250 modelExportOverride.header() == EXPORT_HEADER_GNUPLOT);
251
252 // Export in one of two layouts
253 if (modelExportOverride.layoutFunctions() == EXPORT_LAYOUT_ALL_PER_LINE) {
254 exportAllPerLineXThetaValuesMerged (modelExportOverride,
255 document,
256 modelMainWindow,
257 curvesIncluded,
258 delimiter,
259 transformation,
260 isLogXTheta,
261 isLogYRadius,
262 str,
263 numWritesSoFar);
264 } else {
265 exportOnePerLineXThetaValuesMerged (modelExportOverride,
266 document,
267 modelMainWindow,
268 curvesIncluded,
269 delimiter,
270 transformation,
271 isLogXTheta,
272 isLogYRadius,
273 str,
274 numWritesSoFar);
275 }
276}
@ COORD_SCALE_LOG
Definition CoordScale.h:14
@ CONNECT_AS_RELATION_STRAIGHT
@ CONNECT_AS_RELATION_SMOOTH
QString exportDelimiterToText(ExportDelimiter exportDelimiter, bool isGnuplotDelimiter)
@ EXPORT_HEADER_GNUPLOT
@ EXPORT_LAYOUT_ALL_PER_LINE
log4cpp::Category * mainCat
Definition Logger.cpp:14
ExportHeader header() const
Get method for header.
ExportDelimiter delimiter() const
Get method for delimiter.
ExportLayoutFunctions layoutFunctions() const
Get method for functions layout.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
Definition Document.cpp:355
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
Definition Document.cpp:707
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 ...
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ TestExport

friend class TestExport
friend

Definition at line 29 of file ExportFileRelations.h.


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