Loading...
Searching...
No Matches
BALL::VIEW::ColorProcessor Class Reference
Visualisation » Model Processors

`#include <BALL/VIEW/MODELS/colorProcessor.h>`

Inheritance diagram for BALL::VIEW::ColorProcessor:

## Public Types

typedef HashSet< const Composite * > | CompositeSet
| A HashSet with the used Composites, see also Representation.
typedef HashGrid3< const Atom * > | AtomGrid
| a threedimensioal grid with the pointers to the atoms
typedef HashGridBox3< const Atom * > | AtomBox
| a single box in the threedimensional grid
Public Types inherited from BALL::UnaryFunctor< GeometricObject *, Processor::Result >
typedef Processor::Result | result_type
typedef GeometricObject * | argument_type
typedef GeometricObject *& | argument_reference
typedef const GeometricObject *& | const_argument_reference
typedef GeometricObject ** | argument_pointer
typedef const GeometricObject ** | const_argument_pointer

## Public Member Functions

| ColorProcessor ()
| Default Constructor.
| ColorProcessor (const ColorProcessor &color_calculator)
| Copy constructor.
virtual | ~ColorProcessor ()
| Destructor.
virtual void | clear ()
void | set (const ColorProcessor &color_calculator)
| Assignment.
virtual bool | start ()
const ColorProcessor & | operator= (const ColorProcessor &color_calculator)
bool | updateAlwaysNeeded ()
void | setDefaultColor (const ColorRGBA &color)
const ColorRGBA & | getDefaultColor () const
virtual Processor::Result | operator() (GeometricObject *&object)
virtual void | getColor (const Composite &composite, ColorRGBA &color_to_be_set)
Size | getTransparency () const
virtual void | setTransparency (Size value)
void | setComposites (const std::list< const Composite * > *composites)
const std::list< const Composite * > * | getComposites ()
| Return a pointer to the Composites.
void | clearAtomGrid ()
void | setAdditionalGridDistance (float distance)
float | getAdditionalGridDistance () const
void | setMinGridSpacing (float spacing)
AtomGrid & | getAtomGrid ()
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const
void | setModelType (ModelType type)
virtual void | createAtomGrid (const Composite *from_mesh=0)
const Atom * | getClosestItem (const Vector3 &v) const
Public Member Functions inherited from BALL::UnaryProcessor< GeometricObject * >
| UnaryProcessor ()
virtual | ~UnaryProcessor ()
virtual bool | finish ()
virtual Processor::Result | operator() (GeometricObject *&)

## Protected Member Functions

virtual void | colorMeshFromGrid_ (Mesh &mesh)
virtual bool | canUseMeshShortcut_ (const Composite &)

## Protected Attributes

bool | update_always_needed_
ColorRGBA | default_color_
ColorRGBA | selection_color_
Size | transparency_
const std::list< const Composite * > * | composites_
AtomGrid | atom_grid_
ModelType | model_type_
const Composite * | last_composite_of_grid_
float | additional_grid_distance_
float | min_spacing_

## Detailed Description

Calculating colors for given GeometricObject instances. This class defines the interface and basic algorithms to colorize geometric objects, e.g. Sphere, Tube, TwoColoredTube, etc. Derived classes implement special ways to colorize, e.g. by charge or element. They have to overload the method getColor(Composite, ColorRGBA).
If no color can be calculated for a GeometricObject, e.g. if it has no Composite, the default color is set.
A bit tricky is the coloring of meshes. The goal was to give every triangle of a mesh a color according to its nearest Atom. To do so, a threedimensional HashGrid3 is used. It is computed, when the ColorProcessor first encounters a Mesh in the operator (). For this a pointer to the HashSet with the used Composite instances exists, which is set by the Representation.

Definition at line 50 of file colorProcessor.h.

## Member Typedef Documentation

## AtomBox

typedef HashGridBox3<const Atom*> BALL::VIEW::ColorProcessor::AtomBox

a single box in the threedimensional grid

Definition at line 64 of file colorProcessor.h.

## AtomGrid

typedef HashGrid3<const Atom*> BALL::VIEW::ColorProcessor::AtomGrid

a threedimensioal grid with the pointers to the atoms

Definition at line 61 of file colorProcessor.h.

## CompositeSet

typedef HashSet<const Composite*> BALL::VIEW::ColorProcessor::CompositeSet

A HashSet with the used Composites, see also Representation.

