Engauge Digitizer  2
 All Classes Functions Variables Typedefs Enumerations Friends Pages
GeometryStrategyContext.cpp
1 /******************************************************************************************************
2  * (C) 2016 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #include "CurveConnectAs.h"
8 #include "DocumentModelCoords.h"
9 #include "DocumentModelGeneral.h"
10 #include "GeometryStrategyContext.h"
11 #include "GeometryStrategyFunctionSmooth.h"
12 #include "GeometryStrategyFunctionStraight.h"
13 #include "GeometryStrategyRelationSmooth.h"
14 #include "GeometryStrategyRelationStraight.h"
15 #include "Transformation.h"
16 
18 {
19  m_strategies.insert (CONNECT_AS_FUNCTION_SMOOTH , new GeometryStrategyFunctionSmooth ());
20  m_strategies.insert (CONNECT_AS_FUNCTION_STRAIGHT, new GeometryStrategyFunctionStraight ());
21  m_strategies.insert (CONNECT_AS_RELATION_SMOOTH , new GeometryStrategyRelationSmooth ());
22  m_strategies.insert (CONNECT_AS_RELATION_STRAIGHT, new GeometryStrategyRelationStraight ());
23 }
24 
25 GeometryStrategyContext::~GeometryStrategyContext()
26 {
27 }
28 
29 void GeometryStrategyContext::calculateGeometry (const Points &points,
30  const DocumentModelCoords &modelCoords,
31  const DocumentModelGeneral &modelGeneral,
32  const MainWindowModel &modelMainWindow,
33  const Transformation &transformation,
34  CurveConnectAs connectAs,
35  QString &funcArea,
36  QString &polyArea,
37  QVector<QString> &x,
38  QVector<QString> &y,
39  QVector<bool> &isPotentialExportAmbiguity,
40  QVector<QString> &distanceGraphForward,
41  QVector<QString> &distancePercentForward,
42  QVector<QString> &distanceGraphBackward,
43  QVector<QString> &distancePercentBackward) const
44 {
45  if (transformation.transformIsDefined()) {
46 
47  m_strategies [connectAs]->calculateGeometry (points,
48  modelCoords,
49  modelGeneral,
50  modelMainWindow,
51  transformation,
52  funcArea,
53  polyArea,
54  x,
55  y,
56  isPotentialExportAmbiguity,
57  distanceGraphForward,
58  distancePercentForward,
59  distanceGraphBackward,
60  distancePercentBackward);
61  }
62 }
Model for DlgSettingsGeneral and CmdSettingsGeneral.
void calculateGeometry(const Points &points, const DocumentModelCoords &modelCoords, const DocumentModelGeneral &modelGeneral, const MainWindowModel &modelMainWindow, const Transformation &transformation, CurveConnectAs connectAs, QString &funcArea, QString &polyArea, QVector< QString > &x, QVector< QString > &y, QVector< bool > &isPotentialExportAmbiguity, QVector< QString > &distanceGraphForward, QVector< QString > &distancePercentForward, QVector< QString > &distanceGraphBackward, QVector< QString > &distancePercentBackward) const
Calculate geometry parameters.
Calculate for line through the points that is smoothly connected as a function.
Calculate for line through the points that is straightly connected as a function. ...
GeometryStrategyContext()
Single constructor.
Calculate for line through the points that is smoothly connected as a relation.
Affine transformation between screen and graph coordinates, based on digitized axis points...
Calculate for line through the points that is straightly connected as a relation. ...
Model for DlgSettingsMainWindow.
Model for DlgSettingsCoords and CmdSettingsCoords.
bool transformIsDefined() const
Transform is defined when at least three axis points have been digitized.