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

AtomRep.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2008 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: AtomRep.h,v $
00013  *      $Author: johns $        $Locker:  $                $State: Exp $
00014  *      $Revision: 1.59 $      $Date: 2008/03/27 19:36:35 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  * 
00019  * Parse and maintain the data for how a molecule should be represented.
00020  *
00021  ***************************************************************************/
00022 #ifndef ATOMREP_H
00023 #define ATOMREP_H
00024 
00025 // default atom representation, and max cmd string size
00026 #define DEFAULT_ATOMREP         AtomRep::LINES
00027 #define MAX_ATOMREP_CMD         255
00028 #define MAX_ATOMREP_DATA        7
00029 
00031 class AtomRep {
00032 public:
00033   // enumeration of all of the methods for representing molecules
00034   // XXX note that these MUST be ordered exactly the same way that
00035   //     they are ordered in AtomRep.C, and in the graphics forms.
00036   enum RepMethod { LINES, BONDS, DYNAMICBONDS, HBONDS,
00037                    POINTS, VDW, CPK, LICORICE, 
00038                    TRACE, TUBE, RIBBONS, 
00039                    NEWRIBBONS, STRUCTURE, NEWCARTOON, 
00040 #ifdef VMDWITHCARBS
00041                    RINGS_PAPERCHAIN, RINGS_TWISTER,
00042 #endif
00043 #ifdef VMDMSMS
00044                    MSMS, 
00045 #endif
00046 #ifdef VMDSURF
00047                    SURF,
00048 #endif
00049                    VOLSLICE, ISOSURFACE,
00050 #ifdef VMDFIELDLINES
00051                    FIELDLINES,
00052 #endif
00053                    BEADS,
00054                    DOTTED, SOLVENT,
00055                    TOTAL };
00056 
00057   // these are the same as above, but for historical reasons
00058   enum RepDataNames { SPHERERAD, BONDRAD, SPHERERES, BONDRES, LINETHICKNESS, ISOSTEPSIZE, ISOLINETHICKNESS };
00059 
00061   char cmdStr[MAX_ATOMREP_CMD + 1];
00062 
00063 private:
00065   int repMethod;
00066   float repDataStorage[TOTAL][MAX_ATOMREP_DATA];
00067   float *repData;
00068 
00070   int parse_cmd(const char *);
00071 
00072 public:
00073   AtomRep(void);
00074   AtomRep(AtomRep &ar) { *this = ar; }
00075   ~AtomRep(void);
00076   
00078   AtomRep& operator=(const AtomRep &);
00079 
00081   int change(const char *newcmd) { return parse_cmd(newcmd); }
00082 
00083   //
00084   // info about current settings
00085   //
00086 
00088   int method(void) { return repMethod; }
00089   
00091   bool is_volumetric(void) { 
00092 #ifdef VMDFIELDLINES
00093     if (repMethod == VOLSLICE || repMethod == ISOSURFACE || repMethod == FIELDLINES)
00094       return true; 
00095 #else
00096     if (repMethod == VOLSLICE || repMethod == ISOSURFACE) 
00097       return true; 
00098 #endif
00099     return false; 
00100   }
00101 
00103   float get_data(int n) { return repData[n]; }
00104 };
00105 
00106 
00107 //
00108 // global structures and variables defining the data each rep requires
00109 //
00110 
00111 // The following structure is used to define how each individual data
00112 // value is used by each rep style.  Each style uses a number of different
00113 // data items to define that rep; this structure defines the type and range
00114 // of values allowed for those items.
00115 // Each AtomRep has storage for 5 optional data values.
00116 // The order they are specified is defined by each rep style.
00117 
00119 typedef struct {
00120   int index;                 
00121   float defValue;            
00122 } AtomRepDataInfo;
00123 
00125 typedef struct {
00126   const char *name;          
00127   int numdata;               
00128   AtomRepDataInfo repdata[MAX_ATOMREP_DATA];  // info about each data value
00129 } AtomRepParamStruct;
00130 
00131 
00132 // array with definition of data for each rep
00133 extern const AtomRepParamStruct AtomRepInfo[AtomRep::TOTAL];
00134 
00135 
00136 #endif
00137 

Generated on Sun Jul 6 01:27:17 2008 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002