User Tools

Site Tools


api:dk11:delphi:gistypesui.tgis_gradientmap.realizecolormap_tgis_colormapmode_integer_boolean

TGIS_GradientMap.RealizeColorMap method

DK for Delphi | GisTypesUI.TGIS_GradientMap.RealizeColorMap | Constructors | Methods | Properties

Prepares a colormap as requested.

Available also on: .NET | Java | ActiveX | Python.

Syntax

// Delphi
public
  function RealizeColorMap(
    const _mode : TGIS_ColorMapMode = TGIS_ColorMapMode.Continuous;
    const _subClass : Integer = 0;
    const _reverse : Boolean = False
  ) : TGIS_ColorMapArray;
// C++ Builder
public:
  TGIS_ColorMapArray* RealizeColorMap(
    TGIS_ColorMapMode* const _mode,
    const int _subClass,
    const bool _reverse
  );

Parameters

Name Type Description
_mode TGIS_ColorMapMode colormap mode (continuous by default or discrete)
_subClass Integer if available, gets subclass of a ramp with specified, or the possible nearest to specified, number of colors; if 0, gets default colormap (this is the default parameter);
_reverse Boolean if True, reverses colors from colormap (False is the default parameter);

Result

Type Description
TGIS_ColorMapArray Array of a colormap.

Remarks

Mode

Color ramps can be prepared in continuous or discrete mode by setting desired TGIS_ColorMapMode to the _mode parameter.

Continuous mode (default) Discrete mode

Subclasses

Some ramps, besides the default definition, have versions prepared with a specific number of colors. Using _subclass parameter, you can request a colormap with a defined number of colors, if suchcolormap representation exist.

Three different representations of YellowGreenBlue color ramp.
Color ramp with 3 colors (subclass=3) Default color ramp definition (subclass=0) Color ramp with 9 colors (subclass=9)

Reverse colors

Colors in a ramps can be reversed by setting the _reverse parameter to True.

Default color ramp definition (reverse=False) Reversed color ramp (reverse=True)

Example

Below are a few examples of how to apply a specified color ramp to a grid layer.

// pseudocode
min_value = grid_layer.MinHeight
max_value = grid_layer.MaxHeight
 
// default representation of 'ElevationDark' color ramp
color_ramp = TGIS_Utils.GisColorRampList.ByName(TGIS_ColorRampNames.ElevationDark)
color_map = color_ramp.RealizeColorMap(TGIS_ColorMapMode.Continuous, 0, false)
grid_layer.GenerateRampEx(min_value, max_value, color_map, None)
 
// discrete representation of 'Accent' color ramp with maximum number of colors
color_ramp = TGIS_Utils.GisColorRampList.ByName(TGIS_ColorRampNames.Accent)
color_map = color_ramp.RealizeColorMap(TGIS_ColorMapMode.Discrete, -1, false)
grid_layer.GenerateRampEx(min_value, max_value, color_map, None)
 
// inverted continuous representation of 'Spectral' color ramp, get subclass with 3 colors
color_ramp = TGIS_Utils.GisColorRampList.ByName(TGIS_ColorRampNames.Spectral)
color_map = color_ramp.RealizeColorMap(TGIS_ColorMapMode.Continuous, 3, true)
grid_layer.GenerateRampEx(min_value, max_value, color_map, None)

References

2025/03/12 17:34

Page Tools