BALL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
BALL::VIEW::AtomDistanceColorProcessor Class Reference

#include <BALL/VIEW/MODELS/standardColorProcessor.h>

Inheritance diagram for BALL::VIEW::AtomDistanceColorProcessor:
BALL::VIEW::ColorProcessor BALL::UnaryProcessor< GeometricObject * > BALL::UnaryFunctor< GeometricObject *, Processor::Result >

Public Member Functions

 AtomDistanceColorProcessor ()
 AtomDistanceColorProcessor (const AtomDistanceColorProcessor &color_Processor)
 Construct with copying the colors and the distance.
void setDistance (float distance)
float getDistance () const
void setNullDistanceColor (const ColorRGBA &color)
const ColorRGBAgetNullDistanceColor () const
void setMaxDistanceColor (const ColorRGBA &color)
const ColorRGBAgetMaxDistanceColor () const
void calculateDistances ()
virtual void addAtom (const Atom &atom)
virtual bool finish ()
virtual void getColor (const Composite &composite, ColorRGBA &color_to_be_set)
bool showSelected ()
void setShowSelected (bool state)
virtual Processor::Result operator() (GeometricObject *&object)
- Public Member Functions inherited from BALL::VIEW::ColorProcessor
 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 ColorProcessoroperator= (const ColorProcessor &color_calculator)
bool updateAlwaysNeeded ()
void setDefaultColor (const ColorRGBA &color)
const ColorRGBAgetDefaultColor () const
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)
AtomGridgetAtomGrid ()
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 AtomgetClosestItem (const Vector3 &v) const
- Public Member Functions inherited from BALL::UnaryProcessor< GeometricObject * >
 UnaryProcessor ()
 UnaryProcessor (const UnaryProcessor &)
virtual ~UnaryProcessor ()

Private Types

typedef HashMap< const Atom
*, float
AtomDistanceHashMap

Private Member Functions

void colorGeometricObject_ (GeometricObject &object)
virtual void colorMeshFromGrid_ (Mesh &mesh)

Private Attributes

AtomDistanceHashMap atom_2_distance_
GeometricObjectList list_
float distance_
bool show_selection_
ColorRGBA null_distance_color_
ColorRGBA full_distance_color_

Additional Inherited Members

- Public Types inherited from BALL::VIEW::ColorProcessor
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
- Protected Member Functions inherited from BALL::VIEW::ColorProcessor
virtual void colorMeshFromGrid_ (Mesh &mesh)
virtual bool canUseMeshShortcut_ (const Composite &)
- Protected Attributes inherited from BALL::VIEW::ColorProcessor
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 Compositelast_composite_of_grid_
float additional_grid_distance_
float min_spacing_

Detailed Description

AtomDistanceColorProcessor class. AtomDistanceColorProcessor can be choosen in the class DisplayProperties to color the atoms in multiple AtomContainer according to their distance. There are two colors for the distance of Atom objects. A color for the null distance and a color for the max distance. If a distance of an Atom object to another atom object (stored in different atom containers) lies between the null and the max distance, the resulting color will be interpolated according to the distance.

Definition at line 297 of file standardColorProcessor.h.

Member Typedef Documentation

Definition at line 402 of file standardColorProcessor.h.

Constructor & Destructor Documentation

BALL::VIEW::AtomDistanceColorProcessor::AtomDistanceColorProcessor ( )

Default Constructor. Initialize to:

  • distance set to 10
  • null distance color set to red ("FF0000FF").
  • max distance color set to blue ("00FF00FF").
    See Also
    ColorRGBA
BALL::VIEW::AtomDistanceColorProcessor::AtomDistanceColorProcessor ( const AtomDistanceColorProcessor color_Processor)

Construct with copying the colors and the distance.

Member Function Documentation

virtual void BALL::VIEW::AtomDistanceColorProcessor::addAtom ( const Atom atom)
virtual

Calculate the distance color of the given Atom by interpolating the null and max distance color according to the previously calculated distance color (see calculateDistances()) of the given atom. Access to the calculated color with the method ColorProcessor::getColor.

