MeasureUnit
@objc
open class MeasureUnit : NSObject
Specifies units of measure for a particular data.
-
Initializes a new instance of the MeasureUnit class with the specified id, name and characteristics.
Declaration
Swift
public convenience init(id: Int, name: String, type: MeasureUnitType, unitsPerInch: Double, standardDivisions: Int)
Parameters
id
The id of the new MeasureUnit.
name
The name of the new MeasureUnit.
type
The MeasureUnitType of the new MeasureUnit.
unitsPerInch
The units per inch of the new MeasureUnit.
standardDivisions
The standard divisions of the new MeasureUnit.
Return Value
The newly created MeasureUnit object.
-
Initializes a new instance of the MeasureUnit class with the specified id, name, characteristics and converter.
Declaration
Swift
public init(id: Int, name: String, type: MeasureUnitType, unitsPerInch: Double, standardDivisions: Int, converter: IMeasureUnitConverter?)
Parameters
id
The id of the new MeasureUnit.
name
The name of the new MeasureUnit.
type
The MeasureUnitType of the new MeasureUnit.
unitsPerInch
The units per inch of the new MeasureUnit.
standardDivisions
The standard divisions of the new MeasureUnit.
converter
An IMeasureUnitConverter converter for the new MeasureUnit.
Return Value
The newly created MeasureUnit object.
-
Initializes a new instance of the MeasureUnit class with the specified name, from the specified MeasureUnit and scale.
Declaration
Swift
public convenience init(name: String, baseUnit: MeasureUnit, scale: Double)
Parameters
name
The name of the new MeasureUnit.
baseUnit
The MeasureUnit on which the new MeasureUnit is based.
scale
The scale of the new MeasureUnit.
Return Value
The newly created MeasureUnit object.
-
Initializes a new instance of the MeasureUnit class with the specified name, from the specified MeasureUnit scale and standard divisions.
Declaration
Swift
public init(name: String, baseUnit: MeasureUnit, scale: Double, standardDivisions: Int)
Parameters
name
The name of the new MeasureUnit.
baseUnit
The MeasureUnit on which the new MeasureUnit is based.
scale
The scale of the new MeasureUnit.
standardDivisions
The standard divisions of the new MeasureUnit.
Return Value
The newly created MeasureUnit object.
-
Initializes a new instance of the MeasureUnit class with the specified name and units per inch.
Declaration
Swift
public convenience init(name: String, unitsPerInch: Double)
Parameters
name
The name of the new MeasureUnit.
unitsPerInch
The units per inch for the new MeasureUnit.
-
Initializes a new instance of the MeasureUnit class with the specified name, units per inch and standard divisions.
Declaration
Swift
public init(name: String, unitsPerInch: Double, standardDivisions: Int)
Parameters
name
The name of the new MeasureUnit.
unitsPerInch
The units per inch for the new MeasureUnit.
standardDivisions
The standard divisions for the new MeasureUnit.
Return Value
The newly created MeasureUnit object.
-
Converts the specified value in the target MeasureUnit with the specified context.
Declaration
Swift
open func convert(_ value: Double, targetUnit: MeasureUnit, context: AnyObject?) -> Double
Parameters
value
The value to convert.
targetUnit
The MeasureUnit of the conversion.
contect
The context of the conversion.
Return Value
The converted value.
-
Converts the specified value in the target MeasureUnit with the specified context and axis.
Declaration
Swift
open func convert(_ value: Double, targetUnit: MeasureUnit, context: AnyObject?, axis: Int) -> Double
Parameters
value
The value to convert.
targetUnit
The MeasureUnit of the conversion.
contect
The context of the conversion.
axis
The axis.
Return Value
The converted value.
-
Converts the specified rectangle in the target MeasureUnit with the specified contex.
Declaration
Parameters
r
The rectangle to convert.
targetUnit
The MeasureUnit of the conversion.
contect
The context of the conversion.
Return Value
The converted rectangle.
-
Constructs a MeasureUnit from the specified id.
Declaration
Swift
open class func fromId(_ id: Int) -> MeasureUnit?
Parameters
id
Identification string for the MeasureUnit.
Return Value
The MeasureUnit that corresponds to the id string; nil if none is found.
-
Identifies a millimeter MeasureUnit.
Declaration
Swift
public static let Millimeter: MeasureUnit
-
Identifies an inch MeasureUnit.
Declaration
Swift
public static let Inch: MeasureUnit
-
Identifies a point MeasureUnit.
Declaration
Swift
public static let Point: MeasureUnit
-
Identifies a pixel MeasureUnit.
Declaration
Swift
public static var Pixel: MeasureUnit
-
Identifies a document MeasureUnit.
Declaration
Swift
public static let Document: MeasureUnit
-
Identifies a wpf point MeasureUnit.
Declaration
Swift
public static let WpfPoint: MeasureUnit
-
Identifies a percent MeasureUnit.
Declaration
Swift
public static let Percent: MeasureUnit
-
Identifies a centimeter MeasureUnit.
Declaration
Swift
public static let Centimeter: MeasureUnit
-
Specifies the id of the MeasureUnit.
Declaration
Swift
open var id: Int
-
Specifies the name of the MeasureUnit.
Declaration
Swift
open var name: String
-
Specifies the MeasureUnitType of the MeasureUnit.
Declaration
Swift
open var type: MeasureUnitType
-
Specifies the amount of the MeasureUnit.
Declaration
Swift
open var amount: Double
-
Specifies the converter of the MeasureUnit. The value could be nil.
Declaration
Swift
open var converter: IMeasureUnitConverter?
-
Specifies the standard divisions of the MeasureUnit.
Declaration
Swift
open var standardDivisions: Int