Relief shading – Pitney Bowes MapXtreme User Manual

Page 324

Advertising
background image

Chapter 17: Working with Rasters and Grids

Grid Style

MapXtreme v7.1

331

Developer Guide

This process is also incorporated into the Grid Style dialog in Workspace Manager. See

Grid Style

.

L

If you change either the values or percentages while the inflection methods are set to Equal
Value Ranges or Equal Cell Count, the methods become Custom Value Range and Custom
Cell Count, respectively.

Changes to inflection values and colors can be persisted to a workspace and loaded at a later time.

Calculating Inflection Values and Colors for a Grid Layer

You can calculate inflection values and colors programmatically or through the Grid Style dialog in
Workspace Manager. The GridForm sample application also provides this capability.

GridInflectionCalculator Class

The following code example shows how to create an initial set of values and colors and then modify
them. This code example is provided in the Developer Reference API documentation under the
MapInfo.Raster.GridInflectionCalculator class.

public static void MapInfo_Raster_GridInflectionCalculator(TableInfoGrid
tableInfoGrid)
{
// Create 10 grid inflection values, by using the EqualRangeValues
method, using colors from orange to red.
GridInflectionCalculator gridInflectionCalculator = new
GridInflectionCalculator(tableInfoGrid,
InflectionMethod.EqualRangeValues, 10, Color.Orange, Color.Red);

// Modify the colors to go from green to brown.
gridInflectionCalculator.CalculateStyles(Color.Green, Color.Brown);

// Calculate 5 grid inflection values, by using the EqualRangeValues
method.

gridInflectionCalculator.CalculateValues(InflectionMethod.EqualRangeValue
s, 5);

}

Relief Shading

In addition to the color gradations, grid images can also show hill, or relief, shading. Relief shading
allows the grid surface to be shaded according to a virtual light source. The brightness of each grid
cell corresponds to the light striking the surface and is adjusted based on its orientation to the light
source. This is well suited for elevation grid maps where you can take surface slope and direction
into account relative to the direction of the light. Maximum brightness is assigned at points where the
sun’s rays are perpendicular to the surface. As the slope faces turn away from the light source, the
brightness values are lower.

Advertising