Panda3D

Loading...
Searching...
No Matches
distanceUnit.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file distanceUnit.h
10 * @author drose
11 * @date 2001-04-17
12 */
13
14#ifndef DISTANCEUNIT_H
15#define DISTANCEUNIT_H
16
17#include "pandatoolbase.h"
18
19/**
20 * This enumerated type lists all the kinds of units we're likely to come
21 * across in model conversion programs.
22 */
23 enum DistanceUnit {
24 DU_millimeters,
25 DU_centimeters,
26 DU_meters,
27 DU_kilometers,
28 DU_yards,
29 DU_feet,
30 DU_inches,
31 DU_nautical_miles,
32 DU_statute_miles,
33 DU_invalid
34};
35
36std::string format_abbrev_unit(DistanceUnit unit);
37std::string format_long_unit(DistanceUnit unit);
38
39std::ostream &operator << (std::ostream &out, DistanceUnit unit);
40std::istream &operator >> (std::istream &in, DistanceUnit &unit);
41 DistanceUnit string_distance_unit(const std::string &str);
42
43 double convert_units(DistanceUnit from, DistanceUnit to);
44
45#endif
format_abbrev_unit
std::string format_abbrev_unit(DistanceUnit unit)
Returns the string representing the common abbreviation for the given unit.
Definition distanceUnit.cxx:27
DistanceUnit
DistanceUnit
This enumerated type lists all the kinds of units we're likely to come across in model conversion pro...
Definition distanceUnit.h:23
convert_units
double convert_units(DistanceUnit from, DistanceUnit to)
Returns the scaling factor that must be applied to convert from units of "from" to "to".
Definition distanceUnit.cxx:213
format_long_unit
std::string format_long_unit(DistanceUnit unit)
Returns the string representing the full name (plural) for the given unit.
Definition distanceUnit.cxx:67
string_distance_unit
DistanceUnit string_distance_unit(const std::string &str)
Converts from a string, as might be input by the user, to one of the known DistanceUnit types.
Definition distanceUnit.cxx:131
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.