-
Notifications
You must be signed in to change notification settings - Fork 2
OTPModuleScale
OTP Module Scale
public struct OTPModuleScale: OTPModule, Equatable
Implements an OTP Standard Module of the Scale type and handles creation and parsing.
This data structure describes the unitless, absolute scale of the Point in the X, Y, and Z directions. The Scale Module may be used for description of Points that have the ability to change size.
Example usage:
// initialize a module at x = actual size, y = actual size, z = half size
let module = OTPModuleScale(x: 1000000, y: 1000000, z: 500000)
Equatable
, OTPModule
Initializes this OTPModule
with default values.
public init()
Initializes an OTP Module Scale.
public init(x: Int32 = 1000000, y: Int32 = 1000000, z: Int32 = 1000000)
- x: The scale of the x axis in unitless millionths i.e 1,000,000 = reference size (x1), 500,000 = half reference size (0.5x).
- y: The scale of the y axis in unitless millionths i.e 1,000,000 = reference size (x1), 500,000 = half reference size (0.5x).
- z: The scale of the z axis in unitless millionths i.e 1,000,000 = reference size (x1), 500,000 = half reference size (0.5x).
Uniquely identifies the module using an OTPModuleIdentifier
.
public static let identifier: OTPModuleIdentifier
The size of the module's data in bytes.
public static let dataLength: OTPPDULength = 12
The total size of the module in bytes, including identifiers and length.
public static let moduleLength: OTPPDULength = dataLength + OTPPDULength(ModuleLayer.Offset.data.rawValue)
The X scale in unitless millionths i.e 1,000,000 = reference size (x1), 500,000 = half reference size (0.5x).
public var x: Int32 = 1000000
The Y scale in unitless millionths i.e 1,000,000 = reference size (x1), 500,000 = half reference size (0.5x).
public var y: Int32 = 1000000
The Z scale in unitless millionths i.e 1,000,000 = reference size (x1), 500,000 = half reference size (0.5x).
public var z: Int32 = 1000000
A human-readable log description of this module.
public var logDescription: String
Creates a Module as Data.
public func createAsData() -> Data
The OTPModule
as a Data
object.
Attempts to create an OTPModuleScale
from the data.
public static func parse(fromData data: Data) throws -> (module: Self, length: OTPPDULength)
- data: The data to be parsed.
An error of type ModuleLayerValidationError
.
A valid OTPModuleScale
and the length of the PDU.
Merges an arrray of modules.
public static func merge(modules: [OTPModule]) -> (module: Self?, excludePoint: Bool)
- modules: The
OTPModule
s to be merged.
An optional OTPModule
of this type, and whether to exclude the OTPPoint
due to a mismatch.
Calculates whether this module is considered equal to another one.
public func isEqualToModule(_ module: OTPModule) -> Bool
- module: The
OTPModule
to be compared against.
Whether these OTPModule
s are considered equal.
Calculates a valid value for this fields in this module from the string provided.
public static func validValue(from string: String) -> Int32
- string: The string to be evaluated.
A valid value for storing in this module.
Generated at 2021-09-01T18:46:51+0000 using swift-doc 1.0.0-rc.1.
Types
- ComponentSocketError
- OTPAddress
- OTPComponentState
- OTPConsumer
- OTPConsumerStatus
- OTPIPMode
- OTPModuleIdentifier
- OTPModulePosition
- OTPModulePosition.Scaling
- OTPModulePositionVelAccel
- OTPModuleReferenceFrame
- OTPModuleRotation
- OTPModuleRotationVelAccel
- OTPModuleScale
- OTPPoint
- OTPPointValidationError
- OTPProducer
- OTPProducerStatus