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