Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2021.
SColorGradient Class Reference

The SColorGradient class allow the user to edit a color gradient.
You cannot create a new color gradient. You can access to it by calling GetColorGradient() on a SMultiline, SPoly or SCloud. With this class you can manipulate color and cursor position of an existing color gradient. More...

Inheritance diagram for SColorGradient:
SObject

Public Types

enum  DisplayFlag { HIDE , SHOW_FOREGROUND , SHOW_BACKGROUND }
 Available options for the display of the gradient palette
Use SColorGradient.HIDE. More...
 
enum  Interpolation {
  Linear , HSLCounterClockwise , HSLClockwise , HSLShortest ,
  HSLLongest
}
 Interpolation method to define how the color is interpolate between two cursors. More...
 

Public Slots

Array AddCursor (Number Position)
 Add a new cursor in the color gradient. More...
 
Array DeleteCursor (Number Index)
 Remove a peg of the color gradient. More...
 
Array GetColorFromValue (Number value)
 To color from a specific value in the gradient. More...
 
Array GetColUndefined ()
 To get the undefined color of the color gradient. More...
 
Array GetCursorInfo (Number Index)
 To get cursor information. More...
 
Number GetNbCursor ()
 
Number GetNbCursorMax ()
 
Array GetRange ()
 To get the maximal and minimal value of the color gradient. More...
 
Array SetColAfter (Number Index, Number Red, Number Green, Number Blue, Number Alpha=-1)
 To set the color of a cursor after the value of the cursor. More...
 
Array SetColBefore (Number Index, Number Red, Number Green, Number Blue, Number Alpha=-1)
 To set the color of a cursor before the value of the cursor. More...
 
 SetColUndefined (Number Red, Number Green, Number Blue, Number Alpha=-1)
 To set the undefined color of the color gradient. More...
 
Array SetCursorPos (Number Index, Number Position)
 To set position of an indexed peg. More...
 
 SetDisplayOption (DisplayFlag DisplayPalette)
 You can choose how the palette will be displayed. More...
 
 SetInterpolation (Interpolation Method)
 To define how the color is interpolated between 2 cursors. More...
 
 SetMagnification (Number magnification)
 You can set the magnification (only for polyline inspection) More...
 
Array SetNbCursor (Number NbCursor)
 To set the number of cursors of the color gradient
You can set from 2 cursors to GetNbCursorMax() cursors, each of the band will have a unique color. More...
 
Array SetRange (Number MinValue, Number MaxValue)
 To set the maximal and minimal value of the color gradient. More...
 
String toString ()
 Get the type of the variable. More...
 
- Public Slots inherited from SObject
 Clear ()
 To deallocate memory of the object. More...
 
String toString ()
 Get the type of the variable. More...
 

Detailed Description

The SColorGradient class allow the user to edit a color gradient.
You cannot create a new color gradient. You can access to it by calling GetColorGradient() on a SMultiline, SPoly or SCloud. With this class you can manipulate color and cursor position of an existing color gradient.

Member Enumeration Documentation

◆ DisplayFlag

Available options for the display of the gradient palette
Use SColorGradient.HIDE.

Enumerator
HIDE 

Gradient is not displayed

SHOW_FOREGROUND 

Gradient is displayed in foreground

SHOW_BACKGROUND 

Gradient is displayed in background

◆ Interpolation

Interpolation method to define how the color is interpolate between two cursors.

Enumerator
Linear 
HSLCounterClockwise 
HSLClockwise 
HSLShortest 
HSLLongest 

Member Function Documentation

◆ AddCursor

Array SColorGradient::AddCursor ( Number  Position)
slot

Add a new cursor in the color gradient.

Note
You cannot add more cursor than the maximal number of cursor allowed
See also
GetNbCursorMax()
Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 Impossible to add a new cursor, limit reached
Array.Indexindex of your new cursor

◆ DeleteCursor

Array SColorGradient::DeleteCursor ( Number  Index)
slot

Remove a peg of the color gradient.

Note
You cannot remove the first and the last cursor of the color gradient.
At least the color gradient must have 2 cursors.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 Index of the cursor is invalid

◆ GetColorFromValue

Array SColorGradient::GetColorFromValue ( Number  value)
slot

To color from a specific value in the gradient.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 Index of the cursor is invalid
Array.RedThe undefined red color between [0-1]
Array.GreenThe undefined green color between [0-1]
Array.BlueThe undefined blue color between [0-1]

◆ GetColUndefined

