Lumiverse  2.5
A framework for creating lighting control applications
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Lumiverse::LumiverseOrientation Class Reference

Defines an orientation in Lumiverse. More...

#include <LumiverseOrientation.h>

Inheritance diagram for Lumiverse::LumiverseOrientation:
Inheritance graph
[legend]
Collaboration diagram for Lumiverse::LumiverseOrientation:
Collaboration graph
[legend]

Public Member Functions

 LumiverseOrientation (float val=0.0f, ORIENTATION_UNIT unit=DEGREE, float def=0.0f, float max=360.0f, float min=0.0f)
 Constructs an orientation, default value is 0. More...
 
 LumiverseOrientation (LumiverseOrientation *other)
 Constructs an orientation with the contents of a different orientation. More...
 
 LumiverseOrientation (LumiverseType *other)
 Constructs an orientation by copying from a generic LumiverseType. More...
 
 ~LumiverseOrientation ()
 Destroys the orientation.
 
virtual string getTypeName ()
 Says that this object is an orientation. More...
 
void operator= (float val)
 
void operator= (LumiverseOrientation val)
 
LumiverseOrientationoperator+= (float val)
 
LumiverseOrientationoperator+= (LumiverseOrientation &val)
 
LumiverseOrientationoperator-= (float val)
 
LumiverseOrientationoperator-= (LumiverseOrientation &val)
 
LumiverseOrientationoperator*= (float val)
 
LumiverseOrientationoperator*= (LumiverseOrientation &val)
 
LumiverseOrientationoperator/= (float val)
 
LumiverseOrientationoperator/= (LumiverseOrientation &val)
 
float getVal ()
 Gets the value of the orientation. More...
 
void setVal (float val, ORIENTATION_UNIT unit=DEGREE)
 Sets the value of the orientation. More...
 
void setVals (float val, float def, float min, float max)
 Sets the value of all orientation values except the unit.
 
void setUnit (ORIENTATION_UNIT unit)
 Set unit. More...
 
ORIENTATION_UNIT getUnit ()
 Get the unit. More...
 
void setMax (float val, ORIENTATION_UNIT unit=DEGREE)
 Set maximum value. More...
 
float getMax ()
 Get the maximum value. More...
 
void setMin (float val, ORIENTATION_UNIT unit=DEGREE)
 Set miniumum value. More...
 
float getMin ()
 Get the minimum value. More...
 
void setDefault (float val, ORIENTATION_UNIT unit=DEGREE)
 Set the default value for the orientation. More...
 
float getDefault ()
 Gets the default value for the orientation. More...
 
virtual void reset ()
 Resets the value to the default value.
 
void setValAsPercent (float val)
 Sets the value of the LumiverseOrientation proportionally.
 
float asPercent ()
 Returns the value of this orientation as a percentage. More...
 
float valAsUnit (ORIENTATION_UNIT unit)
 Returns the value of this orientation with the specified units.
 
float maxAsUnit (ORIENTATION_UNIT unit)
 Returns the max value of the orientation with the specified units.
 
float minAsUnit (ORIENTATION_UNIT unit)
 Returns the min value of the orientation with the specified units.
 
float defaultAsUnit (ORIENTATION_UNIT unit)
 Returns the default value of the orientation with the specified units.
 
virtual JSONNode toJSON (string name)
 Converts the type to a JSON object with the specified name. More...
 
virtual string asString ()
 Returns the value of the LumiverseOrientation as a string. More...
 
virtual bool isDefault ()
 Returns true if the value is equal to the default value for the type.
 
- Public Member Functions inherited from Lumiverse::LumiverseType
virtual ~LumiverseType ()
 Destroys the object.
 

Private Member Functions

void clamp ()
 Ensures that the value of this float is between min and max.
 
float asUnit (ORIENTATION_UNIT valUnit, float val, ORIENTATION_UNIT targetUnit)
 Returns the specified value as the specified unit. More...
 

Private Attributes

float m_val
 the value of this object
 
float m_default
 Default value for this orientation.
 
float m_max
 Maximum value for the orientation (default 1.0)
 
float m_min
 Minimum value for the orientation (default 0.0)
 
