00001
00002
00003
00004
00005
00006
00007 #include "DlgValidatorAboveZero.h"
00008 #include "DlgValidatorAbstract.h"
00009 #include "DlgValidatorDateTime.h"
00010 #include "DlgValidatorDegreesMinutesSeconds.h"
00011 #include "DlgValidatorFactory.h"
00012 #include "DlgValidatorNumber.h"
00013 #include "Logger.h"
00014 #include <QLocale>
00015
00016 DlgValidatorFactory::DlgValidatorFactory()
00017 {
00018 LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorFactory::DlgValidatorFactory";
00019 }
00020
00021 DlgValidatorAbstract *DlgValidatorFactory::createAboveZero (const QLocale &locale) const
00022 {
00023 return new DlgValidatorAboveZero (locale);
00024 }
00025
00026 DlgValidatorAbstract *DlgValidatorFactory::createCartesianOrPolarWithNonPolarPolar (CoordScale coordScale,
00027 bool isCartesian,
00028 CoordUnitsNonPolarTheta coordUnitsCartesian,
00029 CoordUnitsNonPolarTheta coordUnitsPolar,
00030 CoordUnitsDate coordUnitsDate,
00031 CoordUnitsTime coordUnitsTime,
00032 const QLocale &locale) const
00033 {
00034 LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorFactory::createCartesianOrPolarWithNonPolarPolar";
00035
00036 if (isCartesian) {
00037 return createWithNonPolar (coordScale,
00038 coordUnitsCartesian,
00039 coordUnitsDate,
00040 coordUnitsTime,
00041 locale);
00042 } else {
00043 return createWithNonPolar (coordScale,
00044 coordUnitsPolar,
00045 coordUnitsDate,
00046 coordUnitsTime,
00047 locale);
00048 }
00049 }
00050
00051 DlgValidatorAbstract *DlgValidatorFactory::createCartesianOrPolarWithPolarPolar (CoordScale coordScale,
00052 bool isCartesian,
00053 CoordUnitsNonPolarTheta coordUnitsCartesian,
00054 CoordUnitsPolarTheta coordUnitsPolar,
00055 CoordUnitsDate coordUnitsDate,
00056 CoordUnitsTime coordUnitsTime,
00057 const QLocale &locale) const
00058 {
00059 LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorFactory::createCartesianOrPolarWithPolarPolar";
00060
00061 if (isCartesian) {
00062 return createWithNonPolar (coordScale,
00063 coordUnitsCartesian,
00064 coordUnitsDate,
00065 coordUnitsTime,
00066 locale);
00067 } else {
00068 return createWithPolar (coordScale,
00069 coordUnitsPolar,
00070 locale);
00071 }
00072 }
00073
00074 DlgValidatorAbstract *DlgValidatorFactory::createWithNonPolar (CoordScale coordScale,
00075 CoordUnitsNonPolarTheta coordUnits,
00076 CoordUnitsDate coordUnitsDate,
00077 CoordUnitsTime coordUnitsTime,
00078 const QLocale &locale) const
00079 {
00080 LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorFactory::createWithNonPolar";
00081
00082 switch (coordUnits) {
00083 case COORD_UNITS_NON_POLAR_THETA_DATE_TIME:
00084 return new DlgValidatorDateTime (coordScale,
00085 coordUnitsDate,
00086 coordUnitsTime);
00087
00088 case COORD_UNITS_NON_POLAR_THETA_DEGREES_MINUTES_SECONDS:
00089 return new DlgValidatorDegreesMinutesSeconds (coordScale);
00090
00091 case COORD_UNITS_NON_POLAR_THETA_NUMBER:
00092 return new DlgValidatorNumber(coordScale,
00093 locale);
00094
00095 default:
00096 LOG4CPP_ERROR_S ((*mainCat)) << "DlgValidatorFactory::createWithNonPolar";
00097 exit (-1);
00098 }
00099 }
00100
00101 DlgValidatorAbstract *DlgValidatorFactory::createWithPolar (CoordScale coordScale,
00102 CoordUnitsPolarTheta coordUnits,
00103 const QLocale &locale) const
00104 {
00105 LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorFactory::createWithPolar";
00106
00107 switch (coordUnits) {
00108 case COORD_UNITS_POLAR_THETA_DEGREES:
00109 case COORD_UNITS_POLAR_THETA_DEGREES_MINUTES:
00110 case COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS:
00111 case COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS_NSEW:
00112 return new DlgValidatorDegreesMinutesSeconds (coordScale);
00113
00114 case COORD_UNITS_POLAR_THETA_GRADIANS:
00115 case COORD_UNITS_POLAR_THETA_RADIANS:
00116 case COORD_UNITS_POLAR_THETA_TURNS:
00117 return new DlgValidatorNumber (coordScale,
00118 locale);
00119
00120 default:
00121 LOG4CPP_ERROR_S ((*mainCat)) << "DlgValidatorFactory::createWithNonPolar";
00122 exit (-1);
00123 }
00124 }