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

AtomColor.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: AtomColor.h,v $
00013  *      $Author: johns $        $Locker:  $                $State: Exp $
00014  *      $Revision: 1.43 $      $Date: 2008/03/27 19:36:34 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  * 
00019  * Parse and maintain the data for how a molecule should be colored.
00020  *
00021  ***************************************************************************/
00022 #ifndef ATOMCOLOR_H
00023 #define ATOMCOLOR_H
00024 
00025 #include "utilities.h"
00026 class MoleculeList;
00027 class DrawMolecule;
00028 class Scene;
00029 
00030 // default atom coloring method, and max cmd string size
00031 #define DEFAULT_ATOMCOLOR       AtomColor::NAME
00032 #define MAX_ATOMCOLOR_CMD       255
00033 
00035 class AtomColor {
00036 public:
00040   enum ColorMethod { NAME, TYPE, ELEMENT, RESNAME, RESTYPE, RESID, CHAIN, 
00041                      SEGNAME, CONFORMATION, MOLECULE, STRUCTURE, COLORID, 
00042                      BETA, OCCUP, MASS, CHARGE, 
00043                      POS, POSX, POSY, POSZ,
00044                      USER, USER2, USER3, USER4, 
00045                      INDEX, BACKBONE, THROB, PHYSICALTIME, TIMESTEP, VELOCITY, 
00046                      VOLUME, TOTAL };
00047         
00048   char cmdStr[MAX_ATOMCOLOR_CMD + 1]; 
00049   int *color;               
00050   int nAtoms;               
00051 
00052 private:
00053   ColorMethod colorMethod;  
00054   int colIndex;             
00055   int volIndex;             
00056   const Scene *scene;       
00057 
00063   float minRange, maxRange;
00064 
00065   int need_recalc_minmax;   
00066   MoleculeList *molList;    
00067   DrawMolecule *mol;        
00068   int parse_cmd(const char *); 
00069 
00070 public:
00071   AtomColor(MoleculeList *, const Scene *);
00072   AtomColor(AtomColor &);
00073   ~AtomColor(void);
00074   
00076   AtomColor& operator=(const AtomColor &);
00077 
00080   int current_color_use(int);
00081 
00083   int find(DrawMolecule *);
00084 
00087   int change(const char *newcmd) {
00088     int retval = parse_cmd(newcmd);
00089     if(retval && mol)
00090       retval = find(mol);
00091     return retval;
00092   }
00093 
00094   //
00095   // info about current settings
00096   //
00097 
00099   int method(void) { return colorMethod; }
00100   
00102   int color_index(void) { return colIndex; }
00103 
00105   int volume_index(void) { return volIndex; }
00106 
00108   void get_colorscale_minmax(float *min, float *max) const {
00109     *min = minRange;
00110     *max = maxRange;
00111   }
00112 
00114   int set_colorscale_minmax(float min, float max) {
00115     if (min > max) return FALSE;
00116     minRange = min;
00117     maxRange = max;
00118     need_recalc_minmax = FALSE;  // don't override these values
00119     return TRUE;
00120   }
00121 
00123   void rescale_colorscale_minmax() {
00124     need_recalc_minmax = TRUE;
00125   }
00126 
00128   int uses_colorscale() const;
00129 
00131   int do_update;
00132 };
00133 
00135 extern const char *AtomColorName[AtomColor::TOTAL];
00136 extern const char *AtomColorMenuName[AtomColor::TOTAL];
00137 
00138 #endif
00139 

Generated on Sat Aug 30 01:26:27 2008 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002