Open Search
    RangeData Class Reference

    #include <customgui_range.h>

    Inheritance diagram for RangeData:

    Detailed Description

    Range data type (CUSTOMDATATYPE_RANGE) for RangeCustomGui.

    Note
    Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
    Since
    R19

    Private Constructor/Destructor

     RangeData ()
     
     ~RangeData ()
     

    Alloc/Free

    static RangeDataAlloc ()
     
    static void Free (RangeData *&data)
     

    Init

    Bool Init (Int rangeNumber)
     

    Reset

    void Reset (Bool invalidateObject=false)
     

    Copy

    void CopyTo (RangeData *dst) const
     

    Value

    Bool AddValue (Float value)
     
    Float GetCurrentValue () const
     
    void SetCurrentValue (Float value)
     

    Knots

    Int GetKnotsCount () const
     
    Bool SetKnotValue (Int knotIndex, Float value)
     
    Float GetKnotValue (Int knotIndex) const
     
    Int GetKnotIndexByValue (Float value) const
     
    void DeleteKnot (Int knotIndex)
     
    Int GetSelectedKnot () const
     
    void SetSelectedKnot (Int knotIndex)
     

    Range

    Int GetRangesCount () const
     
    RangePair GetRange (Int index) const
     
    Int GetRangeIndex (Float value) const
     
    Vector GetRangeColor (Int index) const
     
    void SetRangeColor (Int index, const Vector &color)
     
    Int GetSelectedRange () const
     
    void SetSelectedRange (Int rangeIndex)
     

    Color Modes

    Bool IsPerRangeColorMode () const
     
    void SetColorMode (Bool perRange)
     
    Bool IsRandomColorMode () const
     
    void SetRandomColorMode (Bool random)
     

    Additional Inherited Members

    - Static Public Attributes inherited from CustomDataTypeT< CUSTOMDATATYPE_RANGE >
    static constexpr Int32 DATATYPEID
     

    Constructor & Destructor Documentation

    ◆ RangeData()

    RangeData ( )
    private

    ◆ ~RangeData()

    ~RangeData ( )
    private

    Member Function Documentation

    ◆ Alloc()

    static RangeData* Alloc ( )
    static

    Allocates a RangeData. Destroy the allocated RangeData with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

    Returns
    The allocated range data, or nullptr if the allocation failed.

    ◆ Free()

    static void Free ( RangeData *&  data)
    static

    Destructs RangeDatas allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

    Parameters
    [in,out]dataThe RangeData to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

    ◆ Init()

    Bool Init ( Int  rangeNumber)

    Initializes the range data with the passed range number. The interval in between ranges will be the same.

    Parameters
    [in]rangeNumberThe number of ranges.
    Returns
    true if successful, otherwise false.

    ◆ Reset()

    void Reset ( Bool  invalidateObject = false)

    Resets the range data to the initial state.

    Parameters
    [in]invalidateObjecttrue to initialize the ranges after reset operation, otherwise the object will be initialized but functions with one single range.

    ◆ CopyTo()

    void CopyTo ( RangeData dst) const

    Copy the range data over to dst.

    Parameters
    [in,out]dstThe destination range data. The caller owns the pointed range data..

    ◆ AddValue()

    Bool AddValue ( Float  value)

    Adds a value and split existing range.

    Parameters
    [in]valueThe value to add.
    Returns
    true if successful, otherwise false.

    ◆ GetCurrentValue()

    Float GetCurrentValue ( ) const

    Retrieves The current value.

    Returns
    The current value.

    ◆ SetCurrentValue()

    void SetCurrentValue ( Float  value)

    Sets the current value.

    Parameters
    [in]valueThe value, must be in the range [0.0, 1.0].

    ◆ GetKnotsCount()

    Int GetKnotsCount ( ) const

    Retrieves the numbers of knots.

    Returns
    The numbers of knots.

    ◆ SetKnotValue()

    Bool SetKnotValue ( Int  knotIndex,
    Float  value 
    )

    Sets the value at the specified knot index.

    Parameters
    [in]knotIndexThe knot index to set the value.
    [in]valueThe value to set.
    Returns
    true if successful, otherwise false.

    ◆ GetKnotValue()

    Float GetKnotValue ( Int  knotIndex) const

    Retrieves the value at the specified knot index.

    Parameters
    [in]knotIndexThe knot index.
    Returns
    The value.

    ◆ GetKnotIndexByValue()

    Int GetKnotIndexByValue ( Float  value) const

    Searches for a knot with the passed value.

    Parameters
    [in]valueThe value used to search the knot.
    Returns
    The knot index, or NOTOK if not found.

    ◆ DeleteKnot()

    void DeleteKnot ( Int  knotIndex)

    Deletes a knot at the specified knot index.

    Parameters
    [in]knotIndexThe knot index to delete.

    ◆ GetSelectedKnot()

    Int GetSelectedKnot ( ) const

    Retrieves the selected knot.

    Returns
    The selected knot index, or NOTOK if not found.

    ◆ SetSelectedKnot()

    void SetSelectedKnot ( Int  knotIndex)

    Sets the selected knot.

    Parameters
    [in]knotIndexThe index to select, or NOTOK to deselect all.

    ◆ GetRangesCount()

    Int GetRangesCount ( ) const

    The number of ranges, must be >= 1.

    Returns
    The number of ranges.

    ◆ GetRange()

    RangePair GetRange ( Int  index) const

    Retrieves the range at the specified index.

    Parameters
    [in]indexThe range index.
    Returns
    The range.

    ◆ GetRangeIndex()

    Int GetRangeIndex ( Float  value) const

    Returns a range index a value for the specified value.

    Parameters
    [in]valueThe value, must be in range [0.0, 1.0].
    Returns
    The range index.

    ◆ GetRangeColor()

    Vector GetRangeColor ( Int  index) const

    Retrieves the range color for the specified range index.

    Parameters
    [in]indexThe range index to get the color.
    Returns
    The range Color.

    ◆ SetRangeColor()

    void SetRangeColor ( Int  index,
    const Vector color 
    )

    Sets the range color at the specified range index.

    Note
    If IsPerRangeColorMode() returns false the range index is not evaluated and the color is stored always at the first index.
    Parameters
    [in]indexThe index of the range to set the color.
    [in]colorThe color to be assigned to the range.

    ◆ GetSelectedRange()

    Int GetSelectedRange ( ) const

    Retrieves the selected range.

    Returns
    The selected range index, or NOTOK if not found.

    ◆ SetSelectedRange()

    void SetSelectedRange ( Int  rangeIndex)

    Sets the selected range.

    Parameters
    [in]rangeIndexThe index to select, or NOTOK to deselect all.

    ◆ IsPerRangeColorMode()

    Bool IsPerRangeColorMode ( ) const

    Checks if the color mode is stored per range, or just as single color.

    Returns
    true if the color is stored is stored per range, otherwise false.

    ◆ SetColorMode()

    void SetColorMode ( Bool  perRange)

    Sets the mode indicating if the color need to be stored per range, or just as single color.

    Parameters
    [in]perRangetrue to store the color per range, false to store it just as single color.

    ◆ IsRandomColorMode()

    Bool IsRandomColorMode ( ) const

    Checks if the colors are randomized or user defined.

    Returns
    true if the colors are randomized, otherwise false.

    ◆ SetRandomColorMode()

    void SetRandomColorMode ( Bool  random)

    Sets the random color mode.

    Parameters
    [in]randomtrue to randomize colors, otherwise false.