Array SColorGradient::GetColUndefined ( )
slot

To get the undefined color of the color gradient.

Return values
Array.RedThe undefined red color between [0-1]
Array.GreenThe undefined green color between [0-1]
Array.BlueThe undefined blue color between [0-1]

◆ GetCursorInfo

Array SColorGradient::GetCursorInfo ( Number  Index)
slot

To get cursor information.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 Index of the cursor is invalid
Array.RedBeforeThe red color before the cursor between [0-1].
Array.GreenBeforeThe green color before the cursor between [0-1].
Array.BlueBeforeThe blue color before the cursor between [0-1].
Array.RedAfterThe red color after the cursor between [0-1].
Array.GreenAfterThe green color after the cursor between [0-1].
Array.BlueAfterThe blue color after the cursor between [0-1].
Array.PositionThe position of the cursor.

◆ GetNbCursor

Number SColorGradient::GetNbCursor ( )
slot
Return values
Numberof cursor of the color gradient

◆ GetNbCursorMax

Number SColorGradient::GetNbCursorMax ( )
slot
Return values
Numbermaximal of cursor you can have in this color gradient

◆ GetRange

Array SColorGradient::GetRange ( )
slot

To get the maximal and minimal value of the color gradient.

Return values
Array.MaxMaximal value.
Array.MinMinimal value.

◆ SetColAfter

Array SColorGradient::SetColAfter ( Number  Index,
Number  Red,
Number  Green,
Number  Blue,
Number  Alpha = -1 
)
slot

To set the color of a cursor after the value of the cursor.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 Index of the cursor is invalid
Parameters
[in]Indexindex of the cursor between 0 and the number of cursor
[in]RedRed color between [0-1]
[in]GreenGreen color between [0-1]
[in]BlueBlue color between [0-1]
[in]AlphaAlpha value [0-1]. If < 0, do not change the current alpha

◆ SetColBefore

Array SColorGradient::SetColBefore ( Number  Index,
Number  Red,
Number  Green,
Number  Blue,
Number  Alpha = -1 
)
slot

To set the color of a cursor before the value of the cursor.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 Index of the cursor is invalid
Parameters
[in]Indexindex of the cursor between 0 and the number of cursor
[in]RedRed color between [0-1]
[in]GreenGreen color between [0-1]
[in]BlueBlue color between [0-1]
[in]AlphaAlpha value [0-1]. If < 0, do not change the current alpha

◆ SetColUndefined

SColorGradient::SetColUndefined ( Number  Red,
Number  Green,
Number  Blue,
Number  Alpha = -1 
)
slot

To set the undefined color of the color gradient.

Parameters
[in]RedRed color between [0-1]
[in]GreenGreen color between [0-1]
[in]BlueBlue color between [0-1]
[in]AlphaAlpha value [0-1]. If < 0, do not change the current alpha

◆ SetCursorPos

Array SColorGradient::SetCursorPos ( Number  Index,
Number  Position 
)
slot

To set position of an indexed peg.

Note
Range can be update if position is upper.
Warning
Cursor order is sorted each time you change position. It will set cursor with maximal value first, and cursor with minimal value as the last.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 Index of the cursor is invalid

◆ SetDisplayOption

SColorGradient::SetDisplayOption ( DisplayFlag  DisplayPalette)
slot

You can choose how the palette will be displayed.

Note
SetRepresentationType(SCloud.INSPECTION); can be necessary

◆ SetInterpolation

SColorGradient::SetInterpolation ( Interpolation  Method)
slot

To define how the color is interpolated between 2 cursors.

◆ SetMagnification

SColorGradient::SetMagnification ( Number  magnification)
slot

You can set the magnification (only for polyline inspection)

Parameters
magnificationgreater than 0

◆ SetNbCursor

Array SColorGradient::SetNbCursor ( Number  NbCursor)
slot

To set the number of cursors of the color gradient
You can set from 2 cursors to GetNbCursorMax() cursors, each of the band will have a unique color.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 The number of cursor is invalid
Parameters
[in]NbCursorNumber of cursor you want between 2 and GetNbCursorMax()

◆ SetRange

Array SColorGradient::SetRange ( Number  MinValue,
Number  MaxValue 
)
slot

To set the maximal and minimal value of the color gradient.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 the min value is upper than the max value, nothing is done
Parameters
MinValuethe minimal value of the color gradient
MaxValuethe maximal value of the color gradient

◆ toString

String SColorGradient::toString ( )
slot

Get the type of the variable.