Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2024.
Loading...
Searching...
No Matches
SColorGradient Class Reference

Allow the user to edit a color gradient. More...

Public Types

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

Public Member Functions

Object AddCursor (number position)
 Add a new cursor in the color gradient. More...
 
Object DeleteCursor (number index)
 Remove a cursor of the color gradient. More...
 
Object GetColorFromValue (number value)
 Get the color corresponding to a specific value in the gradient. More...
 
Object GetColUndefined ()
 Get the undefined color of the color gradient. More...
 
Object GetCursorInfo (number index)
 Get information about cursor with given index. More...
 
number GetNbCursor ()
 Get the number of cursors in the SColorGradient. More...
 
number GetNbCursorMax ()
 Get the maximal number of cursors you can have in this SColorGradient. More...
 
Object GetRange ()
 Get the maximal and minimal value of the color gradient. More...
 
Object SetColAfter (number index, number red, number green, number blue, number alpha=-1)
 Set the color of a cursor after the value of the cursor. More...
 
Object SetColBefore (number index, number red, number green, number blue, number alpha=-1)
 Set the color of a cursor before the value of the cursor. More...
 
 SetColUndefined (number red, number green, number blue, number alpha=-1)
 Set the undefined color of the color gradient. More...
 
Object SetCursorPos (number index, number position)
 Set the position of the cursor with given index. More...
 
 SetDisplayOption (DisplayFlag displayPalette)
 Choose how the palette will be displayed. More...
 
 SetInterpolation (Interpolation method)
 Define how the color is interpolated between 2 cursors. More...
 
 SetMagnification (number magnification)
 Enlarge the hair diagram (only for inspected SPolyline) More...
 
Object SetNbCursor (number nbCursor)
 Set the number of cursors of the color gradient. More...
 
Object SetRange (number minValue, number maxValue)
 Update the min and max values of the color gradient, and delete all invalid pegs. More...
 
string toString ()
 Get the type of the variable. More...
 

Detailed Description

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 

The gradient is not displayed.

SHOW_FOREGROUND 

The gradient is displayed in foreground.

SHOW_BACKGROUND 

The gradient is displayed in background.

◆ Interpolation

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

Enumerator
Linear 

Linear interpolation.

HSLCounterClockwise 

HSL Counter clockwise interpolation.

HSLClockwise 

HSL clockwise interpolation.

HSLShortest 

HSL shortest interpolation.

HSLLongest 

HSL longest interpolation.

Member Function Documentation

◆ AddCursor()

Object SColorGradient::AddCursor ( number  position)

Add a new cursor in the color gradient.

Note
You cannot add more cursor than the maximal number of cursors allowed
See also
GetNbCursorMax()
Parameters
position(number) The position of the new cursor
Return values
ret.ErrorCode(number) The error code.
  • 0: No error
  • 1: Impossible to add a new cursor, limit reached
ret.Index(number) The index of your new cursor

◆ DeleteCursor()

Object SColorGradient::DeleteCursor ( number  index)

Remove a cursor 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.
Parameters
index(number) The index of the cursor to remove
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: The index of the cursor is invalid

◆ GetColorFromValue()

Object SColorGradient::GetColorFromValue ( number  value)

Get the color corresponding to a specific value in the gradient.

Parameters
value(number) The value to get the color
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: The index of the cursor is invalid
ret.Red(number) The red color (between 0 and 1)
ret.Green(number) The green color (between 0 and 1)
ret.Blue(number) The blue color (between 0 and 1)

◆ GetColUndefined()

Object SColorGradient::GetColUndefined ( )

Get the undefined color of the color gradient.

Return values
ret.Red(number) The undefined red color (between 0 and 1)
ret.Green(number) The undefined green color (between 0 and 1)
ret.Blue(number) The undefined blue color (between 0 and 1)

◆ GetCursorInfo()

Object SColorGradient::GetCursorInfo ( number  index)

Get information about cursor with given index.

Parameters
index(number) The index of the cursor.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: The index of the cursor is invalid
ret.RedBefore(number) The red color before the cursor (between 0 and 1).
ret.GreenBefore(number) The green color before the cursor (between 0 and 1).
ret.BlueBefore(number) The blue color before the cursor (between 0 and 1).
ret.RedAfter(number) The red color after the cursor (between 0 and 1).
ret.GreenAfter(number) The green color after the cursor (between 0 and 1).
ret.BlueAfter(number) The blue color after the cursor (between 0 and 1).
ret.Position(number) The position of the cursor.

