#include <colorProcessor.h>
Inheritance diagram for 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 Member Functions | |
ColorProcessor () throw () | |
Default Constructor. | |
ColorProcessor (const ColorProcessor &color_calculator) throw () | |
Copy constructor. | |
virtual | ~ColorProcessor () |
Destructor. | |
virtual void | clear () throw () |
Explicit default initialization. | |
void | set (const ColorProcessor &color_calculator) throw () |
Assignment. | |
virtual bool | start () throw () |
start method | |
const ColorProcessor & | operator= (const ColorProcessor &color_calculator) throw () |
Assignment operator. | |
bool | updateAlwaysNeeded () |
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. | |
void | setDefaultColor (const ColorRGBA &color) throw () |
Change the default color. | |
const ColorRGBA & | getDefaultColor () const throw () |
Non-mutable inspection of the default color. | |
virtual Processor::Result | operator() (GeometricObject *&object) |
Calculate a color for a GeometricObject. | |
virtual void | getColor (const Composite &composite, ColorRGBA &color_to_be_set) |
Calculate a color for a Composite. | |
Size | getTransparency () const throw () |
virtual void | setTransparency (Size value) throw () |
Set the transparency. | |
void | setComposites (const List< const Composite * > *composites) throw () |
Set the pointer to the CompositeSet. | |
const List< const Composite * > * | getComposites () throw () |
Return a pointer to the Composites. | |
void | clearAtomGrid () throw () |
void | setAdditionalGridDistance (float distance) throw () |
float | getAdditionalGridDistance () const throw () |
void | setMinGridSpacing (float spacing) |
AtomGrid & | getAtomGrid () throw () |
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const throw () |
Internal value dump. | |
void | setModelType (ModelType type) |
virtual void | createAtomGrid (const Composite *from_mesh=0) throw () |
const Atom * | getClosestItem (const Vector3 &v) const throw () |
Protected Member Functions | |
virtual void | colorMeshFromGrid_ (Mesh &mesh) throw () |
virtual bool | canUseMeshShortcut_ (const Composite &) |
Protected Attributes | |
bool | update_always_needed_ |
ColorRGBA | default_color_ |
ColorRGBA | selection_color_ |
Size | transparency_ |
const List< const Composite * > * | composites_ |
AtomGrid | atom_grid_ |
ModelType | model_type_ |
const Composite * | last_composite_of_grid_ |
float | additional_grid_distance_ |
float | min_spacing_ |
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.
|
Explicit default initialization.
Reset the state of the default_color_ to red ( |
|
Internal value dump. Dump the current state of this ColorProcessor to the output ostream s with dumping depth depth.
|
|
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 VIEW::ElementColorProcessor, VIEW::ResidueNumberColorProcessor, VIEW::ResidueNameColorProcessor, VIEW::AtomChargeColorProcessor, VIEW::AtomDistanceColorProcessor, VIEW::TemperatureFactorColorProcessor, VIEW::OccupancyColorProcessor, VIEW::ForceColorProcessor, VIEW::SecondaryStructureColorProcessor, and VIEW::ResidueTypeColorProcessor. |
|
Non-mutable inspection of the default color.
|
|
Calculate a color for a GeometricObject.
Reimplemented from UnaryProcessor< GeometricObject * >. Reimplemented in VIEW::AtomDistanceColorProcessor. |
|
Assignment operator. Calls set. |
|
Set the pointer to the CompositeSet. This method is called by Representation::setColorProcessor and Representation::update. |
|
Change the default color.
|
|
Set the transparency. To be overloaded in derived classes Reimplemented in VIEW::ElementColorProcessor, VIEW::ResidueNameColorProcessor, VIEW::SecondaryStructureColorProcessor, and VIEW::ResidueTypeColorProcessor. |
|
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. |