BALL 1.5.0
Loading...
Searching...
No Matches
colorProcessor.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4// $Id: colorProcessor.h,v 1.32.18.1 2007/03/25 21:26:06 oliver Exp $
5//
6
7#ifndef BALL_VIEW_MODELS_COLORPROCESSOR_H
8#define BALL_VIEW_MODELS_COLORPROCESSOR_H
9
10#ifndef BALL_CONCEPT_PROCESSOR_H
12#endif
13
14#ifndef BALL_VIEW_KERNEL_GEOMETRICOBJECT_H
16#endif
17
18#ifndef BALL_DATATYPE_HASHGRID_H
20#endif
21
22#ifndef BALL_VIEW_KERNEL_COMMON_H
24#endif
25
26namespace BALL
27{
28 class Atom;
29
30 namespace VIEW
31 {
32 class Mesh;
33
51 : public UnaryProcessor<GeometricObject*>
52{
53 public:
54
56
57
59
61 typedef HashGrid3<const Atom*> AtomGrid;
62
64 typedef HashGridBox3<const Atom*> AtomBox;
65
68
70 ColorProcessor(const ColorProcessor& color_calculator);
71
73 virtual ~ColorProcessor();
74
80 virtual void clear();
81
83 void set(const ColorProcessor& color_calculator);
84
86 virtual bool start();
87
91 const ColorProcessor& operator = (const ColorProcessor& color_calculator);
92
101 bool updateAlwaysNeeded() { return update_always_needed_;};
102
105 void setDefaultColor(const ColorRGBA& color);
106
110 {return default_color_;}
111
114 virtual Processor::Result operator() (GeometricObject*& object);
115
122 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
123
126 { return transparency_;}
127
131 virtual void setTransparency(Size value);
132
136 void setComposites(const std::list<const Composite*>* composites);
137
139 const std::list<const Composite*>* getComposites()
140 { return composites_;}
141
144
146 void setAdditionalGridDistance(float distance)
147 { additional_grid_distance_ = distance;}
148
151 { return additional_grid_distance_;}
152
154 void setMinGridSpacing(float spacing) {min_spacing_ = spacing;}
155
158 { return atom_grid_;}
159
166 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
167
169 void setModelType(ModelType type) {model_type_ = type;}
170
171 //_ Create the threedimensional grid from the CompositeSet, or a given Composite
172 virtual void createAtomGrid(const Composite* from_mesh = 0);
173
175 const Atom* getClosestItem(const Vector3& v) const;
176
177 protected:
178
179 //_ Colorize the mesh with the computed grid.
180 virtual void colorMeshFromGrid_(Mesh& mesh);
181
182 //_
183 virtual bool canUseMeshShortcut_(const Composite&) { return false;}
184
186 //_ a color that will be used if no other color can be calculated.
188 //_ for speedup, we dont have to set transparency each time we color a geometric object
191
192 const std::list<const Composite*>* composites_;
193
200};
201
202
207 : public ColorProcessor
208{
209 public:
210
212 enum Mode
213 {
215 USE_OUTSIDE_COLOR = 0,
216
219
221 NO_OUTSIDE_COLORS
222 };
223
224
226
227
229
232
234 virtual bool start();
235
237 void setMode(Mode mode) { mode_ = mode;}
238
240 Mode getMode() const { return mode_;}
241
243 vector<ColorRGBA>& getColors() { return colors_;}
244
246 const vector<ColorRGBA>& getColors() const { return colors_;}
247
249 void setColors(const vector<ColorRGBA>& colors) { colors_ = colors;}
250
252 void setMinColor(const ColorRGBA& color);
253
255 void setMaxColor(const ColorRGBA& color);
256
258 const ColorRGBA& getMinColor() const;
259
261 const ColorRGBA& getMaxColor() const;
262
264 void setMaxValue(float value) {max_value_ = value;}
265
267 float getMaxValue() const { return max_value_;}
268
270 void setMinValue(float value) { min_value_ = value;}
271
273 float getMinValue() const { return min_value_;}
274
278 virtual void interpolateColor(float value, ColorRGBA& color_to_be_set);
279
280 protected:
281
282 // out of range colors
285
286 // standard colors
287 vector<ColorRGBA> colors_;
288
290
293
294 // value distance between two colors
295 float x_;
296};
297
298} } // namespaces
299
300#endif // BALL_VIEW_MODELS_COLORPROCESSOR_H
#define BALL_CREATE(name)
Definition create.h:62
char Atom[5]
Definition PDBdefs.h:257
Three-dimensional Hash Grid Class.
Definition hashGrid.h:755
const std::list< const Composite * > * composites_
void setModelType(ModelType type)
const Atom * getClosestItem(const Vector3 &v) const
HashSet< const Composite * > CompositeSet
A HashSet with the used Composites, see also Representation.
void setAdditionalGridDistance(float distance)
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
virtual void colorMeshFromGrid_(Mesh &mesh)
void setComposites(const std::list< const Composite * > *composites)
const Composite * last_composite_of_grid_
void setDefaultColor(const ColorRGBA &color)
virtual bool canUseMeshShortcut_(const Composite &)
const ColorRGBA & getDefaultColor() const
void setMinGridSpacing(float spacing)
const std::list< const Composite * > * getComposites()
Return a pointer to the Composites.
virtual void setTransparency(Size value)
virtual void getColor(const Composite &composite, ColorRGBA &color_to_be_set)
float getAdditionalGridDistance() const
virtual void createAtomGrid(const Composite *from_mesh=0)
const ColorRGBA & getMinColor() const
const ColorRGBA & getMaxColor() const
void setColors(const vector< ColorRGBA > &colors)
const vector< ColorRGBA > & getColors() const
void setMaxColor(const ColorRGBA &color)
void setMinColor(const ColorRGBA &color)
virtual void interpolateColor(float value, ColorRGBA &color_to_be_set)
#define BALL_VIEW_EXPORT