◆ GetNbCursor()

number SColorGradient::GetNbCursor ( )

Get the number of cursors in the SColorGradient.

Returns
(number) The number of cursors

◆ GetNbCursorMax()

number SColorGradient::GetNbCursorMax ( )

Get the maximal number of cursors you can have in this SColorGradient.

Returns
(number) The maximal number of cursors.

◆ GetRange()

Object SColorGradient::GetRange ( )

Get the maximal and minimal value of the color gradient.

Return values
ret.Max(number) The maximal value.
ret.Min(number) The minimal value.

◆ SetColAfter()

Object SColorGradient::SetColAfter ( number  index,
number  red,
number  green,
number  blue,
number  alpha = -1 
)

Set the color of a cursor after the value of the cursor.

Parameters
index(number) The index of the cursor (between 0 and the number of cursors)
red(number) The red color (between 0 and 1)
green(number) The green color (between 0 and 1)
blue(number) The blue color (between 0 and 1)
alpha(number) The alpha value (between 0 and 1) or a negative value to keep the current value
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: The index of the cursor is invalid

◆ SetColBefore()

Object SColorGradient::SetColBefore ( number  index,
number  red,
number  green,
number  blue,
number  alpha = -1 
)

Set the color of a cursor before the value of the cursor.

Parameters
index(number) The index of the cursor (between 0 and the number of cursors)
red(number) The red color (between 0 and 1)
green(number) The green color (between 0 and 1)
blue(number) The blue color (between 0 and 1)
alpha(number) The alpha value (between 0 and 1) or a negative value to keep the current value
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: The index of the cursor is invalid

◆ SetColUndefined()

SColorGradient::SetColUndefined ( number  red,
number  green,
number  blue,
number  alpha = -1 
)

Set the undefined color of the color gradient.

Parameters
red(number) The red color (between 0 and 1)
green(number) The green color (between 0 and 1)
blue(number) The blue color (between 0 and 1)
alpha(number) The alpha value (between 0 and 1) or a negative value to keep the current value

◆ SetCursorPos()

Object SColorGradient::SetCursorPos ( number  index,
number  position 
)

Set the position of the cursor with given index.

Note
Range can be updated if position is outside the range.
Warning
The 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.
Parameters
index(number) The index of the cursor to update
position(number) The position to set.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: The index of the cursor is invalid

◆ SetDisplayOption()

SColorGradient::SetDisplayOption ( DisplayFlag  displayPalette)

Choose how the palette will be displayed.

Note
SetRepresentationType(SCloud.INSPECTION); can be necessary
Parameters
displayPalette(DisplayFlag) The display option to use

◆ SetInterpolation()

SColorGradient::SetInterpolation ( Interpolation  method)

Define how the color is interpolated between 2 cursors.

Parameters
method(Interpolation) The interpolation method to use.

◆ SetMagnification()

SColorGradient::SetMagnification ( number  magnification)

Enlarge the hair diagram (only for inspected SPolyline)

Parameters
magnification(number) The magnification factor (> 0)

◆ SetNbCursor()

Object SColorGradient::SetNbCursor ( number  nbCursor)

Set the number of cursors of the color gradient.

Note
You can set from 2 cursors to SColorGradient.GetNbCursorMax() cursors, each of the band will have a unique color.
Parameters
nbCursor(number) The number of cursors to set.
Return values
ret.ErrorCode(number) The error code.
  • 0: No error
  • 1: The number of cursors is invalid

◆ SetRange()

Object SColorGradient::SetRange ( number  minValue,
number  maxValue 
)

Update the min and max values of the color gradient, and delete all invalid pegs.

Parameters
minValue(number) The minimal value of the SColorGradient
maxValue(number) The maximal value of the SColorGradient
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: The min value is higher than the max value, nothing is done.
  • 2: An error occurred or the gradient is not valid.

◆ toString()

string SColorGradient::toString ( )

Get the type of the variable.

Returns
(string) The type name