OpenTD.UnitsData Class Reference
Last update: 16.07.2025Describes a system of units. Can be inconsistent. More...

Public Member Functions | |
| UnitsData () | |
| UnitsData (string unitsExpression) | |
| Initializes a new instance of the UnitsData class by parsing the supplied units expression string. Use with basic units (m, hr, Btu, etc.) or compound units expressions (Btu/hr/ft^2/F, kg/m-s, etc.). Recognizes strings in the same format output by TD. Accepted operators : ( ) / - ^ Exponents denoted with optional ^, e.g. m^3 and m3 are both valid W can be substituted for J/s 1 can be used, as in 1/m^3 Revolution can be used, as in Revolution/s Case-insensitive For overlapping model length and orbit length units (m and ft), assumes model length. | |
| UnitsData (long TdUnits, long TdUnits2) | |
| Initializes a new instance of the UnitsData class, using integers written to save files or CSR's by SINDA. | |
| UnitsData (UnitsData source) | |
| Copy constructor. | |
| string | GetUnitsName (UnitsType type) |
| string | GetTitle (UnitsType type) |
| void | SetToSI () |
| void | SetToEng () |
| void | SetFrom (UnitsData source) |
| void | SetFromDataset (long TdUnits, long TdUnits2) |
| Set this units system based on 64-bit integers written to a save file or CSR by Sinda. | |
| bool | SetFromUnitsExpression (string str) |
| Sets this UnitsData using the supplied string. Use with basic units (m, hr, Btu, etc.) or compound units expressions (Btu/hr/ft^2/F, kg/m-s, etc.). For basic units, SetFromBasicUnit(string str) will be more efficient. Recognizes strings in the same format output by TD. Accepted operators : ( ) / - ^ Exponents denoted with optional ^, e.g. m^3 and m3 are both valid W can be substituted for J/s 1 can be used, as in 1/m^3 Revolution can be used, as in Revolution/s Case-insensitive For overlapping model length and orbit length units (m and ft), assumes model length. | |
| override string | ToString () |
| bool | Equals (UnitsData x) |
| override bool | Equals (object obj) |
| override int | GetHashCode () |
Static Public Member Functions | |
| static string | GetName (UnitsType type) |
| static string | Text (OrbitLength units) |
| static string | Text (ModelLength units) |
| static string | Text (Time units) |
| static string | Text (Energy units) |
| static string | Text (Temp units) |
| static string | Text (Mass units) |
| static string | Text (Pressure units) |
| static string | Text (Angle units) |
| static string | Text (Force units) |
| static string | Text (Current units) |
| static string | Text (Voltage units) |
| static string | Text (Resistance units) |
| static bool | operator== (UnitsData x1, UnitsData x2) |
| static bool | operator!= (UnitsData x1, UnitsData x2) |
Properties | |
| FlocadOutputUnitsType | FlocadOutputUnits [get, set] |
| OrbitLength | orbitLength [get, set] |
| ModelLength | modelLength [get, set] |
| Time | time [get, set] |
| Energy | energy [get, set] |
| Temp | temp [get, set] |
| Mass | mass [get, set] |
| Pressure | pressure [get, set] |
| Angle | angle [get, set] |
| Force | force [get, set] |
| Current | current [get, set] |
| Voltage | voltage [get, set] |
| UnitsDefData | def [get, set] |
| Use def to create arbitrary combinations of units (advanced). | |
Detailed Description
Describes a system of units. Can be inconsistent.
Member Enumeration Documentation
◆ Angle
Angle units.
| Enumerator | |
|---|---|
| DEGREES | |
| RADIANS | |
◆ Current
Current units.
| Enumerator | |
|---|---|
| AMPS | |
| MILLI_AMPS | |
| MICRO_AMPS | |
◆ Energy
Energy units.
| Enumerator | |
|---|---|
| J | |
| KJ | |
| BTU | |
| MILLI_J | |
| WATT_HOUR | |
◆ FlocadOutputUnitsType
◆ Force
Force units.
| Enumerator | |
|---|---|
| N | |
| LBF | |
◆ Mass
Mass units.
| Enumerator | |
|---|---|
| KG | |
| GRAM | |
| LBM | |
| SLUG | |
◆ ModelLength
◆ OrbitLength
◆ Pressure
Pressure units.
| Enumerator | |
|---|---|
| PA | |
| PSI | |
| PSF | |
| ATM | |
| TORR | |
| INHG | |
| INH2O | |
| BAR | |
| KPA | |
| MPA | |
| GPA | |
| MPSI | |
| PSIG | |
◆ Resistance
◆ Temp
◆ Time
Time units.
| Enumerator | |
|---|---|
| SEC | |
| MIN | |
| HR | |
◆ UnitsType
Physical dimensions.
◆ Voltage
Voltage units.
| Enumerator | |
|---|---|
| VOLTS | |
| MILLI_VOLTS | |
| MICRO_VOLTS | |
Constructor & Destructor Documentation
◆ UnitsData() [1/4]
|
inline |
◆ UnitsData() [2/4]
|
inline |
Initializes a new instance of the UnitsData class by parsing the supplied units expression string. Use with basic units (m, hr, Btu, etc.) or compound units expressions (Btu/hr/ft^2/F, kg/m-s, etc.). Recognizes strings in the same format output by TD. Accepted operators : ( ) / - ^ Exponents denoted with optional ^, e.g. m^3 and m3 are both valid W can be substituted for J/s 1 can be used, as in 1/m^3 Revolution can be used, as in Revolution/s Case-insensitive For overlapping model length and orbit length units (m and ft), assumes model length.
◆ UnitsData() [3/4]
|
inline |
Initializes a new instance of the UnitsData class, using integers written to save files or CSR's by SINDA.
◆ UnitsData() [4/4]
|
inline |
Copy constructor.
Member Function Documentation
◆ Equals() [1/2]
|
inline |
◆ Equals() [2/2]
|
inline |
◆ GetHashCode()
|
inline |
◆ GetName()
|
inlinestatic |
◆ GetTitle()
|
inline |
◆ GetUnitsName()
|
inline |
◆ operator!=()
◆ operator==()
◆ SetFrom()
|
inline |
◆ SetFromDataset()
|
inline |
Set this units system based on 64-bit integers written to a save file or CSR by Sinda.
- Exceptions
-
OpenTD.OpenTDException Problem decoding TdUnits. or Problem decoding TdUnits2.
◆ SetFromUnitsExpression()
|
inline |
Sets this UnitsData using the supplied string. Use with basic units (m, hr, Btu, etc.) or compound units expressions (Btu/hr/ft^2/F, kg/m-s, etc.). For basic units, SetFromBasicUnit(string str) will be more efficient. Recognizes strings in the same format output by TD. Accepted operators : ( ) / - ^ Exponents denoted with optional ^, e.g. m^3 and m3 are both valid W can be substituted for J/s 1 can be used, as in 1/m^3 Revolution can be used, as in Revolution/s Case-insensitive For overlapping model length and orbit length units (m and ft), assumes model length.
◆ SetToEng()
|
inline |
◆ SetToSI()
|
inline |
◆ Text() [1/12]
|
inlinestatic |
◆ Text() [2/12]
|
inlinestatic |
◆ Text() [3/12]
|
inlinestatic |
◆ Text() [4/12]
|
inlinestatic |
◆ Text() [5/12]
|
inlinestatic |
◆ Text() [6/12]
|
inlinestatic |
◆ Text() [7/12]
|
inlinestatic |
◆ Text() [8/12]
|
inlinestatic |
◆ Text() [9/12]
|
inlinestatic |
◆ Text() [10/12]
|
inlinestatic |
◆ Text() [11/12]
|
inlinestatic |
◆ Text() [12/12]
|
inlinestatic |
◆ ToString()
|
inline |
Property Documentation
◆ angle
|
getset |
◆ current
|
getset |
◆ def
|
getset |
Use def to create arbitrary combinations of units (advanced).
◆ energy
|
getset |
◆ FlocadOutputUnits
|
getset |
◆ force
|
getset |
◆ mass
|
getset |
◆ modelLength
|
getset |
◆ orbitLength
|
getset |
◆ pressure
|
getset |
◆ temp
|
getset |
◆ time
|
getset |
◆ voltage
|
getset |
The documentation for this class was generated from the following file:
- C:/Users/mgarrett/source/repos/BuildsTdSuite/builds/OpenTD/OpenTD/UnitsData.cs