Panda3D
Enumerations | Functions
distanceUnit.h File Reference

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. More...

#include "pandatoolbase.h"

Go to the source code of this file.

Enumerations

enum  DistanceUnit {
  DU_millimeters, DU_centimeters, DU_meters, DU_kilometers,
  DU_yards, DU_feet, DU_inches, DU_nautical_miles,
  DU_statute_miles, DU_invalid
}
 This enumerated type lists all the kinds of units we're likely to come across in model conversion programs. More...
 

Functions

double convert_units (DistanceUnit from, DistanceUnit to)
 Returns the scaling factor that must be applied to convert from units of "from" to "to". More...
 
std::string format_abbrev_unit (DistanceUnit unit)
 Returns the string representing the common abbreviation for the given unit. More...
 
std::string format_long_unit (DistanceUnit unit)
 Returns the string representing the full name (plural) for the given unit. More...
 
std::istream & operator >> (std::istream &in, DistanceUnit &unit)
 
std::ostream & operator<< (std::ostream &out, DistanceUnit 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. More...
 

Detailed Description

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.

All rights reserved.

All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."

Author
drose
Date
2001-04-17

Definition in file distanceUnit.h.

Enumeration Type Documentation

◆ DistanceUnit

This enumerated type lists all the kinds of units we're likely to come across in model conversion programs.

Definition at line 23 of file distanceUnit.h.

Function Documentation

◆ 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 at line 213 of file distanceUnit.cxx.

◆ format_abbrev_unit()

std::string format_abbrev_unit ( DistanceUnit  unit)

Returns the string representing the common abbreviation for the given unit.

Definition at line 27 of file distanceUnit.cxx.

◆ format_long_unit()

std::string format_long_unit ( DistanceUnit  unit)

Returns the string representing the full name (plural) for the given unit.

Definition at line 67 of file distanceUnit.cxx.

◆ string_distance_unit()

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.

Returns DU_invalid if the string is unknown.

Definition at line 131 of file distanceUnit.cxx.