ColormapManager.h

Classes

ColormapManager -- Class to manage registration of colormaps on PixelCanvasColorTables (full description)

class ColormapManager

Interface

Public Members
ColormapManager(PixelCanvasColorTable *pcctbl)
virtual ~ColormapManager()
void registerColormap(Colormap * dcmap, Float weight = 1.0)
void registerColormap(Colormap *cmap, Colormap *cmapToReplace)
Bool unregisterColormap(Colormap * dcmap)
uInt getColormapSize(const Colormap * map) const
uInt getColormapOffset(const Colormap * map) const
void redistributeColormaps()
void reinstallColormaps()
Bool member(const Colormap * map) const
uInt nMaps() const
const Colormap *getMap(const uInt mapnum) const
friend ostream & operator << (ostream & os, const ColormapManager & cm)

Description

Review Status

Reviewed By:
None yet
Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This class manages a set of colormaps and dynamically maintains both their allocation on the colortable and the colortable's colors.

Synopsis

The colormap manager is a management tool which facilitates the dynamic mapping of 1 or more Colormaps to a single PixelCanvasColorTable.

The colormap manager manages the assignment of data colormaps, which define the function that generates the color spectrum to use, to the hardware colormap which defines how many cells are available. As Colormaps are registerd and unregistered, the manager reorganizes the colors on the colormap and reinstalls the maps in response. The colormap manager also registers a resize callback with the pixel canvas colormap. This allows the application to resize the hardware colormap and have all colormaps adjusted as appropriate.

The calling program can at any time ask for the size of a given colormap and use that size to map real-world values into a range appropriate for display (see the PixelCanvas class' getColormapSize() and mapToColor() functions.

Because the colormap manager can control the distribution of its Colormaps, application code must issue a call to redistribute if it decides to change the size of the colortable on its own.

Motivation

Needed to have tool available to help manage more than one colormap.

Member Description

ColormapManager(PixelCanvasColorTable *pcctbl)

Constructor requires pointer to the PixelCanvasColorTable which it will manage.

virtual ~ColormapManager()

Destructor.

void registerColormap(Colormap * dcmap, Float weight = 1.0)

Register a Colormap with this ColormapManager, and optionally pass a weight - colormaps are distributed proportionally according to their weight.

void registerColormap(Colormap *cmap, Colormap *cmapToReplace)

Register the cmap Colormap with this manager, replacing the cmapToReplace<src> Colormap if possible.

Bool unregisterColormap(Colormap * dcmap)

Unregister a Colormap with this ColormapManager.

uInt getColormapSize(const Colormap * map) const

Return the current size of the colormap.

uInt getColormapOffset(const Colormap * map) const

Return the current offset of the colormap.

void redistributeColormaps()

Redistribute the available colorcells to the registered colormaps.

void reinstallColormaps()

Reinstall the colorcell values.

Bool member(const Colormap * map) const

Is the given Colormap registered on this ColormapManager/PixelCanvasColorTable combination?

uInt nMaps() const

Return the number of registered Colormaps.

const Colormap *getMap(const uInt mapnum) const

Return a pointer to a Colormap by number.

friend ostream & operator << (ostream & os, const ColormapManager & cm)

Stream output operator.