iText 7 7.1.9 API
iText.Layout.Properties.UnitValue Class Reference

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

Public Member Functions

  UnitValue (int unitType, float value)
  Creates a UnitValue object with a specified type and value. More...
 
  UnitValue (iText.Layout.Properties.UnitValue unitValue)
  Creates a copy of UnitValue object. More...
 
virtual int  GetUnitType ()
  Returns the unit this value is stored in, either points (pt) or percent(%) More...
 
virtual void  SetUnitType (int unitType)
  Sets the unit this value is stored in, either points (pt) or percent(%) More...
 
virtual float  GetValue ()
  Gets the measured value stored in this object More...
 
virtual void  SetValue (float value)
  Sets the measured value stored in this object More...
 
virtual bool  IsPointValue ()
  Returns whether or not the value is stored in points (pt) More...
 
virtual bool  IsPercentValue ()
  Returns whether or not the value is stored in percent (%) More...
 
override bool  Equals (Object obj)
 
override int  GetHashCode ()
 
override String  ToString ()
 

Static Public Member Functions

static iText.Layout.Properties.UnitValue  CreatePointValue (float value)
  Creates a UnitValue POINT object with a specified value. More...
 
static iText.Layout.Properties.UnitValue  CreatePercentValue (float value)
  Creates a UnitValue PERCENT object with a specified value. More...
 
static iText.Layout.Properties.UnitValue[]  CreatePercentArray (float[] values)
  Creates an array of UnitValue PERCENT objects with specified values. More...
 
static iText.Layout.Properties.UnitValue[]  CreatePercentArray (int size)
  Creates an array of UnitValue PERCENT objects with equal values. More...
 
static iText.Layout.Properties.UnitValue[]  CreatePointArray (float[] values)
  Creates an array of UnitValue POINT objects with specified values. More...
 

Static Public Attributes

const int  POINT = 1
 
const int  PERCENT = 2
 

Detailed Description

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

Constructor & Destructor Documentation

◆ UnitValue() [1/2]

iText.Layout.Properties.UnitValue.UnitValue ( int  unitType,
float  value 
)
inline

Creates a UnitValue object with a specified type and value.

Parameters
unitType either POINT or a PERCENT
value the value to be stored.

◆ UnitValue() [2/2]

iText.Layout.Properties.UnitValue.UnitValue ( iText.Layout.Properties.UnitValue  unitValue )
inline

Creates a copy of UnitValue object.

Parameters
unitValue

Member Function Documentation

◆ CreatePercentArray() [1/2]

static iText.Layout.Properties.UnitValue [] iText.Layout.Properties.UnitValue.CreatePercentArray ( float[]  values )
inlinestatic

Creates an array of UnitValue PERCENT objects with specified values.

Parameters
values the values to be stored.
Returns

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

UnitValue.

◆ CreatePercentArray() [2/2]

static iText.Layout.Properties.UnitValue [] iText.Layout.Properties.UnitValue.CreatePercentArray ( int  size )
inlinestatic

Creates an array of UnitValue PERCENT objects with equal values.

Parameters
size of the resulted array.
Returns

a array of equal PERCENT

UnitValue.

◆ CreatePercentValue()

static iText.Layout.Properties.UnitValue iText.Layout.Properties.UnitValue.CreatePercentValue ( float  value )
inlinestatic

Creates a UnitValue PERCENT object with a specified value.

Parameters
value the value to be stored.
Returns

a new PERCENT

UnitValue

◆ CreatePointArray()

static iText.Layout.Properties.UnitValue [] iText.Layout.Properties.UnitValue.CreatePointArray ( float[]  values )
inlinestatic

Creates an array of UnitValue POINT objects with specified values.

Parameters
values the values to be stored.
Returns

a new array of POINT

UnitValue

◆ CreatePointValue()

static iText.Layout.Properties.UnitValue iText.Layout.Properties.UnitValue.CreatePointValue ( float  value )
inlinestatic

Creates a UnitValue POINT object with a specified value.

Parameters
value the value to be stored.
Returns

a new POINT

UnitValue

◆ GetUnitType()

virtual int iText.Layout.Properties.UnitValue.GetUnitType ( )
inlinevirtual

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

Returns
either 1 for POINT or 2 for PERCENT

◆ GetValue()

virtual float iText.Layout.Properties.UnitValue.GetValue ( )
inlinevirtual

Gets the measured value stored in this object

Returns
the value, as a float

◆ IsPercentValue()

virtual bool iText.Layout.Properties.UnitValue.IsPercentValue ( )
inlinevirtual

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

Returns
true if stored in percent

◆ IsPointValue()

virtual bool iText.Layout.Properties.UnitValue.IsPointValue ( )
inlinevirtual

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

Returns
true if stored in points

◆ SetUnitType()

virtual void iText.Layout.Properties.UnitValue.SetUnitType ( int  unitType )
inlinevirtual

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

Parameters
unitType either POINT or PERCENT

◆ SetValue()

virtual void iText.Layout.Properties.UnitValue.SetValue ( float  value )
inlinevirtual

Sets the measured value stored in this object

Parameters
value a float