00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_VIEW_MODELS_BALLANDSTICKMODEL_H
00008 #define BALL_VIEW_MODELS_BALLANDSTICKMODEL_H
00009
00010 #ifndef BALL_VIEW_MODELS_ATOMBONDMODELBASEPROCESSOR_H
00011 # include <BALL/VIEW/MODELS/atomBondModelBaseProcessor.h>
00012 #endif
00013
00014 #ifndef BALL_KERNEL_ATOM_H
00015 #include <BALL/KERNEL/atom.h>
00016 #endif
00017
00018 namespace BALL
00019 {
00020 class Atom;
00021
00022 namespace VIEW
00023 {
00035 class BALL_VIEW_EXPORT AddBallAndStickModel: public AtomBondModelBaseProcessor
00036 {
00037 public:
00038
00039 BALL_CREATE(AddBallAndStickModel)
00040
00041
00044
00051 AddBallAndStickModel();
00052
00055 AddBallAndStickModel(const AddBallAndStickModel& add_ball_and_stick_model);
00056
00059 virtual ~AddBallAndStickModel();
00060
00068 virtual void clear();
00069
00071
00074
00078 void set(const AddBallAndStickModel& add_ball_and_stick_model);
00079
00083 const AddBallAndStickModel& operator = (const AddBallAndStickModel& processor);
00084
00086
00094
00099 void setBallRadius(const float radius)
00100 throw(Exception::OutOfRange);
00101
00104 float getBallRadius() const;
00105
00110 void setStickRadius(const float radius)
00111 throw(Exception::OutOfRange);
00112
00115 float getStickRadius() const;
00116
00119 void enableBallAndStickModel();
00120
00123 void enableStickModel();
00124
00126
00129
00146 virtual Processor::Result operator() (Composite& composite);
00147
00149
00152
00156 bool isBallAndStickModel() const;
00157
00161 bool isStickModel() const;
00162
00164 bool dashedBondsEnabled() const
00165 { return dashed_bonds_;}
00166
00168 void enableDashedBonds(bool state)
00169 { dashed_bonds_ = state;}
00170
00172
00175
00183 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00184
00186
00187 virtual bool createGeometricObjects();
00188
00189 protected:
00190
00191 void visualiseBond_(const Bond& bond);
00192
00193 virtual void visualiseRings_();
00194
00195 inline void renderStandardBond_(const Bond& bond);
00196
00197 inline void renderMultipleBond_(const Bond& bond, Vector3 normal, Vector3 dir);
00198
00199 inline void renderDashedBond_(const Bond& bond, Vector3 n)
00200 throw(Exception::DivisionByZero);
00201
00202 void collectRingBonds_();
00203
00204 Vector3 getSP2Plane_(const Atom& atom, const Bond& bond, const Vector3& dir) const;
00205
00206 private:
00207
00208 float ball_radius_;
00209 float stick_radius_;
00210 float special_radius_;
00211
00212 bool ball_and_stick_;
00213 bool dashed_bonds_;
00214
00215 vector<vector<Bond*> > ring_bonds_;
00216 };
00217
00218 # ifndef BALL_NO_INLINE_FUNCTIONS
00219 # include <BALL/VIEW/MODELS/ballAndStickModel.iC>
00220 # endif
00221
00222 }
00223 }
00224
00225 #endif // BALL_VIEW_MODELS_BALLANDSTICKMODEL_H