Rhino C++ API
8.13
|
#include <opennurbs_string_value.h>
Public Types | |
enum | ScaleStringFormat : unsigned char { ScaleStringFormat::None = 0, ScaleStringFormat::RatioFormat = 1, ScaleStringFormat::EquationFormat = 2, ScaleStringFormat::FractionFormat = 3, ScaleStringFormat::Unset = 0xFF } |
Specifies preferred formats for automatically created string descriptions of a scale value. More... | |
Public Member Functions | |
ON_ScaleValue ()=default | |
ON_ScaleValue (const ON_ScaleValue &)=default | |
~ON_ScaleValue ()=default | |
const ON_SHA1_Hash | ContentHash () const |
bool | IsSet () const |
bool | IsUnset () const |
const class ON_LengthValue & | LeftLengthValue () const |
double | LeftToRightScale () const |
ON_ScaleValue & | operator= (const ON_ScaleValue &)=default |
bool | Read (class ON_BinaryArchive &archive) |
const class ON_LengthValue & | RightLengthValue () const |
double | RightToLeftScale () const |
const ON_wString & | ScaleAsString () const |
const wchar_t * | ScaleAsStringPointer () const |
const ON_ParseSettings | ScaleStringParseSettings () const |
void | SwapLeftAndRight () |
bool | Write (class ON_BinaryArchive &archive) const |
Static Public Member Functions | |
static int | Compare (const ON_ScaleValue &lhs, const ON_ScaleValue &rhs) |
static ON_ScaleValue | Create (const class ON_LengthValue &left_side_length, const class ON_LengthValue &right_side_length, ON_ScaleValue::ScaleStringFormat string_format_preference) |
static ON_ScaleValue | CreateFromString (ON_ParseSettings parse_settings, const wchar_t *string) |
static ON_ScaleValue | CreateFromSubString (ON_ParseSettings parse_settings, const wchar_t *string, int string_count, const wchar_t **string_end) |
static ON_ScaleValue::ScaleStringFormat | ScaleStringFormatFromUnsigned (unsigned int scale_string_format_as_unsigned) |
Static Public Attributes | |
static const ON_ScaleValue | OneToOne |
static const ON_ScaleValue | Unset |
|
strong |
Specifies preferred formats for automatically created string descriptions of a scale value.
Enumerator | |
---|---|
None | No preference for automatically created string descriptions of a scale value. |
RatioFormat | Prefer the ratio format using a colon, like "1:4" or "4:1". |
EquationFormat | Prefer the equation format using an equal sign, like "1 = 4" or "4 = 1". |
FractionFormat | Prefer the fraction format using a slash, like "1/4" or "4/1". |
Unset | ON_ScaleValue::ScaleStringFormat::Unset is used to indicate no preference is set. This condition is different from ON_ScaleValue::ScaleStringFormat::None. |
|
default |
|
default |
|
default |
|
static |
const ON_SHA1_Hash ON_ScaleValue::ContentHash | ( | ) | const |
|
static |
Parameters: left_length - [in] right_length - [in] Returns: A scale value for converting a distance from source_length to destination_length. Remarks: If you don't like the automatically created string value, then format the string yourself and use ON_ScaleValue::CreateFromString().
|
static |
Description: Create an ON_ScaleValue by parsing a string. Parameters: parse_settings - [in] Pass ON_ParseSettings(context_length_unit_system,context_angle_unit_system,context_locale_id) string - [in] null terminated string to parse. Returns: If the string is valid, the exact scale value is returned. If the string is not valid or parsing ends before the string's null terminator, the ON_ScaleValue::Unset is returned. Remarks: If the entire string is not parsed, that is an error condition. Use CreateFromSubString() to permit parsing a portion of the string. Examples: "1:4", "1=4", "1/4", "0.25" will set LeftToRightScale() = 4, RightToLeftScale() = 0.25
"4:1", "4=1", "4/1", "4" will set LeftToRightScale() = 0.25, RightToLeftScale() = 4
"100:1", "100=1", "1 meter = 1 centimeter" will set LeftToRightScale() = 0.01, RightToLeftScale() = 100
"1:100", "1=100", "1 centimeter = 1 meter" will set LeftToRightScale() = 100, RightToLeftScale() = 0.01
"12:1", "12=1", "12/1", "12", "1 foot = 1 inch" will set LeftToRightScale() = 0.08333..., RightToLeftScale() = 12
"1:12", "1=12", "1/12", "1 inch = 1 foot" will set LeftToRightScale() = 12, RightToLeftScale() = 0.08333...
"1:48", "1 = 48", "1/4 inch = 1 foot" will set LeftToRightScale() = 48, RightToLeftScale() = 0.0208333...
|
static |
Description: Create an ON_ScaleValue by parsing a string. Parameters: parse_settings - [in] Pass ON_ParseSettings(context_length_unit_system,context_angle_unit_system,context_locale_id) string - [in] null terminated string to parse. string_count - [in] string[] and string_count specify the string to parse. If string_count >= 0, it specifies the maximum number of elements in string[] that may be parsed. If string_count = -1, then the string must contain a character that terminates scale parsing. string_end - [out] If string_end is not nullptr, then *string_end points to the first element in the string that was not parsed. Returns: If the string is valid, the exact scale value is returned. If the string is not valid or parsing ends before the string's null terminator, the ON_ScaleValue::Unset is returned. Remarks: If the entire string is not parsed, that is an error condition. Use CreateFromSubString() to permit parsing a portion of the string.
Examples: "1:4", "1=4", "1/4", "0.25" will set LeftToRightScale() = 4, RightToLeftScale() = 0.25
"4:1", "4=1", "4/1", "4" will set LeftToRightScale() = 0.25, RightToLeftScale() = 4
"100:1", "100=1", "1 meter = 1 centimeter" will set LeftToRightScale() = 0.01, RightToLeftScale() = 100
"1:100", "1=100", "1 centimeter = 1 meter" will set LeftToRightScale() = 100, RightToLeftScale() = 0.01
"12:1", "12=1", "12/1", "12", "1 foot = 1 inch" will set LeftToRightScale() = 0.08333..., RightToLeftScale() = 12
"1:12", "1=12", "1/12", "1 inch = 1 foot" will set LeftToRightScale() = 12, RightToLeftScale() = 0.08333...
"1:48", "1 = 48", "1/4 inch = 1 foot" will set LeftToRightScale() = 48, RightToLeftScale() = 0.0208333...
bool ON_ScaleValue::IsSet | ( | ) | const |
bool ON_ScaleValue::IsUnset | ( | ) | const |
const class ON_LengthValue& ON_ScaleValue::LeftLengthValue | ( | ) | const |
double ON_ScaleValue::LeftToRightScale | ( | ) | const |
Returns: A dimensionless scale factor. The word "dimensionless" is critical. Differences in left and right side unit systems are accounted for in the returned value. Remarks: LeftToRightScale() = 1.0/RightToLeftScale() Examples: "1:4", "1=4", "1/4", "0.25" will set LeftToRightScale() = 4, RightToLeftScale() = 0.25
"4:1", "4=1", "4/1", "4" will set LeftToRightScale() = 0.25, RightToLeftScale() = 4
"100:1", "100=1", "1 meter = 1 centimeter" will set LeftToRightScale() = 0.01, RightToLeftScale() = 100
"1:100", "1=100", "1 centimeter = 1 meter" will set LeftToRightScale() = 100, RightToLeftScale() = 0.01
"12:1", "12=1", "12/1", "12", "1 foot = 1 inch" will set LeftToRightScale() = 0.08333..., RightToLeftScale() = 12
"1:12", "1=12", "1/12", "1 inch = 1 foot" will set LeftToRightScale() = 12, RightToLeftScale() = 0.08333...
"1:48", "1 = 48", "1/4 inch = 1 foot" will set LeftToRightScale() = 48, RightToLeftScale() = 0.0208333...
|
default |
bool ON_ScaleValue::Read | ( | class ON_BinaryArchive & | archive | ) |
const class ON_LengthValue& ON_ScaleValue::RightLengthValue | ( | ) | const |
double ON_ScaleValue::RightToLeftScale | ( | ) | const |
Returns: A dimensionless scale factor. The word "dimensionless" is critical. Differences in left and right side unit systems are accounted for in the returned value. Remarks: RightToLeftScale() = 1.0/LeftToRightScale() Examples: "1:4", "1=4", "1/4", "0.25" will set LeftToRightScale() = 4, RightToLeftScale() = 0.25
"4:1", "4=1", "4/1", "4" will set LeftToRightScale() = 0.25, RightToLeftScale() = 4
"100:1", "100=1", "1 meter = 1 centimeter" will set LeftToRightScale() = 0.01, RightToLeftScale() = 100
"1:100", "1=100", "1 centimeter = 1 meter" will set LeftToRightScale() = 100, RightToLeftScale() = 0.01
"12:1", "12=1", "12/1", "12", "1 foot = 1 inch" will set LeftToRightScale() = 0.08333..., RightToLeftScale() = 12
"1:12", "1=12", "1/12", "1 inch = 1 foot" will set LeftToRightScale() = 12, RightToLeftScale() = 0.08333...
"1:48", "1 = 48", "1/4 inch = 1 foot" will set LeftToRightScale() = 48, RightToLeftScale() = 0.0208333...
const ON_wString& ON_ScaleValue::ScaleAsString | ( | ) | const |
Returns: The scale as a string. Remarks: If ON_ScaleValue::CreateFromString() or ON_ScaleValue::CreateFromSubString() were used to create this ON_ScaleValue, a copy of that string is returned.
const wchar_t* ON_ScaleValue::ScaleAsStringPointer | ( | ) | const |
|
static |
const ON_ParseSettings ON_ScaleValue::ScaleStringParseSettings | ( | ) | const |
void ON_ScaleValue::SwapLeftAndRight | ( | ) |
Description Exchange the left and right lengths.
bool ON_ScaleValue::Write | ( | class ON_BinaryArchive & | archive | ) | const |
|
static |
|
static |