PTMeasurementScale


@interface PTMeasurementScale : NSObject <NSCoding>

A PTMeasurementScale is used to describe a measurement’s conversion factors.

  • Initializes a new instance of the class.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithBaseValue:(CGFloat)baseValue
                                     baseUnit:(nonnull NSString *)baseUnit
                               translateValue:(CGFloat)translateValue
                                translateUnit:(nonnull NSString *)translateUnit
                                    precision:(int)precision
                            fractionPrecision:(int)fractionPrecision
                       fractionDisplayEnabled:(BOOL)fractionDisplayEnabled;

    Swift

    init(baseValue: CGFloat, baseUnit: String, translateValue: CGFloat, translateUnit: String, precision: Int32, fractionPrecision: Int32, fractionDisplayEnabled: Bool)

    Parameters

    baseValue

    The base conversion value in document space.

  • Enables/disables displaying fraction number for measurement.

    Declaration

    Objective-C

    - (void)enableFractionDisplay:(BOOL)fractionDisplayEnabled;

    Swift

    func enableFractionDisplay(_ fractionDisplayEnabled: Bool)

    Parameters

    fractionDisplayEnabled

    Whether to enable or disable the fraction display.

  • The base value of the conversion. This is in document space.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat baseValue;

    Swift

    var baseValue: CGFloat { get set }
  • The units of the base value.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nonnull baseUnit;

    Swift

    var baseUnit: String { get set }
  • The translation value of the conversion. This is in world space.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat translateValue;

    Swift

    var translateValue: CGFloat { get set }
  • The units of the translation value.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nonnull translateUnit;

    Swift

    var translateUnit: String { get set }
  • The precision with which to display the measurement.

    Declaration

    Objective-C

    @property (nonatomic) int precision;

    Swift

    var precision: Int32 { get set }
  • The precision with which to display the measurement in fraction, where the number is the denominator, eg 1/fractionPrecision of an inch. Powers of 2 supported (2,4,8, etc.).

    Declaration

    Objective-C

    @property (nonatomic) int fractionPrecision;

    Swift

    var fractionPrecision: Int32 { get set }
  • Whether to enable or disable the fraction display.

    Declaration

    Objective-C

    @property (nonatomic) BOOL fractionDisplayEnabled;

    Swift

    var fractionDisplayEnabled: Bool { get set }