00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_VIEW_MODELS_STANDARDCOLORPROCESSOR_H
00008 #define BALL_VIEW_MODELS_STANDARDCOLORPROCESSOR_H
00009
00010 #ifndef BALL_VIEW_MODELS_COLORPROCESSOR_H
00011 # include <BALL/VIEW/MODELS/colorProcessor.h>
00012 #endif
00013
00014 #ifndef BALL_VIEW_DATATYPTE_COLORMAP_H
00015 # include <BALL/VIEW/DATATYPE/colorMap.h>
00016 #endif
00017
00018 #ifndef BALL_KERNEL_RESIDUE_H
00019 # include<BALL/KERNEL/residue.h>
00020 #endif
00021
00022 #ifndef BALL_KERNEL_CHAIN_H
00023 # include<BALL/KERNEL/chain.h>
00024 #endif
00025
00026 #ifndef BALL_KERNEL_MOLECULE_H
00027 # include<BALL/KERNEL/molecule.h>
00028 #endif
00029
00030 #ifndef BALL_KERNEL_SECONDARYSTRUCTURE_H
00031 # include<BALL/KERNEL/secondaryStructure.h>
00032 #endif
00033
00034
00035 namespace BALL
00036 {
00037 namespace VIEW
00038 {
00039
00049 class BALL_VIEW_EXPORT ElementColorProcessor
00050 : public ColorProcessor
00051 {
00052 public:
00053
00054 BALL_CREATE(ElementColorProcessor)
00055
00056
00059
00064 ElementColorProcessor();
00065
00067 void setTransparency(Size value);
00068
00070 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00071
00073 HashMap<Position, ColorRGBA>& getColorMap() { return color_map_;}
00074
00076 const HashMap<Position, ColorRGBA>& getColorMap() const { return color_map_;}
00077
00079 protected:
00080
00081 HashMap<Position, ColorRGBA> color_map_;
00082 };
00083
00084
00088 class BALL_VIEW_EXPORT ResidueNumberColorProcessor
00089 : public ColorProcessor
00090 {
00091 public:
00092
00093 BALL_CREATE(ResidueNumberColorProcessor)
00094
00095
00096 ResidueNumberColorProcessor();
00097
00099 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00100
00102 void setFirstColor(const ColorRGBA& color) { first_color_ = color;}
00103
00105 void setMiddleColor(const ColorRGBA& color) { middle_color_ = color;}
00106
00108 void setLastColor(const ColorRGBA& color) { last_color_ = color;}
00109
00111 const ColorRGBA& getFirstColor() const { return first_color_;}
00112
00114 const ColorRGBA& getMiddleColor() const { return middle_color_;}
00115
00117 const ColorRGBA& getLastColor() const { return last_color_;}
00118
00120 virtual bool start();
00121
00122 protected:
00123 bool canUseMeshShortcut_(const Composite& composite);
00124
00125 GeometricObjectList list_;
00126 ColorRGBA first_color_, middle_color_, last_color_;
00127 ColorMap table_;
00128 Residue dummy_residue_;
00129 HashMap<const Residue*, Position> residue_map_;
00130 };
00131
00133 class BALL_VIEW_EXPORT PositionColorProcessor
00134 : public ColorProcessor
00135 {
00136 public:
00137
00138 BALL_CREATE(PositionColorProcessor)
00139
00140
00141 PositionColorProcessor();
00142
00144 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00145
00147 void setColors(const vector<ColorRGBA>& colors) { colors_ = colors;}
00148
00150 vector<ColorRGBA>& getColors() { return colors_;}
00151
00153 const vector<ColorRGBA>& getColors() const { return colors_;}
00154
00156 bool start();
00157
00158 protected:
00159
00160 virtual const Composite* getAncestor_(const Composite&) { return 0;}
00161
00162 virtual bool isOK_(const Composite&) { return false;}
00163
00164 vector<ColorRGBA> colors_;
00165 HashMap<const Composite*, Position> composite_to_position_;
00166 };
00167
00168
00170 class BALL_VIEW_EXPORT ChainColorProcessor
00171 : public PositionColorProcessor
00172 {
00173 public:
00174
00175 BALL_CREATE(ChainColorProcessor)
00176
00177
00178 ChainColorProcessor();
00179
00180 protected:
00181
00182 virtual const Composite* getAncestor_(const Composite& composite)
00183 { return composite.getAncestor(dummy_chain_);}
00184
00185 virtual bool isOK_(const Composite& composite) { return RTTI::isKindOf<Chain>(composite);}
00186 bool canUseMeshShortcut_(const Composite& composite);
00187
00188 Chain dummy_chain_;
00189 };
00190
00191
00193 class BALL_VIEW_EXPORT MoleculeColorProcessor
00194 : public PositionColorProcessor
00195 {
00196 public:
00197
00198 BALL_CREATE(MoleculeColorProcessor)
00199
00200
00201 MoleculeColorProcessor();
00202
00203 protected:
00204
00205 virtual const Composite* getAncestor_(const Composite& composite)
00206 { return composite.getAncestor(dummy_molecule_);}
00207
00208 virtual bool isOK_(const Composite& composite) { return RTTI::isKindOf<Molecule>(composite);}
00209 bool canUseMeshShortcut_(const Composite& composite);
00210
00211 Molecule dummy_molecule_;
00212 };
00213
00214
00222 class BALL_VIEW_EXPORT ResidueNameColorProcessor
00223 : public ColorProcessor
00224 {
00225 public:
00226
00227 BALL_CREATE(ResidueNameColorProcessor)
00228
00229
00233 ResidueNameColorProcessor();
00234
00236 void setTransparency(Size value);
00237
00239 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00240
00242 StringHashMap<ColorRGBA>& getColorMap() { return color_map_;}
00243
00245 const StringHashMap<ColorRGBA>& getColorMap() const { return color_map_;}
00246
00247 protected:
00248 StringHashMap<ColorRGBA> color_map_;
00249 Residue dummy_residue;
00250 bool canUseMeshShortcut_(const Composite& composite);
00251 };
00252
00253
00264 class BALL_VIEW_EXPORT AtomChargeColorProcessor
00265 : public InterpolateColorProcessor
00266 {
00267 public:
00268
00269 BALL_CREATE(AtomChargeColorProcessor)
00270
00271
00277 AtomChargeColorProcessor();
00278
00280 AtomChargeColorProcessor(const AtomChargeColorProcessor& color_Processor);
00281
00283 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00284 };
00285
00286
00297 class BALL_VIEW_EXPORT AtomDistanceColorProcessor
00298 : public ColorProcessor
00299 {
00300 public:
00301
00302 BALL_CREATE(AtomDistanceColorProcessor)
00303
00304
00311 AtomDistanceColorProcessor();
00312
00314 AtomDistanceColorProcessor(const AtomDistanceColorProcessor& color_Processor);
00315
00322 void setDistance(float distance) { distance_ = distance;}
00323
00326 float getDistance() const;
00327
00338 void setNullDistanceColor(const ColorRGBA& color);
00339
00342 const ColorRGBA& getNullDistanceColor() const;
00343
00354 void setMaxDistanceColor(const ColorRGBA& color);
00355
00360 const ColorRGBA& getMaxDistanceColor() const;
00361
00369 void calculateDistances();
00370
00377 virtual void addAtom(const Atom& atom);
00378
00380 virtual bool finish();
00381
00383 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00384
00386 bool showSelected() { return show_selection_;}
00387
00389 void setShowSelected(bool state) { show_selection_ = state;}
00390
00393 virtual Processor::Result operator() (GeometricObject*& object);
00394
00395 private:
00396
00397 void colorGeometricObject_(GeometricObject& object);
00398
00399
00400 virtual void colorMeshFromGrid_(Mesh& mesh);
00401
00402 typedef HashMap<const Atom*, float> AtomDistanceHashMap;
00403
00404 AtomDistanceHashMap atom_2_distance_;
00405 GeometricObjectList list_;
00406
00407 float distance_;
00408 bool show_selection_;
00409
00410 ColorRGBA null_distance_color_;
00411 ColorRGBA full_distance_color_;
00412 };
00413
00414
00418 class BALL_VIEW_EXPORT CustomColorProcessor
00419 : public ColorProcessor
00420 {
00421 public:
00422
00423 BALL_CREATE(CustomColorProcessor)
00424
00425 CustomColorProcessor()
00426 : ColorProcessor()
00427 {}
00428
00429 bool canUseMeshShortcut_(const Composite&) { return true;}
00430 };
00431
00432
00436 class BALL_VIEW_EXPORT TemperatureFactorColorProcessor
00437 : public InterpolateColorProcessor
00438 {
00439 public:
00440
00441 BALL_CREATE(TemperatureFactorColorProcessor)
00442
00443
00444 TemperatureFactorColorProcessor();
00445
00447 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00448 };
00449
00450
00454 class BALL_VIEW_EXPORT OccupancyColorProcessor
00455 : public InterpolateColorProcessor
00456 {
00457 public:
00458
00459 BALL_CREATE(OccupancyColorProcessor)
00460
00461
00462 OccupancyColorProcessor();
00463
00465 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00466 };
00467
00471 class BALL_VIEW_EXPORT ForceColorProcessor
00472 : public InterpolateColorProcessor
00473 {
00474 public:
00475
00476 BALL_CREATE(ForceColorProcessor)
00477
00478
00479 ForceColorProcessor();
00480
00482 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00483 };
00484
00485
00489 class BALL_VIEW_EXPORT SecondaryStructureColorProcessor
00490 : public ColorProcessor
00491 {
00492 public:
00493
00494 BALL_CREATE(SecondaryStructureColorProcessor)
00495
00496
00497 SecondaryStructureColorProcessor();
00498
00500 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00501
00503 void setHelixColor(const ColorRGBA& color);
00504
00506 void setCoilColor(const ColorRGBA& color);
00507
00509 void setStrandColor(const ColorRGBA& color);
00510
00512 void setTurnColor(const ColorRGBA& color);
00513
00515 const ColorRGBA& getHelixColor() const;
00516
00518 const ColorRGBA& getCoilColor() const;
00519
00521 const ColorRGBA& getStrandColor() const;
00522
00524 const ColorRGBA& getTurnColor() const;
00525
00527 virtual void setTransparency(Size t);
00528
00529 private:
00530
00531 bool canUseMeshShortcut_(const Composite& composite);
00532
00534 ColorRGBA helix_color_,
00535 coil_color_,
00536 strand_color_,
00537 turn_color_;
00538
00539 SecondaryStructure dummy_ss_;
00540 };
00541
00542
00546 class BALL_VIEW_EXPORT ResidueTypeColorProcessor
00547 : public ColorProcessor
00548 {
00549 public:
00550
00551 BALL_CREATE(ResidueTypeColorProcessor)
00552
00553
00554 ResidueTypeColorProcessor();
00555
00557 virtual void getColor(const Composite& composite, ColorRGBA& color_to_be_set);
00558
00560 void setBasicColor(const ColorRGBA& color);
00561
00563 void setAcidicColor(const ColorRGBA& color);
00564
00566 void setPolarColor(const ColorRGBA& color);
00567
00569 void setHydrophobicColor(const ColorRGBA& color);
00570
00572 void setAromaticColor(const ColorRGBA& color);
00573
00575 void setOtherColor(const ColorRGBA& color);
00576
00578 const ColorRGBA& getBasicColor() const;
00579
00581 const ColorRGBA& getAcidicColor() const;
00582
00584 const ColorRGBA& getPolarColor() const;
00585
00587 const ColorRGBA& getHydrophobicColor() const;
00588
00590 const ColorRGBA& getAromaticColor() const;
00591
00593 const ColorRGBA& getOtherColor() const;
00594
00596 virtual void setTransparency(Size t);
00597
00598 private:
00599
00600 bool canUseMeshShortcut_(const Composite& composite);
00601
00603 ColorRGBA basic_color_,
00604 acidic_color_,
00605 polar_color_,
00606 hydrophobic_color_,
00607 aromatic_color_,
00608 other_color_;
00609
00610 Residue dummy_residue_;
00611 };
00612
00613 # ifndef BALL_NO_INLINE_FUNCTIONS
00614 # include <BALL/VIEW/MODELS/standardColorProcessor.iC>
00615 # endif
00616
00617 } }
00618
00619 #endif // BALL_VIEW_MODELS_STANDARDCOLORPROCESSOR_H