Engauge Digitizer  2
DlgValidatorFactory.cpp
1 #include "DlgValidatorAbstract.h"
2 #include "DlgValidatorDateTime.h"
3 #include "DlgValidatorDegreesMinutesSeconds.h"
4 #include "DlgValidatorFactory.h"
5 #include "DlgValidatorNumber.h"
6 #include "Logger.h"
7 
9 {
10  LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorFactory::DlgValidatorFactory";
11 }
12 
14  CoordUnitsNonPolarTheta coordUnits,
15  CoordUnitsDate coordUnitsDate,
16  CoordUnitsTime coordUnitsTime) const
17 {
18  LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorFactory::createWithNonPolar";
19 
20  switch (coordUnits) {
21  case COORD_UNITS_NON_POLAR_THETA_DATE_TIME:
22  return new DlgValidatorDateTime (coordScale,
23  coordUnitsDate,
24  coordUnitsTime);
25 
26  case COORD_UNITS_NON_POLAR_THETA_DEGREES_MINUTES_SECONDS:
27  return new DlgValidatorDegreesMinutesSeconds (coordScale);
28 
29  case COORD_UNITS_NON_POLAR_THETA_NUMBER:
30  return new DlgValidatorNumber(coordScale);
31 
32  default:
33  LOG4CPP_ERROR_S ((*mainCat)) << "DlgValidatorFactory::createWithNonPolar";
34  exit (-1);
35  }
36 }
37 
39  CoordUnitsPolarTheta coordUnits) const
40 {
41  LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorFactory::createWithPolar";
42 
43  switch (coordUnits) {
44  case COORD_UNITS_POLAR_THETA_DEGREES:
45  case COORD_UNITS_POLAR_THETA_DEGREES_MINUTES:
46  case COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS:
47  case COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS_NSEW:
48  return new DlgValidatorDegreesMinutesSeconds (coordScale);
49 
50  case COORD_UNITS_POLAR_THETA_GRADIANS:
51  case COORD_UNITS_POLAR_THETA_RADIANS:
52  case COORD_UNITS_POLAR_THETA_TURNS:
53  return new DlgValidatorNumber (coordScale);
54 
55  default:
56  LOG4CPP_ERROR_S ((*mainCat)) << "DlgValidatorFactory::createWithNonPolar";
57  exit (-1);
58  }
59 }
60 
62  bool isCartesian,
63  CoordUnitsNonPolarTheta coordUnitsCartesian,
64  CoordUnitsNonPolarTheta coordUnitsPolar,
65  CoordUnitsDate coordUnitsDate,
66  CoordUnitsTime coordUnitsTime) const
67 {
68  LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorFactory::createCartesianOrPolarWithNonPolarPolar";
69 
70  if (isCartesian) {
71  return createWithNonPolar (coordScale,
72  coordUnitsCartesian,
73  coordUnitsDate,
74  coordUnitsTime);
75  } else {
76  return createWithNonPolar (coordScale,
77  coordUnitsPolar,
78  coordUnitsDate,
79  coordUnitsTime);
80  }
81 }
82 
84  bool isCartesian,
85  CoordUnitsNonPolarTheta coordUnitsCartesian,
86  CoordUnitsPolarTheta coordUnitsPolar,
87  CoordUnitsDate coordUnitsDate,
88  CoordUnitsTime coordUnitsTime) const
89 {
90  LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorFactory::createCartesianOrPolarWithPolarPolar";
91 
92  if (isCartesian) {
93  return createWithNonPolar (coordScale,
94  coordUnitsCartesian,
95  coordUnitsDate,
96  coordUnitsTime);
97  } else {
98  return createWithPolar (coordScale,
99  coordUnitsPolar);
100  }
101 }
Validator for numeric value expressed as date and/or time.
DlgValidatorAbstract * createCartesianOrPolarWithPolarPolar(CoordScale coordScale, bool isCartesian, CoordUnitsNonPolarTheta coordUnitsCartesian, CoordUnitsPolarTheta coordUnitsPolar, CoordUnitsDate coordUnitsDate, CoordUnitsTime coordUnitsTime) const
Factory method for generating validators for either cartesian or polar case, when polar format is spe...
DlgValidatorFactory()
Single constructor.
DlgValidatorAbstract * createWithPolar(CoordScale coordScale, CoordUnitsPolarTheta coordUnits) const
Factory method for generating validators when cartesian/polar case handling is handled externally...
Abstract validator for all numeric formats.
Validator for angles in real degrees, integer degrees and real minutes, or integer degrees with integ...
DlgValidatorAbstract * createCartesianOrPolarWithNonPolarPolar(CoordScale coordScale, bool isCartesian, CoordUnitsNonPolarTheta coordUnitsCartesian, CoordUnitsNonPolarTheta coordUnitsPolar, CoordUnitsDate coordUnitsDate, CoordUnitsTime coordUnitsTime) const
Factory method for generating validators for either cartesian or polar case, when polar format is spe...
DlgValidatorAbstract * createWithNonPolar(CoordScale coordScale, CoordUnitsNonPolarTheta coordUnits, CoordUnitsDate coordUnitsDate, CoordUnitsTime coordUnitsTime) const
Factory method for generating validators when cartesian/polar case handling is handled externally...
Validator for generic (=simple) numbers.