Parameters
atomthe Atom whose distance color should be computed
void BALL::VIEW::AtomDistanceColorProcessor::calculateDistances ( )

Calculate the distances. If this method is called the distances of all previously inserted Atom objects to each other are calculated. Only Atom objects are used for the distance calculation that have not the same root. All other atom objects will keep the max distance as set with the method setDistance(). Use this method after all atom containers have applied this processor.

void BALL::VIEW::AtomDistanceColorProcessor::colorGeometricObject_ ( GeometricObject object)
private
virtual void BALL::VIEW::AtomDistanceColorProcessor::colorMeshFromGrid_ ( Mesh mesh)
privatevirtual
virtual bool BALL::VIEW::AtomDistanceColorProcessor::finish ( )
virtual

finish method

Reimplemented from BALL::UnaryProcessor< GeometricObject * >.

virtual void BALL::VIEW::AtomDistanceColorProcessor::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 from BALL::VIEW::ColorProcessor.

float BALL::VIEW::AtomDistanceColorProcessor::getDistance ( ) const

Inspection of the max distance.

const ColorRGBA& BALL::VIEW::AtomDistanceColorProcessor::getMaxDistanceColor ( ) const

Non-mutable inspection of the max distance color.

See Also
setMaxDistanceColor
ColorRGBA
const ColorRGBA& BALL::VIEW::AtomDistanceColorProcessor::getNullDistanceColor ( ) const

Non-mutable inspection of the null distance color.

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

Collect all atoms from the geometric objects

Reimplemented from BALL::VIEW::ColorProcessor.

void BALL::VIEW::AtomDistanceColorProcessor::setDistance ( float  distance)
inline

Change the max distance. Every new Atom object is inserted into the AtomDistanceColorProcessor with this max distance. If the method calculateDistances() is called the distances of the inserted atoms are calculated.

Parameters
distancethe new max distance

Definition at line 322 of file standardColorProcessor.h.

void BALL::VIEW::AtomDistanceColorProcessor::setMaxDistanceColor ( const ColorRGBA color)

Change the max distance color. If the calculated distance between two Atom objects becomes the max distance or greater this color will be used to color these two atoms. Otherwise the color will be interpolated between this color and the null distance color according to the calculated distance.

Parameters
colorthe new max distance color
See Also
getMaxDistanceColor
setNullDistanceColor
ColorRGBA
void BALL::VIEW::AtomDistanceColorProcessor::setNullDistanceColor ( const ColorRGBA color)

Change the null distance color. If the calculated distance between two Atom objects becomes 0, this color will be used to color these two atoms. Otherwise the color will be interpolated between this color and the max distance color according to the calculated distance.

Parameters
colorthe new null distance color
See Also
getNullDistanceColor
setMaxDistanceColor
ColorRGBA
void BALL::VIEW::AtomDistanceColorProcessor::setShowSelected ( bool  state)
inline

Definition at line 389 of file standardColorProcessor.h.

bool BALL::VIEW::AtomDistanceColorProcessor::showSelected ( )
inline

Definition at line 386 of file standardColorProcessor.h.

Member Data Documentation

AtomDistanceHashMap BALL::VIEW::AtomDistanceColorProcessor::atom_2_distance_
private

Definition at line 404 of file standardColorProcessor.h.

float BALL::VIEW::AtomDistanceColorProcessor::distance_
private

Definition at line 407 of file standardColorProcessor.h.

ColorRGBA BALL::VIEW::AtomDistanceColorProcessor::full_distance_color_
private

Definition at line 411 of file standardColorProcessor.h.

GeometricObjectList BALL::VIEW::AtomDistanceColorProcessor::list_
private

Definition at line 405 of file standardColorProcessor.h.

ColorRGBA BALL::VIEW::AtomDistanceColorProcessor::null_distance_color_
private

Definition at line 410 of file standardColorProcessor.h.

bool BALL::VIEW::AtomDistanceColorProcessor::show_selection_
private

Definition at line 408 of file standardColorProcessor.h.