TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class ColorRamp in Tinman.Terrain.Util

This class represents a color ramp.

sealed class ColorRamp extends ColorRampBase

Remarks

A color ramp consists of one or more color ramp slots; each slot holds an X-coordinate and a color value.

Configuration

Config

The configurator object for this type.

public static property Config { get }
type IConfigurator<IColorRamp>
value [not-null] The configurator object.

ToConfig

Returns the configuration value that describes this object.

public override method ToConfig ()
type ConfigValue
returns [not-null] The configuration value.
implements ColorRampBase.ToConfig

Remarks:

All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.

The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.

Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.

Serialization

SerialId

Serialization information about this type.

public static readonly field SerialId
type ISerialTypeInfo

Public / Constants

Earth

Default color ramp for Earth.

public static readonly field Earth
type IColorRamp

Remarks:

Use ellipsoid/geoid heights as input for the color ramp: -1000m .. 8000m.

Mars

Default color ramp for Mars.

public static readonly field Mars
type IColorRamp

Remarks:

Use areoid heights as input for the color ramp: -7500m .. 15000m.

Moon

Default color ramp for the Moon.

public static readonly field Moon
type IColorRamp

Remarks:

Use reference sphere heights as input for the color ramp: -9000m .. 10000m.

Outline

Default color ramp for outlines.

public static readonly field Outline
type IColorRamp

Remarks:

The outline color ramp looks like this:

 X | Y
---+------------------
-1 | opaque white
 0 | opaque gray
+1 | transparent gray

See also:

Colors.White
Colors.DimGray

Planet

Default color ramp for a planet.

public static readonly field Planet
type IColorRamp

Remarks:

Use normalized heights as input for the color ramp: -1 .. +1.

Pluto

Default color ramp for Pluto.

public static readonly field Pluto
type IColorRamp

Remarks:

Use reference sphere heights as input for the color ramp: -3000m .. 4000m.

Public / Attributes

Range

Returns the coordinate range of this color ramp.

public override property Range { get }
type RangeD
value The coordinate range.
implements ColorRampBase.Range

SerialType

Returns the serial type of this object.

public property SerialType { get }
type ISerialTypeInfo
value [not-null] The serial type.
inherited SerializableBase.SerialType

SerialVersion

Returns the serial data version.

public virtual property SerialVersion { get }
type int32
value [>=1] The serial data version tag.
inherited SerializableBase.SerialVersion

Remarks:

An ISerializable implementation is required to support all versions up to the one returned by SerialVersion.

See also:

ISerializable.Serialize
ISerializable.Deserialize

Public / Constructors

ColorRamp

Creates a new instance of ColorRamp.

public constructor ColorRamp ()

Creates a new instance of ColorRamp.

public constructor ColorRamp (int32 initialCapacity)
params initialCapacity [>=0] The initial capacity of the color ramp.

ForColor

Creates a color ramp with a single color.

public static method ForColor (int64 color)
type IColorRamp
params color The color ramp color.
returns [not-null] The created ColorRamp.

Remarks:

The color is placed at the X-coordinate 0.0.

ForColors

Creates a color ramp with two colors.

public static method ForColors (int64 colorA, int64 colorB, float64 coordA = 0, float64 coordB = 1)
type IColorRamp
params colorA The first color ramp color.
  colorB The second color ramp color.
  coordA Coordinate of colorA. Defaults to 0.0.
  coordB Coordinate of colorB. Defaults to 1.0.
returns [not-null] The created ColorRamp.

ForOutline

Creates a color ramp with three colors for outline rendering.

public static method ForOutline (int64 inside = Colors.White, int64 border = Colors.DimGray)
type IColorRamp
params inside The inside color. Defaults to White.
  border The border color. Defaults to DimGray.
returns [not-null] The created ColorRamp.

Remarks:

The returned color ramps contains these colors:

 X | Y
---+--------
-1 | inside
 0 | border
+1 | outside
where outside is the same color as border with its alpha channel set to zero.

ForRange

Returns a default color ramp for the given vertical range.

public static method ForRange (VerticalRange range, UnitOfMeasure unit = null)
type IColorRamp
params range The vertical range, in the given unit.
  unit The vertical unit. If null, Metre is used. Defaults to null.
returns [not-null] The default color ramp, using vertical coordinates in unit as input.

Public / Methods

Add

Adds a color on this color ramp.

public method Add (float64 coordinate, int64 color)
type ColorRamp
params coordinate Coordinate of color ramp slot.
  color Color value of color ramp slot (see Colors).
returns [not-null] this

Remarks:

The color ramp slots must be set so that the following condition is met:

x[i] >= x[i-1]
The X-coordinate of a color ramp slot must be greater than or equal to the X-coordinate of the preceding slot.

Deserialize

Initializes the state of this object from the given data stream.

public override method Deserialize (int32 serialVersion, ISerializer data)
type ISerializable
params serialVersion [>=1] The serial data version.
  data [not-null] The serial data stream.
returns [not-null] The deserialized object. This will typically be this, but in some circumstances, another instance may be returned (e.g. singletons).
overrides SerializableBase.Deserialize

Remarks:

The Deserialize method will be called immediately after the object has been instantiated via its default constructor.

The provided serialVersion number is guaranteed to be equal to or less than the SerialVersion returned by this object (i.e. ISerializable object must provide backwards compatibility).

See also:

ISerializable.Serialize
ISerializable.SerialVersion

Equals

Compares this object with the given one.

[Pure]
public override method Equals (IColorRamp other)
type bool
params other The object to compare to.
returns true if this object is equal to other, false if not.
implements ColorRampBase.Equals

Get

Returns an interpolated color on this color ramp.

public override method Get (float64 x)
type int64
params x Coordinate of color to return.
returns The color value.
implements ColorRampBase.Get

Index

Returns a color index on this color ramp.

public override method Index (float64 x)
type float64
params x Coordinate of color to return.
returns The color index.
implements ColorRampBase.Index

Modulate

Modulates the colors in this color ramp.

public override method Modulate (int64 color)
type IColorRamp
params color The color to modulate with.
returns [not-null] The resulting color ramp.
overrides ColorRampBase.Modulate

Serialize

Serializes the current state of this object to the given data stream.

public override method Serialize (ISerializer data)
params data [not-null] The serial data stream.
overrides SerializableBase.Serialize

See also:

ISerializable.Deserialize
ISerializable.SerialVersion

Set

Sets a color on this color ramp.

public method Set (int32 idx, float64 coordinate, int64 color)
type ColorRamp
params idx [>=0] Index of color ramp slot.
  coordinate Coordinate of color ramp slot.
  color Color value of color ramp slot (see Colors).
returns [not-null] this

Remarks:

The color ramp slots must be set so that the following condition is met:

x[i] >= x[i-1]
The X-coordinate of a color ramp slot must be greater than or equal to the X-coordinate of the preceding slot.

Transform

Transforms the input coordinate of this color ramp.

public virtual method Transform (float64 offset, float64 scale = 1)
type IColorRamp
params offset Offset value to add to scaled input X-coordinates.
  scale Scale factor to apply to input X-coordinates. Defaults to 1.
returns [not-null] The resulting color ramp.
inherited ColorRampBase.Transform

Remarks:

Input X-coordinates are transformed as follows:

xOut = offset + scale * xIn
xIn  = (xOut - offset) / scale
     = xOut / scale - offset / scale
where xIn refers to the coordinate passed to the returned color ramp and xOut is the coordinate that is passed to this color ramp.