Rhino C++ API  8.14
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ON_UnitSystem Class Reference

#include <opennurbs_string.h>

Public Member Functions

 ON_UnitSystem ()=default
 Default construction sets this to ON_UnitSystem::Meters. More...
 
 ON_UnitSystem (const ON_UnitSystem &)=default
 
 ON_UnitSystem (ON::LengthUnitSystem length_unit_system)
 
 ~ON_UnitSystem ()=default
 
void Dump (class ON_TextLog &) const
 
bool IsCustomUnitSystem () const
 
bool IsSet () const
 
bool IsValid () const
 
double MetersPerUnit () const
 
double MetersPerUnit (double unset_return_value) const
 
double MillimetersPerUnit (double unset_return_value) const
 
bool operator!= (const ON_UnitSystem &) const
 
ON_UnitSystemoperator= (const ON_UnitSystem &)=default
 
ON_UnitSystemoperator= (ON::LengthUnitSystem length_unit_system)
 
bool operator== (const ON_UnitSystem &) const
 
bool Read (class ON_BinaryArchive &)
 
void SetCustomUnitSystem (const wchar_t *custom_unit_name, double meters_per_custom_unit)
 
void SetCustomUnitSystemName (const wchar_t *custom_unit_name)
 
void SetCustomUnitSystemScale (double meters_per_custom_unit)
 
void SetUnitSystem (ON::LengthUnitSystem us)
 
const ON_wString ToString () const
 
ON::LengthUnitSystem UnitSystem () const
 
const ON_wStringUnitSystemName () const
 
bool Write (class ON_BinaryArchive &) const
 

Static Public Member Functions

static ON_UnitSystem CreateCustomUnitSystem (const wchar_t *custom_unit_name, double meters_per_custom_unit)
 

Static Public Attributes

static const ON_UnitSystem Angstroms
 
static const ON_UnitSystem AstronomicalUnits
 
static const ON_UnitSystem Centimeters
 
static const ON_UnitSystem Decimeters
 
static const ON_UnitSystem Dekameters
 
static const ON_UnitSystem Feet
 unit system = ON::LengthUnitSystem::Feet and meters/unit = 0.3048 exactly More...
 
static const ON_UnitSystem Gigameters
 
static const ON_UnitSystem Hectometers
 
static const ON_UnitSystem Inches
 unit system = ON::LengthUnitSystem::Inches and meters/unit = 0.0254 exactly More...
 
static const ON_UnitSystem Kilometers
 
static const ON_UnitSystem LightYears
 
static const ON_UnitSystem Megameters
 
static const ON_UnitSystem Meters
 unit system = ON::LengthUnitSystem::Meters and meters/unit = 1 More...
 
static const ON_UnitSystem Microinches
 
static const ON_UnitSystem Microns
 
static const ON_UnitSystem Miles
 
static const ON_UnitSystem Millimeters
 unit system = ON::LengthUnitSystem::Millimeters and meters/unit = 0.001 exactly More...
 
static const ON_UnitSystem Mils
 
static const ON_UnitSystem Nanometers
 
static const ON_UnitSystem NauticalMiles
 
static const ON_UnitSystem None
 unit system = ON::LengthUnitSystem::None. Scale to or from any valid unit = 1 More...
 
static const ON_UnitSystem Parsecs
 
static const ON_UnitSystem PrinterPicas
 
static const ON_UnitSystem PrinterPoints
 
static const ON_UnitSystem Unset
 unit system = ON::LengthUnitSystem::Unset and meters/unit = ON_DBL_QNAN More...
 
static const ON_UnitSystem Yards
 

Constructor & Destructor Documentation

◆ ON_UnitSystem() [1/3]

ON_UnitSystem::ON_UnitSystem ( )
default

Default construction sets this to ON_UnitSystem::Meters.

◆ ~ON_UnitSystem()

ON_UnitSystem::~ON_UnitSystem ( )
default

◆ ON_UnitSystem() [2/3]

ON_UnitSystem::ON_UnitSystem ( const ON_UnitSystem )
default

◆ ON_UnitSystem() [3/3]

ON_UnitSystem::ON_UnitSystem ( ON::LengthUnitSystem  length_unit_system)

Member Function Documentation

◆ CreateCustomUnitSystem()

static ON_UnitSystem ON_UnitSystem::CreateCustomUnitSystem ( const wchar_t *  custom_unit_name,
double  meters_per_custom_unit 
)
static

