00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef DRAWMOLECULE_H
00024 #define DRAWMOLECULE_H
00025
00026 #include "BaseMolecule.h"
00027 #include "Displayable.h"
00028 #include "DrawMolItem.h"
00029 #include "ResizeArray.h"
00030
00031 class AtomColor;
00032 class AtomRep;
00033 class AtomSel;
00034 class VMDApp;
00035 class MoleculeGraphics;
00036 class DrawForce;
00037
00040 class DrawMoleculeMonitor {
00041 public:
00042
00043 virtual void notify(int) = 0;
00044 DrawMoleculeMonitor() {}
00045 virtual ~DrawMoleculeMonitor() {}
00046 };
00047
00048
00050 class DrawMolecule : public BaseMolecule, public Displayable {
00051 public:
00052 int active;
00053
00054 protected:
00055 VMDApp *app;
00056
00057 private:
00058 int repcounter;
00059
00062 MoleculeGraphics *molgraphics;
00063
00065 DrawForce *drawForce;
00066
00068 ResizeArray<DrawMolItem *> repList;
00069
00071 ResizeArray<Timestep *> timesteps;
00072
00074 int curframe;
00075
00078 int did_secondary_structure;
00079
00081 ResizeArray<DrawMoleculeMonitor *> monitorlist;
00082
00084 void addremove_ts();
00085
00086 float center[3];
00087 float scalefactor;
00088
00091 void update_cov_scale();
00092
00094 void invalidate_cov_scale();
00095
00096 public:
00098 DrawMolecule(VMDApp *, Displayable *);
00099 virtual ~DrawMolecule();
00100
00101
00102
00103
00104
00105
00108 int atom_displayed(int);
00109
00110
00111
00112
00113
00115 int components(void) { return repList.num(); }
00116
00118 DrawMolItem *component(int);
00119
00121 DrawMolItem *component_from_pickable(const Pickable *);
00122
00125 int get_component_by_name(const char *);
00126
00130 const char *get_component_name(int);
00131
00132
00134 int del_rep(int);
00135
00139 void add_rep(AtomColor *, AtomRep *, AtomSel *, const Material *);
00140
00143 int change_rep(int, AtomColor *, AtomRep *, const char *sel);
00144
00146 int show_rep(int repid, int onoff);
00147
00150
00151 void force_recalc(int);
00152
00154 void change_pbc();
00155
00157 void change_ts();
00158
00161 int highlighted_rep() const;
00162
00163
00164
00165
00166
00168 int numframes() const { return timesteps.num(); }
00169
00171 int frame() const { return curframe; }
00172
00174 void override_current_frame(int frame);
00175
00177 Timestep *current() {
00178 if (curframe >= 0 && curframe < timesteps.num())
00179 return timesteps[curframe];
00180 return NULL;
00181 }
00182
00184 Timestep *get_frame(int n) {
00185 if ( n>= 0 && n<timesteps.num() ) {
00186 return timesteps[n];
00187 }
00188 return NULL;
00189 }
00190
00192 Timestep *get_last_frame() {
00193 return get_frame(timesteps.num()-1);
00194 }
00195
00197 void delete_frame(int n);
00198
00200 void append_frame(Timestep *);
00201
00204 void duplicate_frame(const Timestep *);
00205
00207 float scale_factor();
00208
00212 int cov(float &, float &, float &);
00213
00215 int recalc_bonds(void);
00216
00218 int need_secondary_structure(int);
00219
00221 void invalidate_ss();
00222
00225 int recalc_ss();
00226
00227
00228
00229 MoleculeGraphics *moleculeGraphics() const { return molgraphics; }
00230
00231
00232 virtual void prepare();
00233
00235 void register_monitor(DrawMoleculeMonitor *);
00236
00238 void unregister_monitor(DrawMoleculeMonitor *);
00239
00240 void notify();
00241 };
00242
00243 #endif
00244