Loading...
Searching...
No Matches
colorProcessor.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: colorProcessor.h,v 1.32.18.1 2007/03/25 21:26:06 oliver Exp $
//
#ifndef BALL_VIEW_MODELS_COLORPROCESSOR_H
#define BALL_VIEW_MODELS_COLORPROCESSOR_H
#ifndef BALL_CONCEPT_PROCESSOR_H
# include <BALL/CONCEPT/processor.h>
#endif
#ifndef BALL_VIEW_KERNEL_GEOMETRICOBJECT_H
# include <BALL/VIEW/KERNEL/geometricObject.h>
#endif
#ifndef BALL_DATATYPE_HASHGRID_H
# include <BALL/DATATYPE/hashGrid.h>
#endif
#ifndef BALL_VIEW_KERNEL_COMMON_H
# include <BALL/VIEW/KERNEL/common.h>
#endif
namespace BALL
{
class Atom;
namespace VIEW
{
class Mesh;
class BALL_VIEW_EXPORT ColorProcessor
: public UnaryProcessor<GeometricObject*>
{
public:
BALL_CREATE(ColorProcessor)
typedef HashSet<const Composite*> CompositeSet;
typedef HashGrid3<const Atom*> AtomGrid;
typedef HashGridBox3<const Atom*> AtomBox;
ColorProcessor();
ColorProcessor(const ColorProcessor& color_calculator);
virtual ~ColorProcessor();
virtual void clear();
void set(const ColorProcessor& color_calculator);
virtual bool start();
const ColorProcessor& operator = (const ColorProcessor& color_calculator);
bool updateAlwaysNeeded() { return update_always_needed_;};
void setDefaultColor(const ColorRGBA& color);
const ColorRGBA& getDefaultColor() const
{return default_color_;}
virtual Processor::Result operator() (GeometricObject*& object);
virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
Size getTransparency() const
{ return transparency_;}
virtual void setTransparency(Size value);
void setComposites(const std::list<const Composite*>* composites);
const std::list<const Composite*>* getComposites()
{ return composites_;}
void clearAtomGrid();
void setAdditionalGridDistance(float distance)
{ additional_grid_distance_ = distance;}
float getAdditionalGridDistance() const
{ return additional_grid_distance_;}
void setMinGridSpacing(float spacing) {min_spacing_ = spacing;}
AtomGrid& getAtomGrid()
{ return atom_grid_;}
virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
void setModelType(ModelType type) {model_type_ = type;}
//_ Create the threedimensional grid from the CompositeSet, or a given Composite
virtual void createAtomGrid(const Composite* from_mesh = 0);
const Atom* getClosestItem(const Vector3& v) const;
protected:
//_ Colorize the mesh with the computed grid.
virtual void colorMeshFromGrid_(Mesh& mesh);
//_
virtual bool canUseMeshShortcut_(const Composite&) { return false;}
bool update_always_needed_;
//_ a color that will be used if no other color can be calculated.
ColorRGBA default_color_;
//_ for speedup, we dont have to set transparency each time we color a geometric object
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_;
};
class BALL_VIEW_EXPORT InterpolateColorProcessor
: public ColorProcessor
{
public:
enum Mode
{
USE_OUTSIDE_COLOR = 0,
DEFAULT_COLOR_FOR_OUTSIDE_COLORS,
NO_OUTSIDE_COLORS
};
BALL_CREATE(InterpolateColorProcessor)
InterpolateColorProcessor();
InterpolateColorProcessor(const InterpolateColorProcessor& pro);
virtual bool start();
void setMode(Mode mode) { mode_ = mode;}
Mode getMode() const { return mode_;}
vector<ColorRGBA>& getColors() { return colors_;}
const vector<ColorRGBA>& getColors() const { return colors_;}
void setColors(const vector<ColorRGBA>& colors) { colors_ = colors;}
void setMinColor(const ColorRGBA& color);
void setMaxColor(const ColorRGBA& color);
const ColorRGBA& getMinColor() const;
const ColorRGBA& getMaxColor() const;
void setMaxValue(float value) {max_value_ = value;}
float getMaxValue() const { return max_value_;}
void setMinValue(float value) { min_value_ = value;}
float getMinValue() const { return min_value_;}
virtual void interpolateColor(float value, ColorRGBA& color_to_be_set);
protected:
// out of range colors
ColorRGBA min_color_,
max_color_;
// standard colors
vector<ColorRGBA> colors_;
Mode mode_;
float max_value_;
float min_value_;
// value distance between two colors
float x_;
};
} } // namespaces
#endif // BALL_VIEW_MODELS_COLORPROCESSOR_H
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition COMMON/global.h:52
common.h
BALL::Atom
Definition atom.h:90
BALL::Composite
Definition composite.h:74
BALL::HashGrid3
Three-dimensional Hash Grid Class.
Definition hashGrid.h:755
BALL::HashGridBox3
Definition hashGrid.h:55
BALL::HashSet
Definition hashSet.h:46
BALL::Processor::Result
int Result
Definition processor.h:36
BALL::UnaryProcessor< GeometricObject * >::UnaryProcessor
UnaryProcessor()
Definition processor.h:69
BALL::VIEW::ColorProcessor::update_always_needed_
bool update_always_needed_
Definition colorProcessor.h:185
BALL::VIEW::ColorProcessor::composites_
const std::list< const Composite * > * composites_
Definition colorProcessor.h:192
BALL::VIEW::ColorProcessor::setModelType
void setModelType(ModelType type)
Definition colorProcessor.h:169
BALL::VIEW::ColorProcessor::min_spacing_
float min_spacing_
Definition colorProcessor.h:198
BALL::VIEW::ColorProcessor::getClosestItem
const Atom * getClosestItem(const Vector3 &v) const
BALL::VIEW::ColorProcessor::clear
virtual void clear()
BALL::VIEW::ColorProcessor::CompositeSet
HashSet< const Composite * > CompositeSet
A HashSet with the used Composites, see also Representation.
Definition colorProcessor.h:58
BALL::VIEW::ColorProcessor::setAdditionalGridDistance
void setAdditionalGridDistance(float distance)
Definition colorProcessor.h:146
BALL::VIEW::ColorProcessor::dump
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
BALL::VIEW::ColorProcessor::additional_grid_distance_
float additional_grid_distance_
Definition colorProcessor.h:197
BALL::VIEW::ColorProcessor::colorMeshFromGrid_
virtual void colorMeshFromGrid_(Mesh &mesh)
BALL::VIEW::ColorProcessor::clearAtomGrid
void clearAtomGrid()
BALL::VIEW::ColorProcessor::setComposites
void setComposites(const std::list< const Composite * > *composites)
BALL::VIEW::ColorProcessor::last_composite_of_grid_
const Composite * last_composite_of_grid_
Definition colorProcessor.h:196
BALL::VIEW::ColorProcessor::setDefaultColor
void setDefaultColor(const ColorRGBA &color)
BALL::VIEW::ColorProcessor::updateAlwaysNeeded
bool updateAlwaysNeeded()
Definition colorProcessor.h:101
BALL::VIEW::ColorProcessor::model_type_
ModelType model_type_
Definition colorProcessor.h:195
BALL::VIEW::ColorProcessor::canUseMeshShortcut_
virtual bool canUseMeshShortcut_(const Composite &)
Definition colorProcessor.h:183
BALL::VIEW::ColorProcessor::transparency_
Size transparency_
Definition colorProcessor.h:190
BALL::VIEW::ColorProcessor::set
void set(const ColorProcessor &color_calculator)
Assignment.
BALL::VIEW::ColorProcessor::getDefaultColor
const ColorRGBA & getDefaultColor() const
Definition colorProcessor.h:109
BALL::VIEW::ColorProcessor::ColorProcessor
ColorProcessor()
Default Constructor.
BALL::VIEW::ColorProcessor::setMinGridSpacing
void setMinGridSpacing(float spacing)
Definition colorProcessor.h:154
BALL::VIEW::ColorProcessor::AtomBox
HashGridBox3< const Atom * > AtomBox
a single box in the threedimensional grid
Definition colorProcessor.h:64
BALL::VIEW::ColorProcessor::getComposites
const std::list< const Composite * > * getComposites()
Return a pointer to the Composites.
Definition colorProcessor.h:139
BALL::VIEW::ColorProcessor::getAtomGrid
AtomGrid & getAtomGrid()
Definition colorProcessor.h:157
BALL::VIEW::ColorProcessor::atom_grid_
AtomGrid atom_grid_
Definition colorProcessor.h:194
BALL::VIEW::ColorProcessor::setTransparency
virtual void setTransparency(Size value)
BALL::VIEW::ColorProcessor::getTransparency
Size getTransparency() const
Definition colorProcessor.h:125
BALL::VIEW::ColorProcessor::selection_color_
ColorRGBA selection_color_
Definition colorProcessor.h:189
BALL::VIEW::ColorProcessor::default_color_
ColorRGBA default_color_
Definition colorProcessor.h:187
BALL::VIEW::ColorProcessor::AtomGrid
HashGrid3< const Atom * > AtomGrid
a threedimensioal grid with the pointers to the atoms
Definition colorProcessor.h:61
BALL::VIEW::ColorProcessor::getColor
virtual void getColor(const Composite &composite, ColorRGBA &color_to_be_set)
BALL::VIEW::ColorProcessor::getAdditionalGridDistance
float getAdditionalGridDistance() const
Definition colorProcessor.h:150
BALL::VIEW::ColorProcessor::start
virtual bool start()
BALL::VIEW::ColorProcessor::createAtomGrid
virtual void createAtomGrid(const Composite *from_mesh=0)
BALL::VIEW::ColorRGBA
Definition colorRGBA.h:32
BALL::VIEW::GeometricObject
Definition geometricObject.h:37
BALL::VIEW::InterpolateColorProcessor
Definition colorProcessor.h:208
BALL::VIEW::InterpolateColorProcessor::getMinColor
const ColorRGBA & getMinColor() const
BALL::VIEW::InterpolateColorProcessor::start
virtual bool start()
BALL::VIEW::InterpolateColorProcessor::Mode
Mode
Definition colorProcessor.h:213
BALL::VIEW::InterpolateColorProcessor::USE_OUTSIDE_COLOR
@ USE_OUTSIDE_COLOR
Definition colorProcessor.h:215
BALL::VIEW::InterpolateColorProcessor::NO_OUTSIDE_COLORS
@ NO_OUTSIDE_COLORS
Definition colorProcessor.h:221
BALL::VIEW::InterpolateColorProcessor::DEFAULT_COLOR_FOR_OUTSIDE_COLORS
@ DEFAULT_COLOR_FOR_OUTSIDE_COLORS
Definition colorProcessor.h:218
BALL::VIEW::InterpolateColorProcessor::getMaxValue
float getMaxValue() const
Definition colorProcessor.h:267
BALL::VIEW::InterpolateColorProcessor::getMaxColor
const ColorRGBA & getMaxColor() const
BALL::VIEW::InterpolateColorProcessor::setColors
void setColors(const vector< ColorRGBA > &colors)
Definition colorProcessor.h:249
BALL::VIEW::InterpolateColorProcessor::InterpolateColorProcessor
InterpolateColorProcessor()
BALL::VIEW::InterpolateColorProcessor::min_value_
float min_value_
Definition colorProcessor.h:292
BALL::VIEW::InterpolateColorProcessor::getColors
const vector< ColorRGBA > & getColors() const
Definition colorProcessor.h:246
BALL::VIEW::InterpolateColorProcessor::mode_
Mode mode_
Definition colorProcessor.h:289
BALL::VIEW::InterpolateColorProcessor::x_
float x_
Definition colorProcessor.h:295
BALL::VIEW::InterpolateColorProcessor::getColors
vector< ColorRGBA > & getColors()
Definition colorProcessor.h:243
BALL::VIEW::InterpolateColorProcessor::getMinValue
float getMinValue() const
Definition colorProcessor.h:273
BALL::VIEW::InterpolateColorProcessor::setMinValue
void setMinValue(float value)
Definition colorProcessor.h:270
BALL::VIEW::InterpolateColorProcessor::setMaxValue
void setMaxValue(float value)
Definition colorProcessor.h:264
BALL::VIEW::InterpolateColorProcessor::setMode
void setMode(Mode mode)
Definition colorProcessor.h:237
BALL::VIEW::InterpolateColorProcessor::setMaxColor
void setMaxColor(const ColorRGBA &color)
BALL::VIEW::InterpolateColorProcessor::max_value_
float max_value_
Definition colorProcessor.h:291
BALL::VIEW::InterpolateColorProcessor::setMinColor
void setMinColor(const ColorRGBA &color)
BALL::VIEW::InterpolateColorProcessor::getMode
Mode getMode() const
Definition colorProcessor.h:240
BALL::VIEW::InterpolateColorProcessor::min_color_
ColorRGBA min_color_
Definition colorProcessor.h:283
BALL::VIEW::InterpolateColorProcessor::interpolateColor
virtual void interpolateColor(float value, ColorRGBA &color_to_be_set)
BALL::VIEW::InterpolateColorProcessor::colors_
vector< ColorRGBA > colors_
Definition colorProcessor.h:287
BALL::VIEW::InterpolateColorProcessor::max_color_
ColorRGBA max_color_
Definition colorProcessor.h:284
BALL::VIEW::Mesh
Definition mesh.h:42
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
geometricObject.h
hashGrid.h
BALL::VIEW
Definition constraints.h:35
BALL::VIEW::ModelType
ModelType
Definition VIEW/KERNEL/common.h:166
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Vector3
TVector3< float > Vector3
Definition vector3.h:1084
processor.h