Parameters: custom_unit_name - [in] length unit name (no spaces) meters_per_custom_unit - [in] a positive number Example: / 1 League = 5556 meters const ON_UnitSystem Leagues = ON_UnitSystem::CreateCustomUnitSystem(L"Leagues", 1.0/5556.0);

◆ Dump()

void ON_UnitSystem::Dump ( class ON_TextLog ) const

◆ IsCustomUnitSystem()

bool ON_UnitSystem::IsCustomUnitSystem ( ) const

Returns true If the unit system is ON::LengthUnitSystem::CustomUnits

◆ IsSet()

bool ON_UnitSystem::IsSet ( ) const

Returns True if UnitSystem() is neither ON::LengthUnitSystem::Unset nor ON::LengthUnitSystem::None and IsValid() is true. See Also: IsValid()

◆ IsValid()

bool ON_UnitSystem::IsValid ( ) const

Returns False if UnitSystem() is ON::LengthUnitSystem::Unset. False if UnitSystem() is ON::LengthUnitSystem::CustomUnits and MetersPerUnits() is not positive. True if UnitSystem() is ON::LengthUnitSystem::None. True otherwise. See Also: IsSet()

◆ MetersPerUnit() [1/2]

double ON_UnitSystem::MetersPerUnit ( ) const

NOTE WELL: For standard units, ON_UnitSystem::MetersPerUnit() returns the inverse of the correct value. The reason is the VRay plug-in for Rhino 6 assumes the incorrect value is returned and does not work correctly in Rhino 7 if the correct value is returned.

Deprecated:
MetersPerUnit() returns the wrong value. Use this->MetersPerUnit(ON_DBL_QNAN)

◆ MetersPerUnit() [2/2]

double ON_UnitSystem::MetersPerUnit ( double  unset_return_value) const

Parameters: unset_return_value - [in] Value to return when this->UnitSystem() is ON::LengthUnitSystem::Unset. When in doubt, use ON_DBL_QNAN. Returns: If this->UnitSystem() is ON::LengthUnitSystem::CustomUnits, then the value set by SetCustomUnitSystemScale() is returned. If this->UnitSystem() is ON::LengthUnitSystem::Unset, then unset_return_value is returned. If this->UnitSystem() is ON::LengthUnitSystem::None, then 1.0 is returned. Otherwise, ON::UnitScale(this->UnitSystem(), ON::LengthUnitSystem::Meters) is returned.

◆ MillimetersPerUnit()

double ON_UnitSystem::MillimetersPerUnit ( double  unset_return_value) const

Parameters: unset_return_value - [in] Value to return when this->UnitSystem() is ON::LengthUnitSystem::Unset. When in doubt, use ON_DBL_QNAN. Returns: If this->UnitSystem() is ON::LengthUnitSystem::CustomUnits, then the 1000 times the value set by SetCustomUnitSystemScale() is returned. If this->UnitSystem() is ON::LengthUnitSystem::Unset, then unset_return_value is returned. If this->UnitSystem() is ON::LengthUnitSystem::None, then 1.0 is returned. Otherwise, ON::UnitScale(this->UnitSystem(), ON::LengthUnitSystem::Millimeters) is returned.

◆ operator!=()

bool ON_UnitSystem::operator!= ( const ON_UnitSystem ) const

◆ operator=() [1/2]

ON_UnitSystem& ON_UnitSystem::operator= ( const ON_UnitSystem )
default

◆ operator=() [2/2]

ON_UnitSystem& ON_UnitSystem::operator= ( ON::LengthUnitSystem  length_unit_system)

◆ operator==()

bool ON_UnitSystem::operator== ( const ON_UnitSystem ) const

◆ Read()

bool ON_UnitSystem::Read ( class ON_BinaryArchive )

◆ SetCustomUnitSystem()

void ON_UnitSystem::SetCustomUnitSystem ( const wchar_t *  custom_unit_name,
double  meters_per_custom_unit 
)

Parameters: custom_unit_name - [in] length unit name (no spaces) meters_per_custom_unit - [in] a positive number Example: / 1 League = 5556 meters ON_UnitSystem Leagues; Leagues.SetCustomUnitSystem( L"Leagues", 1.0/5556.0); / or ON_UnitSystem Leagues = ON_UnitSystem::CreateCustomUnitSystem(L"Leagues", 1.0/5556.0);

