Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Dlg
DlgValidatorFactory.cpp
Go to the documentation of this file.
1
/******************************************************************************************************
2
* (C) 2014 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 "
DlgValidatorAboveZero.h
"
8
#include "
DlgValidatorAbstract.h
"
9
#include "
DlgValidatorDateTime.h
"
10
#include "
DlgValidatorDegreesMinutesSeconds.h
"
11
#include "
DlgValidatorFactory.h
"
12
#include "
DlgValidatorNumber.h
"
13
#include "
Logger.h
"
14
#include <QLocale>
15
16
DlgValidatorFactory::DlgValidatorFactory
()
17
{
18
qCInfo(ENGAUGE_LOG) <<
"DlgValidatorFactory::DlgValidatorFactory"
;
19
}
20
21
DlgValidatorAbstract
*
DlgValidatorFactory::createAboveZero
(
const
QLocale &locale)
const
22
{
23
return
new
DlgValidatorAboveZero
(locale);
24
}
25
26
DlgValidatorAbstract
*
DlgValidatorFactory::createCartesianOrPolarWithNonPolarPolar
(
CoordScale
coordScale,
27
bool
isCartesian,
28
CoordUnitsNonPolarTheta
coordUnitsCartesian,
29
CoordUnitsNonPolarTheta
coordUnitsPolar,
30
CoordUnitsDate
coordUnitsDate,
31
CoordUnitsTime
coordUnitsTime,
32
const
QLocale &locale)
const
33
{
34
qCInfo(ENGAUGE_LOG) <<
"DlgValidatorFactory::createCartesianOrPolarWithNonPolarPolar"
;
35
36
if
(isCartesian) {
37
return
createWithNonPolar
(coordScale,
38
coordUnitsCartesian,
39
coordUnitsDate,
40
coordUnitsTime,
41
locale);
42
}
else
{
43
return
createWithNonPolar
(coordScale,
44
coordUnitsPolar,
45
coordUnitsDate,
46
coordUnitsTime,
47
locale);
48
}
49
}
50
51
DlgValidatorAbstract
*
DlgValidatorFactory::createCartesianOrPolarWithPolarPolar
(
CoordScale
coordScale,
52
bool
isCartesian,
53
CoordUnitsNonPolarTheta
coordUnitsCartesian,
54
CoordUnitsPolarTheta
coordUnitsPolar,
55
CoordUnitsDate
coordUnitsDate,
56
CoordUnitsTime
coordUnitsTime,
57
const
QLocale &locale)
const
58
{
59
qCInfo(ENGAUGE_LOG) <<
"DlgValidatorFactory::createCartesianOrPolarWithPolarPolar"
;
60
61
if
(isCartesian) {
62
return
createWithNonPolar
(coordScale,
63
coordUnitsCartesian,
64
coordUnitsDate,
65
coordUnitsTime,
66
locale);
67
}
else
{
68
return
createWithPolar
(coordScale,
69
coordUnitsPolar,
70
locale);
71
}
72
}
73
74
DlgValidatorAbstract
*
DlgValidatorFactory::createWithNonPolar
(
CoordScale
coordScale,
75
CoordUnitsNonPolarTheta
coordUnits,
76
CoordUnitsDate
coordUnitsDate,
77
CoordUnitsTime
coordUnitsTime,
78
const
QLocale &locale)
const
79
{
80
qCInfo(ENGAUGE_LOG) <<
"DlgValidatorFactory::createWithNonPolar"
;
81
82
switch
(coordUnits) {
83
case
COORD_UNITS_NON_POLAR_THETA_DATE_TIME
:
84
return
new
DlgValidatorDateTime
(coordScale,
85
coordUnitsDate,
86
coordUnitsTime);
87
88
case
COORD_UNITS_NON_POLAR_THETA_DEGREES_MINUTES_SECONDS
:
89
return
new
DlgValidatorDegreesMinutesSeconds
(coordScale);
90
91
case
COORD_UNITS_NON_POLAR_THETA_NUMBER
:
92
return
new
DlgValidatorNumber
(coordScale,
93
locale);
94
95
default
:
96
qCCritical(ENGAUGE_LOG) <<
"DlgValidatorFactory::createWithNonPolar"
;
97
exit (-1);
98
}
99
}
100
101
DlgValidatorAbstract
*
DlgValidatorFactory::createWithPolar
(
CoordScale
coordScale,
102
CoordUnitsPolarTheta
coordUnits,
103
const
QLocale &locale)
const
104
{
105
qCInfo(ENGAUGE_LOG) <<
"DlgValidatorFactory::createWithPolar"
;
106
107
switch
(coordUnits) {
108
case
COORD_UNITS_POLAR_THETA_DEGREES
:
109
case
COORD_UNITS_POLAR_THETA_DEGREES_MINUTES
:
110
case
COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS
:
111
case
COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS_NSEW
:
112
return
new
DlgValidatorDegreesMinutesSeconds
(coordScale);
113
114
case
COORD_UNITS_POLAR_THETA_GRADIANS
:
115
case
COORD_UNITS_POLAR_THETA_RADIANS
:
116
case
COORD_UNITS_POLAR_THETA_TURNS
:
117
return
new
DlgValidatorNumber
(coordScale,
118
locale);
119
120
default
:
121
qCCritical(ENGAUGE_LOG) <<
"DlgValidatorFactory::createWithNonPolar"
;
122
exit (-1);
123
}
124
}
CoordScale
CoordScale
Definition
CoordScale.h:12
CoordUnitsDate
CoordUnitsDate
Definition
CoordUnitsDate.h:12
CoordUnitsNonPolarTheta
CoordUnitsNonPolarTheta
Definition
CoordUnitsNonPolarTheta.h:14
COORD_UNITS_NON_POLAR_THETA_DEGREES_MINUTES_SECONDS
@ COORD_UNITS_NON_POLAR_THETA_DEGREES_MINUTES_SECONDS
Definition
CoordUnitsNonPolarTheta.h:16
COORD_UNITS_NON_POLAR_THETA_NUMBER
@ COORD_UNITS_NON_POLAR_THETA_NUMBER
Definition
CoordUnitsNonPolarTheta.h:15
COORD_UNITS_NON_POLAR_THETA_DATE_TIME
@ COORD_UNITS_NON_POLAR_THETA_DATE_TIME
Definition
CoordUnitsNonPolarTheta.h:18
CoordUnitsPolarTheta
CoordUnitsPolarTheta
Definition
CoordUnitsPolarTheta.h:14
COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS_NSEW
@ COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS_NSEW
Definition
CoordUnitsPolarTheta.h:18
COORD_UNITS_POLAR_THETA_TURNS
@ COORD_UNITS_POLAR_THETA_TURNS
Definition
CoordUnitsPolarTheta.h:21
COORD_UNITS_POLAR_THETA_RADIANS
@ COORD_UNITS_POLAR_THETA_RADIANS
Definition
CoordUnitsPolarTheta.h:20
COORD_UNITS_POLAR_THETA_DEGREES_MINUTES
@ COORD_UNITS_POLAR_THETA_DEGREES_MINUTES
Definition
CoordUnitsPolarTheta.h:16
COORD_UNITS_POLAR_THETA_DEGREES
@ COORD_UNITS_POLAR_THETA_DEGREES
Definition
CoordUnitsPolarTheta.h:15
COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS
@ COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS
Definition
CoordUnitsPolarTheta.h:17
COORD_UNITS_POLAR_THETA_GRADIANS
@ COORD_UNITS_POLAR_THETA_GRADIANS
Definition
CoordUnitsPolarTheta.h:19
CoordUnitsTime
CoordUnitsTime
Definition
CoordUnitsTime.h:12
DlgValidatorAboveZero.h
DlgValidatorAbstract.h
DlgValidatorDateTime.h
DlgValidatorDegreesMinutesSeconds.h
DlgValidatorFactory.h
DlgValidatorNumber.h
Logger.h
DlgValidatorAboveZero
Validator for generic (=simple) numbers that must be greater than zero.
Definition
DlgValidatorAboveZero.h:15
DlgValidatorAbstract
Abstract validator for all numeric formats.
Definition
DlgValidatorAbstract.h:15
DlgValidatorDateTime
Validator for numeric value expressed as date and/or time.
Definition
DlgValidatorDateTime.h:17
DlgValidatorDegreesMinutesSeconds
Validator for angles in real degrees, integer degrees and real minutes, or integer degrees with integ...
Definition
DlgValidatorDegreesMinutesSeconds.h:18
DlgValidatorFactory::createCartesianOrPolarWithPolarPolar
DlgValidatorAbstract * createCartesianOrPolarWithPolarPolar(CoordScale coordScale, bool isCartesian, CoordUnitsNonPolarTheta coordUnitsCartesian, CoordUnitsPolarTheta coordUnitsPolar, CoordUnitsDate coordUnitsDate, CoordUnitsTime coordUnitsTime, const QLocale &locale) const
Factory method for generating validators for either cartesian or polar case, when polar format is spe...
Definition
DlgValidatorFactory.cpp:51
DlgValidatorFactory::createWithNonPolar
DlgValidatorAbstract * createWithNonPolar(CoordScale coordScale, CoordUnitsNonPolarTheta coordUnits, CoordUnitsDate coordUnitsDate, CoordUnitsTime coordUnitsTime, const QLocale &locale) const
Factory method for generating validators when cartesian/polar case handling is handled externally,...
Definition
DlgValidatorFactory.cpp:74
DlgValidatorFactory::createAboveZero
DlgValidatorAbstract * createAboveZero(const QLocale &locale) const
Factory method for generating validators for scale length which must be a number greater than zero.
Definition
DlgValidatorFactory.cpp:21
DlgValidatorFactory::DlgValidatorFactory
DlgValidatorFactory()
Single constructor.
Definition
DlgValidatorFactory.cpp:16
DlgValidatorFactory::createWithPolar
DlgValidatorAbstract * createWithPolar(CoordScale coordScale, CoordUnitsPolarTheta coordUnits, const QLocale &locale) const
Factory method for generating validators when cartesian/polar case handling is handled externally,...
Definition
DlgValidatorFactory.cpp:101
DlgValidatorFactory::createCartesianOrPolarWithNonPolarPolar
DlgValidatorAbstract * createCartesianOrPolarWithNonPolarPolar(CoordScale coordScale, bool isCartesian, CoordUnitsNonPolarTheta coordUnitsCartesian, CoordUnitsNonPolarTheta coordUnitsPolar, CoordUnitsDate coordUnitsDate, CoordUnitsTime coordUnitsTime, const QLocale &locale) const
Factory method for generating validators for either cartesian or polar case, when polar format is spe...
Definition
DlgValidatorFactory.cpp:26
DlgValidatorNumber
Validator for generic (=simple) numbers.
Definition
DlgValidatorNumber.h:18
Generated on
for Engauge Digitizer by
1.17.0