Table of Contents

Class UnitValue

Namespace
iText.Layout.Properties
Assembly
itext.layout.dll

A specialized class that holds a value and the unit it is measured in.

public class UnitValue
Inheritance
UnitValue
Inherited Members

Constructors

UnitValue(int, float)

Creates a UnitValue object with a specified type and value.

public UnitValue(int unitType, float value)

Parameters

unitType int

either POINT or a PERCENT

value float

the value to be stored.

UnitValue(UnitValue)

Creates a copy of UnitValue object.

public UnitValue(UnitValue unitValue)

Parameters

unitValue UnitValue

the value to be stored

Fields

PERCENT

public const int PERCENT = 2

Field Value

int

POINT

public const int POINT = 1

Field Value

int

unitType

protected int unitType

Field Value

int

value

protected float value

Field Value

float

Methods

CreatePercentArray(int)

Creates an array of UnitValue PERCENT objects with equal values.

public static UnitValue[] CreatePercentArray(int size)

Parameters

size int

of the resulted array.

Returns

UnitValue[]

a array of equal PERCENT

UnitValue.

CreatePercentArray(float[])

Creates an array of UnitValue PERCENT objects with specified values.

public static UnitValue[] CreatePercentArray(float[] values)

Parameters

values float[]

the values to be stored.

Returns

UnitValue[]

a new normalized (Σ=100%) array of PERCENT

UnitValue.

CreatePercentValue(float)

Creates a UnitValue PERCENT object with a specified value.

public static UnitValue CreatePercentValue(float value)

Parameters

value float

the value to be stored.

Returns

UnitValue

a new PERCENT

UnitValue

CreatePointArray(float[])

Creates an array of UnitValue POINT objects with specified values.

public static UnitValue[] CreatePointArray(float[] values)

Parameters

values float[]

the values to be stored.

Returns

UnitValue[]

a new array of POINT

UnitValue

CreatePointValue(float)

Creates a UnitValue POINT object with a specified value.

public static UnitValue CreatePointValue(float value)

Parameters

value float

the value to be stored.

Returns

UnitValue

a new POINT

UnitValue

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

GetUnitType()

Returns the unit this value is stored in, either points (pt) or percent(%)

public virtual int GetUnitType()

Returns

int

either 1 for POINT or 2 for PERCENT

GetValue()

Gets the measured value stored in this object

public virtual float GetValue()

Returns

float

the value, as a float

IsPercentValue()

Returns whether or not the value is stored in percent (%)

public virtual bool IsPercentValue()

Returns

bool

true if stored in percent

IsPointValue()

Returns whether or not the value is stored in points (pt)

public virtual bool IsPointValue()

Returns

bool

true if stored in points

SetUnitType(int)

Sets the unit this value is stored in, either points (pt) or percent(%)

public virtual void SetUnitType(int unitType)

Parameters

unitType int

either POINT or PERCENT

SetValue(float)

Sets the measured value stored in this object

public virtual void SetValue(float value)

Parameters

value float

a float

ToString()

public override string ToString()

Returns

string