casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Attributes | Friends
casa::ColormapManager Class Reference

Class to manage registration of colormaps on PixelCanvasColorTables. More...

#include <ColormapManager.h>

List of all members.

Public Member Functions

 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 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 ColormapgetMap (const uInt mapnum) const
 Return a pointer to a Colormap by number.

Private Attributes

PixelCanvasColorTableitsPCColorTable
 Pointer to managed PixelCanvasColorTable.
SimpleOrderedMap< const
Colormap *, ColormapInfo * > 
itsInfoMap
 Map which associates Colormap pointers with ColormapInfo.

Friends

ostream & operator<< (ostream &os, const ColormapManager &cm)
 Stream output operator.

Detailed Description

Class to manage registration of colormaps on PixelCanvasColorTables.

Intended use:

Internal

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.

Definition at line 93 of file ColormapManager.h.


Constructor & Destructor Documentation

Constructor requires pointer to the PixelCanvasColorTable which it will manage.

Destructor.


Member Function Documentation

Return the current offset of the colormap.

Referenced by casa::PixelCanvasColorTable::getColormapOffset().

Return the current size of the colormap.

const Colormap* casa::ColormapManager::getMap ( const uInt  mapnum) const

Return a pointer to a Colormap by number.

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

uInt casa::ColormapManager::nMaps ( ) const [inline]

Return the number of registered Colormaps.

Definition at line 134 of file ColormapManager.h.

References itsInfoMap, and casa::SimpleOrderedMap< K, V >::ndefined().

Redistribute the available colorcells to the registered colormaps.

void casa::ColormapManager::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 casa::ColormapManager::registerColormap ( Colormap cmap,
Colormap cmapToReplace 
)

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

Reinstall the colorcell values.

Unregister a Colormap with this ColormapManager.


Friends And Related Function Documentation

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

Stream output operator.


Member Data Documentation

Map which associates Colormap pointers with ColormapInfo.

Definition at line 148 of file ColormapManager.h.

Referenced by nMaps().

Pointer to managed PixelCanvasColorTable.

Definition at line 145 of file ColormapManager.h.


The documentation for this class was generated from the following file: