The Terrain Analysis Engine provides support to compute and display hypsometric views of elevation data.

Hypsometric calculations in a GXY view

The functionality is demonstrated in the example MainPanel. The example creates a standard layer containing an earth repository, and then adds five hypsometric layers of the same model, showing shading, slope, ridge/valley, orientation, and orientation angle, respectively. When creating a hypsometric layer, an ILcdHypsometricValueProvider needs to be created. This provider computes hypsometric values based on elevation information. The Terrain Analysis Engine comes with value providers for a number of common hypsometric views:

  • TLcdHypsometricSlope: computes the cosine of the angle between a given 3D reference direction and the normal.

  • TLcdHypsometricSlopeAngle: computes the angle between a given 3D reference direction and the normal.

  • TLcdHypsometricOrientation: computes the cosine of the angle between a given reference direction in the xy plane and the direction of steepest descent.

  • TLcdHypsometricOrientationAngle: computes the angle between a given reference direction in the xy plane and the direction of steepest descent.

  • TLcdHypsometricCrease: computes the ridges and valleys of a terrain. It is a measure for how strongly the terrain deviates from a locally fitted plane.

As shown in Program: Creation of a hypsometric GXY layer., the value provider is used to create a hypsometric ILcdGXYPainterProvider. This provider will paint the hypsometric values as specified in the supplied color model.

Program: Creation of a hypsometric GXY layer. (from samples/tea/gxy/hypsometry/MainPanel)
private ILcdGXYLayer createHypsometricRasterLayer(ILcdModel aModel,
                                                  String aLabel,
                                                  boolean aVisible,
                                                  ILcdHypsometricValueProvider aHypsometricValueProvider,
                                                  ColorModel aHypsometricColorModel) {

  TLcdGXYLayer gxyLayer = new TLcdGXYLayer();
  gxyLayer.setModel(aModel);
  gxyLayer.setLabel(aLabel);
  gxyLayer.setVisible(aVisible);

  // Create a painter to paint hypsometric rasters or multilevel rasters.
  TLcdHypsometricTileFactory tileFactory = new TLcdHypsometricTileFactory(
      aHypsometricValueProvider,
      HypsometryUtil.MINIMUM_HYPSOMETRIC_VALUE,
      HypsometryUtil.MAXIMUM_HYPSOMETRIC_VALUE,
      HypsometryUtil.UNKNOWN_HYPSOMETRIC_VALUE,
      aHypsometricColorModel,
      TLcdSharedBuffer.getBufferInstance()
  );

  ILcdHypsometricRasterFactory rasterFactory =
      new TLcdHypsometricRasterFactory(tileFactory, HypsometryUtil.UNKNOWN_HYPSOMETRIC_VALUE);

  ILcdHypsometricMultilevelRasterFactory multilevelRasterFactory =
      new TLcdHypsometricMultilevelRasterFactory(rasterFactory);

  ILcdGXYPainterProvider painter = null;
  if (aModel.getModelDescriptor() instanceof TLcdRasterModelDescriptor) {
    painter = new TLcdHypsometricRasterPainter(rasterFactory);
  } else if (aModel.getModelDescriptor() instanceof TLcdMultilevelRasterModelDescriptor) {
    painter = new TLcdHypsometricMultilevelRasterPainter(multilevelRasterFactory);
  } else if (aModel.getModelDescriptor() instanceof ILcdEarthModelDescriptor) {
    painter = new TLcdHypsometricEarthPainter(tileFactory);
  }

  // The painters can act as their own painter providers.
  gxyLayer.setGXYPainterProvider(painter);

  return gxyLayer;
}

Just like elevation decoders typically load and cache elevation rasters on the fly, the hypsometric painters compute and cache the hypsometric rasters on the fly. The size of the shared buffer that is passed can have an important impact on the performance of the application, as it is generally used to cache the loaded elevation tiles and the computed hypsometric tiles.

Hypsometric calculations in a Lightspeed view

The functionality is demonstrated in the samples.tea.lightspeed.hypsometry example. It creates a raster layer containing an Earth model, and then adds a hypsometric shading layer. You can use the panel on the left to switch set the layer for which is used as data source and switch the calculation type between shading, slope, ridges and valleys, orientation, and azimuth.

You can create a hypsometric shading layer by using the TLspHypsometricShadingLayerBuilder, as demonstrated in Program: Creation of a hypsometric shading layer.. A hypsometric layer requires an elevation data source, a shader and a color model. As elevation data source you can either use the terrain of the Lightspeed view or a specific model with elevation data. The shader determines the type of hypsometric calculation performed by the layer. You can create shaders matching the available implementations of ILcdHypsometricValueProvider. Finally the color model determines how the hypsometric values are mapped to colors on screen. The shader and color model of the layer can be still be changed after creating the layer.

Program: Creation of a hypsometric shading layer. (from samples/tea/lightspeed/hypsometry/MainPanel)
private ILspEditableStyledLayer createHypsometricShadingLayer(ILcdModel aElevationModel, ALspHypsometricShader aShader, IndexColorModel aColorModel) {
  TLspHypsometricShadingLayerBuilder builder =
      TLspHypsometricShadingLayerBuilder.newBuilder().
          styler(TLspPaintRepresentationState.REGULAR_BODY, TLspHypsometricShadingStyle.newBuilder().shader(aShader).colorModel(aColorModel).build()).
          label("Hypsometry");
  if(aElevationModel == null) {
    // Use the view's terrain as the elevation data source
    builder.elevationFromView();
  }
  else {
    // Use a specific model as the elevation data source
    builder.elevationFromModel(aElevationModel);
  }
  return builder.build();
}