Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

DrawMolecule.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2011 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: DrawMolecule.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.81 $       $Date: 2012/03/07 21:32:48 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *
00019  * Displayable version of a molecule, derived from BaseMolecule and
00020  * Displayable.  This contains all the info for rendering the molecule.
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 #include "WKFThreads.h"
00031 #include "QuickSurf.h"
00032 
00033 class AtomColor;
00034 class AtomRep;
00035 class AtomSel;
00036 class VMDApp;
00037 class MoleculeGraphics;
00038 class DrawForce;
00039 
00042 class DrawMoleculeMonitor {
00043 public:
00044   // called with id of molecule
00045   virtual void notify(int) = 0;
00046   DrawMoleculeMonitor() {}
00047   virtual ~DrawMoleculeMonitor() {}
00048 };
00049 
00050 
00052 class DrawMolecule : public BaseMolecule, public Displayable {
00053 public:
00054   int active;      
00055 
00056   QuickSurf qsurf; 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 protected:
00068   VMDApp *app;
00069 
00070 private:
00071   int repcounter;  
00072 
00075   MoleculeGraphics *molgraphics;
00076 
00078   DrawForce *drawForce;
00079 
00081   ResizeArray<DrawMolItem *> repList;
00082 
00084   ResizeArray<Timestep *> timesteps;
00085 
00087   int curframe;
00088  
00091   int did_secondary_structure;
00092 
00094   ResizeArray<DrawMoleculeMonitor *> monitorlist;
00095 
00097   void addremove_ts();
00098 
00099   float center[3];          
00100   float scalefactor;        
00101   
00104   void update_cov_scale();
00105 
00107   void invalidate_cov_scale();
00108 
00109 public:
00111   DrawMolecule(VMDApp *, Displayable *);
00112   virtual ~DrawMolecule();
00113 
00114   
00115   //
00116   // public utility routines
00117   //
00118 
00120   wkf_threadpool_t * cuda_devpool(void);
00121  
00124   int atom_displayed(int);
00125 
00126   //
00127   // access routines for the drawn molecule components (which are the children)
00128   //
00129   
00131   int components(void) { return repList.num(); }
00132   
00134   DrawMolItem *component(int);
00135 
00137   DrawMolItem *component_from_pickable(const Pickable *);
00138 
00141   int get_component_by_name(const char *);
00142  
00146   const char *get_component_name(int);
00147   
00148 
00150   int del_rep(int);
00151 
00155   void add_rep(AtomColor *, AtomRep *, AtomSel *, const Material *);
00156 
00159   int change_rep(int, AtomColor *, AtomRep *, const char *sel);
00160 
00162   int show_rep(int repid, int onoff);
00163 
00166   //causing them to be recomputed on the next access.
00167   void force_recalc(int);
00168 
00170   void change_pbc();
00171 
00173   void change_ts();
00174 
00177   int highlighted_rep() const;
00178 
00179   //
00180   // methods for dealing with frames
00181   //
00182 
00184   int numframes() const { return timesteps.num(); }
00185 
00187   int frame() const { return curframe; }
00188 
00190   void override_current_frame(int frame);
00191 
00193   Timestep *current() { 
00194       if (curframe >= 0 && curframe < timesteps.num())
00195           return timesteps[curframe];
00196       return NULL;
00197   }
00198 
00200   Timestep *get_frame(int n) {
00201       if ( n>= 0 && n<timesteps.num() ) {
00202           return timesteps[n];
00203       }
00204       return NULL;
00205   }
00206 
00208   Timestep *get_last_frame() {
00209       return get_frame(timesteps.num()-1);
00210   }
00211 
00213   void delete_frame(int n);
00214 
00216   void append_frame(Timestep *);
00217 
00220   void duplicate_frame(const Timestep *);
00221 
00223   float scale_factor();
00224 
00228   int cov(float &, float &, float &);
00229 
00231   int recalc_bonds(void);
00232 
00234   int need_secondary_structure(int);
00235 
00237   void invalidate_ss();
00238 
00241   int recalc_ss();
00242 
00243   // return pointer to molgraphics so that MoleculeList::check_pickable
00244   // can test for it.
00245   MoleculeGraphics *moleculeGraphics() const { return molgraphics; }
00246 
00247   // prepare molecule for redraw
00248   virtual void prepare();
00249 
00251   void register_monitor(DrawMoleculeMonitor *);
00252 
00254   void unregister_monitor(DrawMoleculeMonitor *);
00255 
00256   void notify();
00257 };
00258 
00259 #endif
00260 

Generated on Thu May 23 01:47:23 2013 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002