OpenCMISS-Zinc C++ API Documentation
Public Types | Public Member Functions | Protected Attributes | List of all members
OpenCMISS::Zinc::Spectrum Class Reference

Zinc Spectrum maps values of graphics data fields to colours. More...

#include <spectrum.hpp>

Public Types

enum  ChangeFlag {
  CHANGE_FLAG_NONE = CMZN_SPECTRUM_CHANGE_FLAG_NONE, CHANGE_FLAG_ADD = CMZN_SPECTRUM_CHANGE_FLAG_ADD, CHANGE_FLAG_REMOVE = CMZN_SPECTRUM_CHANGE_FLAG_REMOVE, CHANGE_FLAG_IDENTIFIER = CMZN_SPECTRUM_CHANGE_FLAG_IDENTIFIER,
  CHANGE_FLAG_DEFINITION = CMZN_SPECTRUM_CHANGE_FLAG_DEFINITION, CHANGE_FLAG_FULL_RESULT = CMZN_SPECTRUM_CHANGE_FLAG_FULL_RESULT, CHANGE_FLAG_FINAL = CMZN_SPECTRUM_CHANGE_FLAG_FINAL
}
 
typedef int ChangeFlags
 

Public Member Functions

 Spectrum (cmzn_spectrum_id in_spectrum_id)
 
 Spectrum (const Spectrum &spectrum)
 
Spectrumoperator= (const Spectrum &spectrum)
 
bool isValid () const
 
cmzn_spectrum_id getId () const
 
bool isManaged ()
 
int setManaged (bool value)
 
int beginChange ()
 
int endChange ()
 
char * getName ()
 
int setName (const char *name)
 
int getNumberOfSpectrumcomponents ()
 
Spectrumcomponent createSpectrumcomponent ()
 
Spectrumcomponent getFirstSpectrumcomponent ()
 
Spectrumcomponent getNextSpectrumcomponent (const Spectrumcomponent &refComponent)
 
Spectrumcomponent getPreviousSpectrumcomponent (const Spectrumcomponent &refComponent)
 
int moveSpectrumcomponentBefore (const Spectrumcomponent &component, const Spectrumcomponent &refComponent)
 
int removeSpectrumcomponent (const Spectrumcomponent &component)
 
int removeAllSpectrumcomponents ()
 
bool isMaterialOverwrite ()
 
int setMaterialOverwrite (bool overwrite)
 
int autorange (const Scene &scene, const Scenefilter &scenefilter)
 

Protected Attributes

cmzn_spectrum_id id
 

Detailed Description

Zinc Spectrum maps values of graphics data fields to colours.

A Zinc Spectrum maps values of graphics data fields to colours. It consists of a list of spectrumcomponent objects which combine to give the overall colouring.

See also
Spectrumcomponent

Member Typedef Documentation

Type for passing logical OR of ChangeFlag

See also
Spectrummoduleevent::getSpectrumChangeFlags

Member Enumeration Documentation

Bit flags summarising changes to a spectrum or spectrums in a spectrummodule.

Enumerator
CHANGE_FLAG_NONE 

spectrum(s) not changed

CHANGE_FLAG_ADD 

one or more spectrums added

CHANGE_FLAG_REMOVE 

one or more spectrums removed

CHANGE_FLAG_IDENTIFIER 

spectrum identifier changed

CHANGE_FLAG_DEFINITION 

change to spectrum attributes other than identifier.

CHANGE_FLAG_FULL_RESULT 

all resultant values of spectrum changed.

CHANGE_FLAG_FINAL 

final notification: owning spectrum module i.e. spectrum module has been destroyed

Member Function Documentation

int OpenCMISS::Zinc::Spectrum::autorange ( const Scene scene,
const Scenefilter scenefilter 
)
inline

Set the minimum and maximum value for the specified spectrum to match the minimum and maximum field value in scene's grpahics which are coloured with the specified spectrum.

Parameters
&scenescene to get the autorange data from.
filterfilter for the scene
Returns
Status OpenCMISS::Zinc::OK if successfully autorange, any other value on failure.
int OpenCMISS::Zinc::Spectrum::beginChange ( )
inline

Call this function before making multiple changes on the spectrum, to stop spectrum from notifying clients about every change. Call spectrum end change method afterwards to send notifications of change made. Can be nested.

See also
Spectrum::endChange
Parameters
sceneThe handle to the spectrum.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
Spectrumcomponent OpenCMISS::Zinc::Spectrum::createSpectrumcomponent ( )
inline

Create a component for spectrum. Used to colour graphics.