ORIENTATION_UNIT m_unit
 Indicates the type of angle measurement used in the object.
 

Detailed Description

Defines an orientation in Lumiverse.

This class allows limits to be set on the minimum and maximum values for the variable in question. Overloads for comparison ops and arithmetic ops are located in Lumiverse namespace. Orientations are essentially special LumiverseFloat objects that have a few built in functions for getting rotation specfic data.

See also
Lumiverse

Constructor & Destructor Documentation

Lumiverse::LumiverseOrientation::LumiverseOrientation ( float  val = 0.0f,
ORIENTATION_UNIT  unit = DEGREE,
float  def = 0.0f,
float  max = 360.0f,
float  min = 0.0f 
)

Constructs an orientation, default value is 0.

Parameters
valInitial value
defDefault value. When reset() is called, val will be set to def.
maxMaximum allowed value
minMinimum allowed value
See also
reset()
Lumiverse::LumiverseOrientation::LumiverseOrientation ( LumiverseOrientation other)

Constructs an orientation with the contents of a different orientation.

Parameters
otherThe other object to copy from
Lumiverse::LumiverseOrientation::LumiverseOrientation ( LumiverseType other)

Constructs an orientation by copying from a generic LumiverseType.

If the other object isn't actually an orientation, this function will initialize with default values.

Parameters
otherThe other object to copy from.

Member Function Documentation

float Lumiverse::LumiverseOrientation::asPercent ( )

Returns the value of this orientation as a percentage.

Returns
Returns the value: m_val / (m_max - m_min)
string Lumiverse::LumiverseOrientation::asString ( )
virtual

Returns the value of the LumiverseOrientation as a string.

Precision goes up to 4 decimal places.

Implements Lumiverse::LumiverseType.

float Lumiverse::LumiverseOrientation::asUnit ( ORIENTATION_UNIT  valUnit,
float  val,
ORIENTATION_UNIT  targetUnit 
)
private

Returns the specified value as the specified unit.

In the event that the orientation is already using the specified units, the same value as getVal() will be returned.

Parameters
valUnitUnits of val.
valQuantity to convert
targetUnitdesired final units
float Lumiverse::LumiverseOrientation::getDefault ( )
inline

Gets the default value for the orientation.

Returns
Default value in local units
float Lumiverse::LumiverseOrientation::getMax ( )
inline

Get the maximum value.

Returns
Maximum value for the float
float Lumiverse::LumiverseOrientation::getMin ( )
inline

Get the minimum value.

Returns
Minimum value for the orientation in local units
virtual string Lumiverse::LumiverseOrientation::getTypeName ( )
inlinevirtual

Says that this object is an orientation.

Returns
String with contents: "orientation"

Implements Lumiverse::LumiverseType.

ORIENTATION_UNIT Lumiverse::LumiverseOrientation::getUnit ( )
inline

Get the unit.

Returns
Name of unit
float Lumiverse::LumiverseOrientation::getVal ( )
inline

Gets the value of the orientation.

Returns
Value of the object
void Lumiverse::LumiverseOrientation::setDefault ( float  val,
ORIENTATION_UNIT  unit = DEGREE 
)
inline

Set the default value for the orientation.

Parameters
valNew default value
void Lumiverse::LumiverseOrientation::setMax ( float  val,
ORIENTATION_UNIT  unit = DEGREE 
)
inline

Set maximum value.

Parameters
valNew maximum value
void Lumiverse::LumiverseOrientation::setMin ( float  val,
ORIENTATION_UNIT  unit = DEGREE 
)
inline

Set miniumum value.

Parameters
valNew minimum value
void Lumiverse::LumiverseOrientation::setUnit ( ORIENTATION_UNIT  unit)

Set unit.

Parameters
valNew unit
void Lumiverse::LumiverseOrientation::setVal ( float  val,
ORIENTATION_UNIT  unit = DEGREE 
)
inline

Sets the value of the orientation.

Parameters
valNew value
JSONNode Lumiverse::LumiverseOrientation::toJSON ( string  name)
virtual

Converts the type to a JSON object with the specified name.

Required for proper serialiaztion.

Implements Lumiverse::LumiverseType.


The documentation for this class was generated from the following files: