50 case DU_nautical_miles:
53 case DU_statute_miles:
59 nout <<
"**unexpected DistanceUnit value: (" << (int)unit <<
")**";
90 case DU_nautical_miles:
91 return "nautical miles";
93 case DU_statute_miles:
99 nout <<
"**unexpected DistanceUnit value: (" << (int)unit <<
")**";
119 if (unit == DU_invalid) {
120 pandatoolbase_cat->error()
121 <<
"Invalid distance unit: " << word <<
"\n";
132 if (cmp_nocase(str,
"mm") == 0 || cmp_nocase(str,
"millimeters") == 0) {
133 return DU_millimeters;
135 }
else if (cmp_nocase(str,
"cm") == 0 || cmp_nocase(str,
"centimeters") == 0) {
136 return DU_centimeters;
138 }
else if (cmp_nocase(str,
"m") == 0 || cmp_nocase(str,
"meters") == 0) {
141 }
else if (cmp_nocase(str,
"km") == 0 || cmp_nocase(str,
"kilometers") == 0) {
142 return DU_kilometers;
144 }
else if (cmp_nocase(str,
"yd") == 0 || cmp_nocase(str,
"yards") == 0) {
147 }
else if (cmp_nocase(str,
"ft") == 0 || cmp_nocase(str,
"feet") == 0) {
150 }
else if (cmp_nocase(str,
"in") == 0 || cmp_nocase(str,
"inches") == 0) {
153 }
else if (cmp_nocase(str,
"nmi") == 0 ||
154 cmp_nocase(str,
"nm") == 0 ||
155 cmp_nocase_uh(str,
"nautical_miles") == 0) {
156 return DU_nautical_miles;
158 }
else if (cmp_nocase(str,
"mi") == 0 ||
159 cmp_nocase(str,
"miles") == 0 ||
160 cmp_nocase_uh(str,
"statute_miles") == 0) {
161 return DU_statute_miles;
187 return 3.0 * 12.0 * 2.54;
195 case DU_nautical_miles:
199 case DU_statute_miles:
200 return 5280.0 * 12.0 * 2.54;
214 return unit_scale(from) / unit_scale(to);
string format_long_unit(DistanceUnit unit)
Returns the string representing the full name (plural) for the given unit.
string format_abbrev_unit(DistanceUnit unit)
Returns the string representing the common abbreviation for the given unit.
double convert_units(DistanceUnit from, DistanceUnit to)
Returns the scaling factor that must be applied to convert from units of "from" to "to".
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DistanceUnit
This enumerated type lists all the kinds of units we're likely to come across in model conversion pro...
DistanceUnit string_distance_unit(const string &str)
Converts from a string, as might be input by the user, to one of the known DistanceUnit types.