Returns
Handle to new spectrum component, or NULL/invalid handle on failure.
int OpenCMISS::Zinc::Spectrum::endChange ( )
inline

Call spectrum begin change before making multiple changes on the spectrum, and this function afterwards to send a single notification of any changes to clients.

See also
Spectrum::beginChange
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
Spectrumcomponent OpenCMISS::Zinc::Spectrum::getFirstSpectrumcomponent ( )
inline

Get the first spectrum component on the spectrum list of <component>.

Returns
Handle to first spectrum component, or NULL/invalid handle if none or failed.
cmzn_spectrum_id OpenCMISS::Zinc::Spectrum::getId ( ) const
inline

Return the C handle of the Spectrum object.

Returns
C handle of Spectrum if this objects is valid, 0 otherwise.
char* OpenCMISS::Zinc::Spectrum::getName ( )
inline

Return an allocated string containing spectrum name.

Returns
allocated string containing spectrum name, otherwise NULL. Up to caller to free using cmzn_deallocate().
Spectrumcomponent OpenCMISS::Zinc::Spectrum::getNextSpectrumcomponent ( const Spectrumcomponent refComponent)
inline

Get the next spectrum component after ref_component from list in spectrum.

Parameters
refComponentHandle to a spectrum component object.
Returns
Handle to next spectrum component, or NULL/invalid handle if none or failed.
int OpenCMISS::Zinc::Spectrum::getNumberOfSpectrumcomponents ( )
inline

Returns the number of components in spectrum.

Returns
Returns the number of components in spectrum.
Spectrumcomponent OpenCMISS::Zinc::Spectrum::getPreviousSpectrumcomponent ( const Spectrumcomponent refComponent)
inline

Get the component before <ref_component> on the components list of <spectrum>.

Parameters
refComponentHandle to a spectrum component object.
Returns
Handle to previous spectrum component, or NULL/invalid handle if none or failed.
bool OpenCMISS::Zinc::Spectrum::isManaged ( )
inline

Get if a spectrum is managed. See cmzn_spectrum_set_managed for more information about managed.

Returns
1 if spectrum is managed, otherwise false.
bool OpenCMISS::Zinc::Spectrum::isMaterialOverwrite ( )
inline

Get the overwrite material flag for spectrum. When overwrite flag is true, the spectrum will clear any material rgba on primitive before applying its own rgba. If the flag is false, rgba from the spectrum will be added to the primitives on top of the one given by material.

Returns
true if overwrite flag is set for spectrum, false if the flag is not set or on failure.
bool OpenCMISS::Zinc::Spectrum::isValid ( ) const
inline

Check if this is a valid Spectrum object.

Returns
Status True if object is valid, false otherwise.
int OpenCMISS::Zinc::Spectrum::moveSpectrumcomponentBefore ( const Spectrumcomponent component,
const Spectrumcomponent refComponent 
)
inline

Move an existing component in spectrum before ref_component. Both <component> and <ref_component> must be from the same spectrum.

Parameters
componentspectrum component to be moved.
refComponent<component> will be moved into the current position of this spectrum component.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Spectrum::removeAllSpectrumcomponents ( )
inline

Removes all components from the spectrum.

from.

Returns
Status OpenCMISS::Zinc::OK if successfully remove all components from spectrum, any other value on failure.
int OpenCMISS::Zinc::Spectrum::removeSpectrumcomponent ( const Spectrumcomponent component)
inline

Removes <component> from <spectrum> and decrements the position of all subsequent graphics.

from.

Parameters
componentThe handle to a spectrum component object which will be removed from the spectrum.
Returns
Status OpenCMISS::Zinc::OK if successfully remove component from spectrum, any other value on failure.
int OpenCMISS::Zinc::Spectrum::setManaged ( bool  value)
inline

When the managed status is 0 (default) spectrum is destroyed when no longer in use, i.e. when number of external references to it drops to zero. Set to 1 to manage spectrum object indefinitely, or until this attribute is reset to zero, effectively marking it as pending destruction.

Parameters
valueThe new value for the managed flag: true or false.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Spectrum::setMaterialOverwrite ( bool  overwrite)
inline

Set the overwrite material flag for spectrum.

Returns
OpenCMISS::Zinc::OK if successfully set, any other value on failure.
int OpenCMISS::Zinc::Spectrum::setName ( const char *  name)
inline

Set/change name for <spectrum>.

Parameters
namename to be set to the spectrum
Returns
status OpenCMISS::Zinc::OK if successfully set/change name for spectrum, any other value on failure.

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