00001
00002
00003
00004
00005
00006
00007 #include "CurveConnectAs.h"
00008 #include "Document.h"
00009 #include "DocumentModelGeneral.h"
00010 #include "EngaugeAssert.h"
00011 #include "ExportFileRelations.h"
00012 #include "ExportLayoutFunctions.h"
00013 #include "ExportOrdinalsSmooth.h"
00014 #include "ExportOrdinalsStraight.h"
00015 #include "FormatCoordsUnits.h"
00016 #include "Logger.h"
00017 #include <qdebug.h>
00018 #include <qmath.h>
00019 #include <QTextStream>
00020 #include <QVector>
00021 #include "Spline.h"
00022 #include "SplinePair.h"
00023 #include "Transformation.h"
00024 #include <vector>
00025
00026 using namespace std;
00027
00028 const int COLUMNS_PER_CURVE = 2;
00029
00030 ExportFileRelations::ExportFileRelations()
00031 {
00032 }
00033
00034 void ExportFileRelations::exportAllPerLineXThetaValuesMerged (const DocumentModelExportFormat &modelExportOverride,
00035 const Document &document,
00036 const MainWindowModel &modelMainWindow,
00037 const QStringList &curvesIncluded,
00038 const QString &delimiter,
00039 const Transformation &transformation,
00040 bool isLogXTheta,
00041 bool isLogYRadius,
00042 QTextStream &str,
00043 unsigned int &numWritesSoFar) const
00044 {
00045 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::exportAllPerLineXThetaValuesMerged";
00046
00047 int maxColumnSize = maxColumnSizeAllocation (modelExportOverride,
00048 document,
00049 transformation,
00050 isLogXTheta,
00051 isLogYRadius,
00052 curvesIncluded);
00053
00054
00055 if (maxColumnSize > 0) {
00056
00057 if (modelExportOverride.pointsSelectionRelations() == EXPORT_POINTS_SELECTION_RELATIONS_INTERPOLATE) {
00058
00059 exportAllPerLineXThetaValuesMergedMultiplePass (maxColumnSize,
00060 modelExportOverride,
00061 document,
00062 modelMainWindow,
00063 curvesIncluded,
00064 delimiter,
00065 transformation,
00066 isLogXTheta,
00067 isLogYRadius,
00068 str,
00069 numWritesSoFar);
00070
00071 } else {
00072
00073 exportAllPerLineXThetaValuesMergedOnePass (maxColumnSize,
00074 modelExportOverride,
00075 document,
00076 modelMainWindow,
00077 curvesIncluded,
00078 delimiter,
00079 transformation,
00080 isLogXTheta,
00081 isLogYRadius,
00082 str,
00083 numWritesSoFar);
00084 }
00085 }
00086 }
00087
00088 void ExportFileRelations::exportAllPerLineXThetaValuesMergedMultiplePass (int maxColumnSize,
00089 const DocumentModelExportFormat &modelExportOverride,
00090 const Document &document,
00091 const MainWindowModel &modelMainWindow,
00092 const QStringList &curvesIncluded,
00093 const QString &delimiter,
00094 const Transformation &transformation,
00095 bool isLogXTheta,
00096 bool isLogYRadius,
00097 QTextStream &str,
00098 unsigned int &numWritesSoFar) const
00099 {
00100
00101
00102
00103
00104
00105
00106 const int CURVE_COUNT_PER_PASS = 1;
00107
00108 int curveCount = curvesIncluded.count ();
00109
00110 QVector<QVector<QString*> > xThetaYRadiusValuesAll (COLUMNS_PER_CURVE * curveCount, QVector<QString*> (maxColumnSize));
00111
00112 initializeXThetaYRadiusValues (curvesIncluded,
00113 xThetaYRadiusValuesAll);
00114
00115
00116 int colX = 0, colY = colX + 1;
00117 for (int c = 0; c < curvesIncluded.count (); c++) {
00118 QString curve = curvesIncluded [c];
00119
00120 QStringList curvesIncludedInPass;
00121 curvesIncludedInPass << curve;
00122 ENGAUGE_ASSERT (curvesIncludedInPass.count () == CURVE_COUNT_PER_PASS);
00123
00124 QVector<QVector<QString*> > xThetaYRadiusValuesOne (COLUMNS_PER_CURVE * CURVE_COUNT_PER_PASS, QVector<QString*> (maxColumnSize));
00125
00126 initializeXThetaYRadiusValues (curvesIncludedInPass,
00127 xThetaYRadiusValuesOne);
00128 loadXThetaYRadiusValues (modelExportOverride,
00129 document,
00130 modelMainWindow,
00131 curvesIncludedInPass,
00132 transformation,
00133 isLogXTheta,
00134 isLogYRadius,
00135 xThetaYRadiusValuesOne);
00136
00137
00138 for (int row = 0; row < maxColumnSize; row++) {
00139 *(xThetaYRadiusValuesAll [colX] [row]) = *(xThetaYRadiusValuesOne [0] [row]);
00140 *(xThetaYRadiusValuesAll [colY] [row]) = *(xThetaYRadiusValuesOne [1] [row]);
00141 }
00142
00143 destroy2DArray (xThetaYRadiusValuesOne);
00144
00145 colX += 2;
00146 colY += 2;
00147 }
00148
00149 outputXThetaYRadiusValues (modelExportOverride,
00150 curvesIncluded,
00151 xThetaYRadiusValuesAll,
00152 delimiter,
00153 str,
00154 numWritesSoFar);
00155 destroy2DArray (xThetaYRadiusValuesAll);
00156 }
00157
00158 void ExportFileRelations::exportAllPerLineXThetaValuesMergedOnePass (int maxColumnSize,
00159 const DocumentModelExportFormat &modelExportOverride,
00160 const Document &document,
00161 const MainWindowModel &modelMainWindow,
00162 const QStringList &curvesIncluded,
00163 const QString &delimiter,
00164 const Transformation &transformation,
00165 bool isLogXTheta,
00166 bool isLogYRadius,
00167 QTextStream &str,
00168 unsigned int &numWritesSoFar) const
00169 {
00170 int curveCount = curvesIncluded.count ();
00171
00172 QVector<QVector<QString*> > xThetaYRadiusValues (COLUMNS_PER_CURVE * curveCount, QVector<QString*> (maxColumnSize));
00173 initializeXThetaYRadiusValues (curvesIncluded,
00174 xThetaYRadiusValues);
00175 loadXThetaYRadiusValues (modelExportOverride,
00176 document,
00177 modelMainWindow,
00178 curvesIncluded,
00179 transformation,
00180 isLogXTheta,
00181 isLogYRadius,
00182 xThetaYRadiusValues);
00183 outputXThetaYRadiusValues (modelExportOverride,
00184 curvesIncluded,
00185 xThetaYRadiusValues,
00186 delimiter,
00187 str,
00188 numWritesSoFar);
00189 destroy2DArray (xThetaYRadiusValues);
00190 }
00191
00192 void ExportFileRelations::exportOnePerLineXThetaValuesMerged (const DocumentModelExportFormat &modelExportOverride,
00193 const Document &document,
00194 const MainWindowModel &modelMainWindow,
00195 const QStringList &curvesIncluded,
00196 const QString &delimiter,
00197 const Transformation &transformation,
00198 bool isLogXTheta,
00199 bool isLogYRadius,
00200 QTextStream &str,
00201 unsigned int &numWritesSoFar) const
00202 {
00203 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::exportOnePerLineXThetaValuesMerged";
00204
00205 QStringList::const_iterator itr;
00206 for (itr = curvesIncluded.begin(); itr != curvesIncluded.end(); itr++) {
00207
00208 QString curveIncluded = *itr;
00209
00210 exportAllPerLineXThetaValuesMerged (modelExportOverride,
00211 document,
00212 modelMainWindow,
00213 QStringList (curveIncluded),
00214 delimiter,
00215 transformation,
00216 isLogXTheta,
00217 isLogYRadius,
00218 str,
00219 numWritesSoFar);
00220 }
00221 }
00222
00223 void ExportFileRelations::exportToFile (const DocumentModelExportFormat &modelExportOverride,
00224 const Document &document,
00225 const MainWindowModel &modelMainWindow,
00226 const Transformation &transformation,
00227 QTextStream &str,
00228 unsigned int &numWritesSoFar) const
00229 {
00230 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::exportToFile";
00231
00232
00233 bool isLogXTheta = (document.modelCoords().coordScaleXTheta() == COORD_SCALE_LOG);
00234 bool isLogYRadius = (document.modelCoords().coordScaleYRadius() == COORD_SCALE_LOG);
00235
00236
00237 QStringList curvesIncluded = curvesToInclude (modelExportOverride,
00238 document,
00239 document.curvesGraphsNames(),
00240 CONNECT_AS_RELATION_SMOOTH,
00241 CONNECT_AS_RELATION_STRAIGHT);
00242
00243
00244 const QString delimiter = exportDelimiterToText (modelExportOverride.delimiter(),
00245 modelExportOverride.header() == EXPORT_HEADER_GNUPLOT);
00246
00247
00248 if (modelExportOverride.layoutFunctions() == EXPORT_LAYOUT_ALL_PER_LINE) {
00249 exportAllPerLineXThetaValuesMerged (modelExportOverride,
00250 document,
00251 modelMainWindow,
00252 curvesIncluded,
00253 delimiter,
00254 transformation,
00255 isLogXTheta,
00256 isLogYRadius,
00257 str,
00258 numWritesSoFar);
00259 } else {
00260 exportOnePerLineXThetaValuesMerged (modelExportOverride,
00261 document,
00262 modelMainWindow,
00263 curvesIncluded,
00264 delimiter,
00265 transformation,
00266 isLogXTheta,
00267 isLogYRadius,
00268 str,
00269 numWritesSoFar);
00270 }
00271 }
00272
00273 void ExportFileRelations::initializeXThetaYRadiusValues (const QStringList &curvesIncluded,
00274 QVector<QVector<QString*> > &xThetaYRadiusValues) const
00275 {
00276 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::initializeXThetaYRadiusValues";
00277
00278
00279 int curveCount = curvesIncluded.count();
00280 int xThetaCount = xThetaYRadiusValues [0].count();
00281 for (int row = 0; row < xThetaCount; row++) {
00282 for (int col = 0; col < COLUMNS_PER_CURVE * curveCount; col++) {
00283 xThetaYRadiusValues [col] [row] = new QString;
00284 }
00285 }
00286 }
00287
00288 QPointF ExportFileRelations::linearlyInterpolate (const Points &points,
00289 double ordinal,
00290 const Transformation &transformation) const
00291 {
00292
00293
00294 double xTheta = 0, yRadius = 0;
00295 double ordinalBefore = 0;
00296 QPointF posGraphBefore;
00297 bool foundIt = false;
00298 for (int ip = 0; ip < points.count(); ip++) {
00299
00300 const Point &point = points.at (ip);
00301 QPointF posGraph;
00302 transformation.transformScreenToRawGraph (point.posScreen(),
00303 posGraph);
00304
00305 if (ordinal <= point.ordinal()) {
00306
00307 foundIt = true;
00308 if (ip == 0) {
00309
00310
00311 xTheta = posGraph.x();
00312 yRadius = posGraph.y();
00313
00314 } else {
00315
00316
00317
00318 double s = (ordinal - ordinalBefore) / (point.ordinal() - ordinalBefore);
00319 xTheta = (1.0 - s) * posGraphBefore.x() + s * posGraph.x();
00320 yRadius = (1.0 - s) * posGraphBefore.y() + s * posGraph.y();
00321 }
00322
00323 break;
00324 }
00325
00326 ordinalBefore = point.ordinal();
00327 posGraphBefore = posGraph;
00328 }
00329
00330 if (!foundIt) {
00331
00332
00333 xTheta = posGraphBefore.x();
00334 yRadius = posGraphBefore.y();
00335
00336 }
00337
00338 return QPointF (xTheta,
00339 yRadius);
00340 }
00341
00342 void ExportFileRelations::loadXThetaYRadiusValues (const DocumentModelExportFormat &modelExportOverride,
00343 const Document &document,
00344 const MainWindowModel &modelMainWindow,
00345 const QStringList &curvesIncluded,
00346 const Transformation &transformation,
00347 bool isLogXTheta,
00348 bool isLogYRadius,
00349 QVector<QVector<QString*> > &xThetaYRadiusValues) const
00350 {
00351 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::loadXThetaYRadiusValues";
00352
00353
00354 for (int ic = 0; ic < curvesIncluded.count(); ic++) {
00355
00356 int colXTheta = 2 * ic;
00357 int colYRadius = 2 * ic + 1;
00358
00359 const QString curveName = curvesIncluded.at (ic);
00360
00361 const Curve *curve = document.curveForCurveName (curveName);
00362 const Points points = curve->points ();
00363
00364 if (modelExportOverride.pointsSelectionRelations() == EXPORT_POINTS_SELECTION_RELATIONS_RAW) {
00365
00366
00367 loadXThetaYRadiusValuesForCurveRaw (document.modelCoords(),
00368 document.modelGeneral(),
00369 modelMainWindow,
00370 points,
00371 xThetaYRadiusValues [colXTheta],
00372 xThetaYRadiusValues [colYRadius],
00373 transformation);
00374 } else {
00375
00376 const LineStyle &lineStyle = document.modelCurveStyles().lineStyle(curveName);
00377
00378
00379 ExportValuesOrdinal ordinals = ordinalsAtIntervals (modelExportOverride.pointsIntervalRelations(),
00380 modelExportOverride.pointsIntervalUnitsRelations(),
00381 lineStyle.curveConnectAs(),
00382 transformation,
00383 isLogXTheta,
00384 isLogYRadius,
00385 points);
00386
00387 if (curve->curveStyle().lineStyle().curveConnectAs() == CONNECT_AS_RELATION_SMOOTH) {
00388
00389 loadXThetaYRadiusValuesForCurveInterpolatedSmooth (document.modelCoords(),
00390 document.modelGeneral(),
00391 modelMainWindow,
00392 points,
00393 ordinals,
00394 xThetaYRadiusValues [colXTheta],
00395 xThetaYRadiusValues [colYRadius],
00396 transformation,
00397 isLogXTheta,
00398 isLogYRadius);
00399
00400 } else {
00401
00402 loadXThetaYRadiusValuesForCurveInterpolatedStraight (document.modelCoords(),
00403 document.modelGeneral(),
00404 modelMainWindow,
00405 points,
00406 ordinals,
00407 xThetaYRadiusValues [colXTheta],
00408 xThetaYRadiusValues [colYRadius],
00409 transformation);
00410 }
00411 }
00412 }
00413 }
00414
00415 void ExportFileRelations::loadXThetaYRadiusValuesForCurveInterpolatedSmooth (const DocumentModelCoords &modelCoords,
00416 const DocumentModelGeneral &modelGeneral,
00417 const MainWindowModel &modelMainWindow,
00418 const Points &points,
00419 const ExportValuesOrdinal &ordinals,
00420 QVector<QString*> &xThetaValues,
00421 QVector<QString*> &yRadiusValues,
00422 const Transformation &transformation,
00423 bool isLogXTheta,
00424 bool isLogYRadius) const
00425 {
00426 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::loadXThetaYRadiusValuesForCurveInterpolatedSmooth";
00427
00428 vector<double> t;
00429 vector<SplinePair> xy;
00430 ExportOrdinalsSmooth ordinalsSmooth;
00431
00432 ordinalsSmooth.loadSplinePairsWithTransformation (points,
00433 transformation,
00434 isLogXTheta,
00435 isLogYRadius,
00436 t,
00437 xy);
00438
00439
00440 if (xy.size() > 0) {
00441
00442
00443 Spline spline (t,
00444 xy);
00445
00446 FormatCoordsUnits format;
00447
00448
00449 for (int row = 0; row < ordinals.count(); row++) {
00450
00451 double ordinal = ordinals.at (row);
00452 SplinePair splinePairFound = spline.interpolateCoeff(ordinal);
00453 double xTheta = splinePairFound.x ();
00454 double yRadius = splinePairFound.y ();
00455
00456
00457 format.unformattedToFormatted (xTheta,
00458 yRadius,
00459 modelCoords,
00460 modelGeneral,
00461 modelMainWindow,
00462 *(xThetaValues [row]),
00463 *(yRadiusValues [row]),
00464 transformation);
00465 }
00466 }
00467 }
00468
00469 void ExportFileRelations::loadXThetaYRadiusValuesForCurveInterpolatedStraight (const DocumentModelCoords &modelCoords,
00470 const DocumentModelGeneral &modelGeneral,
00471 const MainWindowModel &modelMainWindow,
00472 const Points &points,
00473 const ExportValuesOrdinal &ordinals,
00474 QVector<QString*> &xThetaValues,
00475 QVector<QString*> &yRadiusValues,
00476 const Transformation &transformation) const
00477 {
00478 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::loadXThetaYRadiusValuesForCurveInterpolatedStraight";
00479
00480 FormatCoordsUnits format;
00481
00482
00483 for (int row = 0; row < ordinals.count(); row++) {
00484
00485 double ordinal = ordinals.at (row);
00486
00487 QPointF pointInterpolated = linearlyInterpolate (points,
00488 ordinal,
00489 transformation);
00490
00491
00492 format.unformattedToFormatted (pointInterpolated.x(),
00493 pointInterpolated.y(),
00494 modelCoords,
00495 modelGeneral,
00496 modelMainWindow,
00497 *(xThetaValues [row]),
00498 *(yRadiusValues [row]),
00499 transformation);
00500 }
00501 }
00502
00503 void ExportFileRelations::loadXThetaYRadiusValuesForCurveRaw (const DocumentModelCoords &modelCoords,
00504 const DocumentModelGeneral &modelGeneral,
00505 const MainWindowModel &modelMainWindow,
00506 const Points &points,
00507 QVector<QString*> &xThetaValues,
00508 QVector<QString*> &yRadiusValues,
00509 const Transformation &transformation) const
00510 {
00511 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::loadXThetaYRadiusValuesForCurveRaw";
00512
00513 FormatCoordsUnits format;
00514
00515 for (int pt = 0; pt < points.count(); pt++) {
00516
00517 const Point &point = points.at (pt);
00518
00519 QPointF posGraph;
00520 transformation.transformScreenToRawGraph (point.posScreen(),
00521 posGraph);
00522
00523
00524 format.unformattedToFormatted (posGraph.x(),
00525 posGraph.y(),
00526 modelCoords,
00527 modelGeneral,
00528 modelMainWindow,
00529 *(xThetaValues [pt]),
00530 *(yRadiusValues [pt]),
00531 transformation);
00532 }
00533 }
00534
00535 int ExportFileRelations::maxColumnSizeAllocation (const DocumentModelExportFormat &modelExport,
00536 const Document &document,
00537 const Transformation &transformation,
00538 bool isLogXTheta,
00539 bool isLogYRadius,
00540 const QStringList &curvesIncluded) const
00541 {
00542 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::maxColumnSizeAllocation";
00543
00544 int maxColumnSize = 0;
00545
00546
00547 for (int ic = 0; ic < curvesIncluded.count(); ic++) {
00548
00549 const QString curveName = curvesIncluded.at (ic);
00550
00551 const Curve *curve = document.curveForCurveName (curveName);
00552 const Points points = curve->points ();
00553
00554 if (modelExport.pointsSelectionRelations() == EXPORT_POINTS_SELECTION_RELATIONS_RAW) {
00555
00556
00557 maxColumnSize = qMax (maxColumnSize,
00558 points.count());
00559
00560 } else {
00561
00562 const LineStyle &lineStyle = document.modelCurveStyles().lineStyle(curveName);
00563
00564
00565
00566 ExportValuesOrdinal ordinals = ordinalsAtIntervals (modelExport.pointsIntervalRelations(),
00567 modelExport.pointsIntervalUnitsRelations(),
00568 lineStyle.curveConnectAs(),
00569 transformation,
00570 isLogXTheta,
00571 isLogYRadius,
00572 points);
00573
00574 maxColumnSize = qMax (maxColumnSize,
00575 ordinals.count());
00576 }
00577 }
00578
00579 return maxColumnSize;
00580 }
00581
00582 ExportValuesOrdinal ExportFileRelations::ordinalsAtIntervals (double pointsIntervalRelations,
00583 ExportPointsIntervalUnits pointsIntervalUnits,
00584 CurveConnectAs curveConnectAs,
00585 const Transformation &transformation,
00586 bool isLogXTheta,
00587 bool isLogYRadius,
00588 const Points &points) const
00589 {
00590 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::ordinalsAtIntervals";
00591
00592 if (pointsIntervalUnits == EXPORT_POINTS_INTERVAL_UNITS_GRAPH) {
00593 if (curveConnectAs == CONNECT_AS_RELATION_SMOOTH) {
00594
00595 return ordinalsAtIntervalsSmoothGraph (pointsIntervalRelations,
00596 transformation,
00597 isLogXTheta,
00598 isLogYRadius,
00599 points);
00600
00601 } else {
00602
00603 return ordinalsAtIntervalsStraightGraph (pointsIntervalRelations,
00604 transformation,
00605 points);
00606
00607 }
00608 } else {
00609
00610 if (curveConnectAs == CONNECT_AS_RELATION_SMOOTH) {
00611
00612 return ordinalsAtIntervalsSmoothScreen (pointsIntervalRelations,
00613 points);
00614
00615 } else {
00616
00617 return ordinalsAtIntervalsStraightScreen (pointsIntervalRelations,
00618 points);
00619
00620 }
00621 }
00622 }
00623
00624 ExportValuesOrdinal ExportFileRelations::ordinalsAtIntervalsSmoothGraph (double pointsIntervalRelations,
00625 const Transformation &transformation,
00626 bool isLogXTheta,
00627 bool isLogYRadius,
00628 const Points &points) const
00629 {
00630 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::ordinalsAtIntervalsSmoothGraph";
00631
00632 ExportValuesOrdinal ordinals;
00633
00634
00635 if ((pointsIntervalRelations > 0) &&
00636 (points.count() > 0)) {
00637
00638 vector<double> t;
00639 vector<SplinePair> xy;
00640 ExportOrdinalsSmooth ordinalsSmooth;
00641
00642 ordinalsSmooth.loadSplinePairsWithTransformation (points,
00643 transformation,
00644 isLogXTheta,
00645 isLogYRadius,
00646 t,
00647 xy);
00648
00649 ordinals = ordinalsSmooth.ordinalsAtIntervalsGraph (t,
00650 xy,
00651 pointsIntervalRelations);
00652 }
00653
00654 return ordinals;
00655 }
00656
00657 ExportValuesOrdinal ExportFileRelations::ordinalsAtIntervalsSmoothScreen (double pointsIntervalRelations,
00658 const Points &points) const
00659 {
00660 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::ordinalsAtIntervalsSmoothScreen"
00661 << " pointCount=" << points.count();
00662
00663
00664 ExportValuesOrdinal ordinals;
00665
00666
00667 if ((pointsIntervalRelations > 0) &&
00668 (points.count() > 0)) {
00669
00670 vector<double> t;
00671 vector<SplinePair> xy;
00672 ExportOrdinalsSmooth ordinalsSmooth;
00673
00674 ordinalsSmooth.loadSplinePairsWithoutTransformation (points,
00675 t,
00676 xy);
00677
00678 ordinals = ordinalsSmooth.ordinalsAtIntervalsGraph (t,
00679 xy,
00680 pointsIntervalRelations);
00681 }
00682
00683 return ordinals;
00684 }
00685
00686 ExportValuesOrdinal ExportFileRelations::ordinalsAtIntervalsStraightGraph (double pointsIntervalRelations,
00687 const Transformation &transformation,
00688 const Points &points) const
00689 {
00690 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::ordinalsAtIntervalsStraightGraph";
00691
00692 ExportValuesOrdinal ordinals;
00693
00694
00695 if ((pointsIntervalRelations > 0) &&
00696 (points.count() > 0)) {
00697
00698 ExportOrdinalsStraight ordinalsStraight;
00699
00700 ordinals = ordinalsStraight.ordinalsAtIntervalsGraphWithTransformation (points,
00701 transformation,
00702 pointsIntervalRelations);
00703 }
00704
00705 return ordinals;
00706 }
00707
00708 ExportValuesOrdinal ExportFileRelations::ordinalsAtIntervalsStraightScreen (double pointsIntervalRelations,
00709 const Points &points) const
00710 {
00711 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::ordinalsAtIntervalsStraightScreen"
00712 << " pointCount=" << points.count();
00713
00714
00715 ExportValuesOrdinal ordinals;
00716
00717
00718 if ((pointsIntervalRelations > 0) &&
00719 (points.count() > 0)) {
00720
00721 ExportOrdinalsStraight ordinalsStraight;
00722
00723 ordinals = ordinalsStraight.ordinalsAtIntervalsGraphWithoutTransformation (points,
00724 pointsIntervalRelations);
00725 }
00726
00727 return ordinals;
00728 }
00729
00730 void ExportFileRelations::outputXThetaYRadiusValues (const DocumentModelExportFormat &modelExportOverride,
00731 const QStringList &curvesIncluded,
00732 QVector<QVector<QString*> > &xThetaYRadiusValues,
00733 const QString &delimiter,
00734 QTextStream &str,
00735 unsigned int &numWritesSoFar) const
00736 {
00737 LOG4CPP_INFO_S ((*mainCat)) << "ExportFileRelations::outputXThetaYRadiusValues";
00738
00739
00740 if (modelExportOverride.header() != EXPORT_HEADER_NONE) {
00741 insertLineSeparator (numWritesSoFar == 0,
00742 modelExportOverride.header (),
00743 str);
00744 if (modelExportOverride.header() == EXPORT_HEADER_GNUPLOT) {
00745 str << gnuplotComment();
00746 }
00747 QString delimiterForRow;
00748 QStringList::const_iterator itr;
00749 for (itr = curvesIncluded.begin(); itr != curvesIncluded.end(); itr++) {
00750 QString curveName = *itr;
00751 str << delimiterForRow << modelExportOverride.xLabel();
00752 delimiterForRow = delimiter;
00753 str << delimiterForRow << curveName;
00754 }
00755 str << "\n";
00756 }
00757
00758
00759 for (int row = 0; row < xThetaYRadiusValues [0].count(); row++) {
00760
00761 QString delimiterForRow;
00762 for (int col = 0; col < xThetaYRadiusValues.count(); col++) {
00763
00764 QString xThetaString = *(xThetaYRadiusValues [col] [row]);
00765 str << delimiterForRow << wrapInDoubleQuotesIfNeeded (modelExportOverride,
00766 xThetaString);
00767 delimiterForRow = delimiter;
00768 }
00769
00770 str << "\n";
00771 }
00772
00773 ++numWritesSoFar;
00774 }