Definition at line 58 of file colorProcessor.h.

## Constructor & Destructor Documentation

## ColorProcessor() [1/2]

BALL::VIEW::ColorProcessor::ColorProcessor | ( |  | ) |

Default Constructor.

## ColorProcessor() [2/2]

BALL::VIEW::ColorProcessor::ColorProcessor | ( | const ColorProcessor & | color_calculator | ) |

Copy constructor.

## ~ColorProcessor()

virtual BALL::VIEW::ColorProcessor::~ColorProcessor | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## canUseMeshShortcut_()

virtual bool BALL::VIEW::ColorProcessor::canUseMeshShortcut_ | ( | const Composite & |  | ) |

inline protected virtual

Reimplemented in BALL::VIEW::ChainColorProcessor, BALL::VIEW::CustomColorProcessor, BALL::VIEW::MoleculeColorProcessor, BALL::VIEW::ResidueNameColorProcessor, and BALL::VIEW::ResidueNumberColorProcessor.

Definition at line 183 of file colorProcessor.h.

## clear()

virtual void BALL::VIEW::ColorProcessor::clear | ( |  | ) |

virtual

Explicit default initialization. Reset the state of the default_color_ to red ( "FF0000FF"). The grid is cleared and the pointer to the CompositeSet is set to NULL.

## clearAtomGrid()

void BALL::VIEW::ColorProcessor::clearAtomGrid | ( |  | ) |

## colorMeshFromGrid_()

virtual void BALL::VIEW::ColorProcessor::colorMeshFromGrid_ | ( | Mesh & | mesh | ) |

protected virtual

## createAtomGrid()

virtual void BALL::VIEW::ColorProcessor::createAtomGrid | ( | const Composite * | from_mesh = 0 | ) |

virtual

## dump()

virtual void BALL::VIEW::ColorProcessor::dump | ( | std::ostream & | s = std::cout,
|  | Size | depth = 0 ) const

virtual

Internal value dump. Dump the current state of this ColorProcessor to the output ostream s with dumping depth depth.

Parameters

  s | output stream where to output the state of this ColorProcessor
  depth | the dumping depth

## getAdditionalGridDistance()

float BALL::VIEW::ColorProcessor::getAdditionalGridDistance | ( |  | ) | const

inline

Definition at line 150 of file colorProcessor.h.

## getAtomGrid()

AtomGrid & BALL::VIEW::ColorProcessor::getAtomGrid | ( |  | ) |

inline

Definition at line 157 of file colorProcessor.h.

## getClosestItem()

const Atom * BALL::VIEW::ColorProcessor::getClosestItem | ( | const Vector3 & | v | ) | const

## getColor()

virtual void BALL::VIEW::ColorProcessor::getColor | ( | const Composite & | composite,
|  | ColorRGBA & | color_to_be_set )

virtual

Calculate a color for a Composite. The given ColorRGBA instance is set to the calculated color. This method is called by the operator() method. Here it just sets the default color. You have to overload this operator in derived classes.

Reimplemented in BALL::VIEW::AtomChargeColorProcessor, BALL::VIEW::AtomDistanceColorProcessor, BALL::VIEW::ElementColorProcessor, BALL::VIEW::ForceColorProcessor, BALL::VIEW::OccupancyColorProcessor, BALL::VIEW::PositionColorProcessor, BALL::VIEW::ResidueNameColorProcessor, BALL::VIEW::ResidueNumberColorProcessor, BALL::VIEW::ResidueTypeColorProcessor, BALL::VIEW::SecondaryStructureColorProcessor, and BALL::VIEW::TemperatureFactorColorProcessor.

## getComposites()

const std::list< const Composite * > * BALL::VIEW::ColorProcessor::getComposites | ( |  | ) |

inline

Return a pointer to the Composites.

Definition at line 139 of file colorProcessor.h.

## getDefaultColor()

const ColorRGBA & BALL::VIEW::ColorProcessor::getDefaultColor | ( |  | ) | const

inline

Non-mutable inspection of the default color.

Definition at line 109 of file colorProcessor.h.

## getTransparency()

Size BALL::VIEW::ColorProcessor::getTransparency | ( |  | ) | const

inline

Definition at line 125 of file colorProcessor.h.

## operator()()

virtual Processor::Result BALL::VIEW::ColorProcessor::operator() | ( | GeometricObject *& | object | ) |

virtual