◆ SetCustomUnitSystemName()

void ON_UnitSystem::SetCustomUnitSystemName ( const wchar_t *  custom_unit_name)

Description: Changes the unit system to custom units and sets the custom unit scale. Remarks: Avoid using this function. Use SetCustomUnitSystem() or SetUnitSystem() instead.

Deprecated:
Use SetCustomUnitSystem()

◆ SetCustomUnitSystemScale()

void ON_UnitSystem::SetCustomUnitSystemScale ( double  meters_per_custom_unit)

Description: Changes the unit system to custom units and sets the custom unit scale. Parameters: meters_per_custom_unit - [in] a positive number Remarks: Avoid using this function. Use SetCustomUnitSystem() or SetUnitSystem() instead.

Deprecated:
Use SetCustomUnitSystem()

◆ SetUnitSystem()

void ON_UnitSystem::SetUnitSystem ( ON::LengthUnitSystem  us)

◆ ToString()

const ON_wString ON_UnitSystem::ToString ( ) const

◆ UnitSystem()

ON::LengthUnitSystem ON_UnitSystem::UnitSystem ( ) const

◆ UnitSystemName()

const ON_wString& ON_UnitSystem::UnitSystemName ( ) const

Returns: US English lower case plural unit system name (meters, inches, etc.).

◆ Write()

bool ON_UnitSystem::Write ( class ON_BinaryArchive ) const

Member Data Documentation

◆ Angstroms

const ON_UnitSystem ON_UnitSystem::Angstroms
static

◆ AstronomicalUnits

const ON_UnitSystem ON_UnitSystem::AstronomicalUnits
static

◆ Centimeters

const ON_UnitSystem ON_UnitSystem::Centimeters
static

◆ Decimeters

const ON_UnitSystem ON_UnitSystem::Decimeters
static

◆ Dekameters

const ON_UnitSystem ON_UnitSystem::Dekameters
static

◆ Feet

const ON_UnitSystem ON_UnitSystem::Feet
static

unit system = ON::LengthUnitSystem::Feet and meters/unit = 0.3048 exactly

◆ Gigameters

const ON_UnitSystem ON_UnitSystem::Gigameters
static

◆ Hectometers

const ON_UnitSystem ON_UnitSystem::Hectometers
static

◆ Inches

const ON_UnitSystem ON_UnitSystem::Inches
static

unit system = ON::LengthUnitSystem::Inches and meters/unit = 0.0254 exactly

◆ Kilometers

const ON_UnitSystem ON_UnitSystem::Kilometers
static

◆ LightYears

const ON_UnitSystem ON_UnitSystem::LightYears
static

◆ Megameters

const ON_UnitSystem ON_UnitSystem::Megameters
static

◆ Meters

const ON_UnitSystem ON_UnitSystem::Meters
static

unit system = ON::LengthUnitSystem::Meters and meters/unit = 1

◆ Microinches

const ON_UnitSystem ON_UnitSystem::Microinches
static

◆ Microns

const ON_UnitSystem ON_UnitSystem::Microns
static

◆ Miles

const ON_UnitSystem ON_UnitSystem::Miles
static

◆ Millimeters

const ON_UnitSystem ON_UnitSystem::Millimeters
static

unit system = ON::LengthUnitSystem::Millimeters and meters/unit = 0.001 exactly

◆ Mils

const ON_UnitSystem ON_UnitSystem::Mils
static

◆ Nanometers

const ON_UnitSystem ON_UnitSystem::Nanometers
static

◆ NauticalMiles

const ON_UnitSystem ON_UnitSystem::NauticalMiles
static

◆ None

const ON_UnitSystem ON_UnitSystem::None
static

unit system = ON::LengthUnitSystem::None. Scale to or from any valid unit = 1

◆ Parsecs

const ON_UnitSystem ON_UnitSystem::Parsecs
static

◆ PrinterPicas

const ON_UnitSystem ON_UnitSystem::PrinterPicas
static

◆ PrinterPoints

const ON_UnitSystem ON_UnitSystem::PrinterPoints
static

◆ Unset

const ON_UnitSystem ON_UnitSystem::Unset
static

unit system = ON::LengthUnitSystem::Unset and meters/unit = ON_DBL_QNAN

◆ Yards

const ON_UnitSystem ON_UnitSystem::Yards
static