Calculate a color for a GeometricObject.

Reimplemented in BALL::VIEW::AtomDistanceColorProcessor, and BALL::VIEW::ColorByGridProcessor.

## operator=()

const ColorProcessor & BALL::VIEW::ColorProcessor::operator= | ( | const ColorProcessor & | color_calculator | ) |

Assignment operator. Calls set.

## set()

void BALL::VIEW::ColorProcessor::set | ( | const ColorProcessor & | color_calculator | ) |

Assignment.

## setAdditionalGridDistance()

void BALL::VIEW::ColorProcessor::setAdditionalGridDistance | ( | float | distance | ) |

inline

Definition at line 146 of file colorProcessor.h.

## setComposites()

void BALL::VIEW::ColorProcessor::setComposites | ( | const std::list< const Composite * > * | composites | ) |

Set the pointer to the CompositeSet. This method is called by Representation::setColorProcessor and Representation::update.

## setDefaultColor()

void BALL::VIEW::ColorProcessor::setDefaultColor | ( | const ColorRGBA & | color | ) |

Change the default color.

## setMinGridSpacing()

void BALL::VIEW::ColorProcessor::setMinGridSpacing | ( | float | spacing | ) |

inline

Definition at line 154 of file colorProcessor.h.

## setModelType()

void BALL::VIEW::ColorProcessor::setModelType | ( | ModelType | type | ) |

inline

Definition at line 169 of file colorProcessor.h.

## setTransparency()

virtual void BALL::VIEW::ColorProcessor::setTransparency | ( | Size | value | ) |

virtual

Set the transparency. To be overloaded in derived classes

Reimplemented in BALL::VIEW::ElementColorProcessor, BALL::VIEW::ResidueNameColorProcessor, BALL::VIEW::ResidueTypeColorProcessor, and BALL::VIEW::SecondaryStructureColorProcessor.

## start()

virtual bool BALL::VIEW::ColorProcessor::start | ( |  | ) |

virtual

start method

Reimplemented from BALL::UnaryProcessor< GeometricObject * >.

Reimplemented in BALL::VIEW::ColorByGridProcessor, BALL::VIEW::InterpolateColorProcessor, BALL::VIEW::PositionColorProcessor, and BALL::VIEW::ResidueNumberColorProcessor.

## updateAlwaysNeeded()

bool BALL::VIEW::ColorProcessor::updateAlwaysNeeded | ( |  | ) |

inline

Some coloring processors need only to be applied to a Representation if the hierarchy of the Representations Composite is changed, or the Composites Names or Type (like SecondaryStructure::Type) is changed. As this is seldom the case, we can speedup the call to Representation::update() in most cases. This method defines if a ColoringMethod needs to be applied in all cases. The default value is false. Initialise the member update_always_needed_ to true in derived classes, if the derived ColorProcessor shall always be applied.

Definition at line 101 of file colorProcessor.h.

## Member Data Documentation

## additional_grid_distance_

float BALL::VIEW::ColorProcessor::additional_grid_distance_

protected

Definition at line 197 of file colorProcessor.h.

## atom_grid_

AtomGrid BALL::VIEW::ColorProcessor::atom_grid_

protected

Definition at line 194 of file colorProcessor.h.

## composites_

const std::list<const Composite*>* BALL::VIEW::ColorProcessor::composites_

protected

Definition at line 192 of file colorProcessor.h.

## default_color_

ColorRGBA BALL::VIEW::ColorProcessor::default_color_

protected

Definition at line 187 of file colorProcessor.h.

## last_composite_of_grid_

const Composite* BALL::VIEW::ColorProcessor::last_composite_of_grid_

protected

Definition at line 196 of file colorProcessor.h.

## min_spacing_

float BALL::VIEW::ColorProcessor::min_spacing_

protected

Definition at line 198 of file colorProcessor.h.

## model_type_

ModelType BALL::VIEW::ColorProcessor::model_type_

protected

Definition at line 195 of file colorProcessor.h.

## selection_color_

ColorRGBA BALL::VIEW::ColorProcessor::selection_color_

protected

Definition at line 189 of file colorProcessor.h.

## transparency_

Size BALL::VIEW::ColorProcessor::transparency_

protected

Definition at line 190 of file colorProcessor.h.

## update_always_needed_

bool BALL::VIEW::ColorProcessor::update_always_needed_

protected

Definition at line 185 of file colorProcessor.h.