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

AtomColor.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 /***************************************************************************
00009  * RCS INFORMATION:
00010  *
00011  *      $RCSfile: AtomColor.h,v $
00012  *      $Author: johns $        $Locker:  $                $State: Exp $
00013  *      $Revision: 1.50 $      $Date: 2020/02/26 03:51:30 $
00014  *
00015  ***************************************************************************/
00021 #ifndef ATOMCOLOR_H
00022 #define ATOMCOLOR_H
00023 
00024 #include "utilities.h"
00025 class MoleculeList;
00026 class DrawMolecule;
00027 class Scene;
00028 
00030 #define DEFAULT_ATOMCOLOR       AtomColor::NAME
00031 #define MAX_ATOMCOLOR_CMD       255
00032 
00034 class AtomColor {
00035 public:
00039   enum ColorMethod { NAME, TYPE, ELEMENT, RESNAME, RESTYPE, RESID, CHAIN, 
00040                      SEGNAME, CONFORMATION, MOLECULE, STRUCTURE, COLORID, 
00041                      BETA, OCCUP, MASS, CHARGE, 
00042                      POS, POSX, POSY, POSZ,
00043                      USER, USER2, USER3, USER4, FRAGMENT,
00044                      INDEX, BACKBONE, THROB, PHYSICALTIME, TIMESTEP, VELOCITY, 
00045                      VOLUME, TOTAL };
00046         
00047   char cmdStr[MAX_ATOMCOLOR_CMD + 1]; 
00048   int *color;               
00049   int nAtoms;               
00050 
00051 private:
00052   ColorMethod colorMethod;  
00053   int colIndex;             
00054   int volIndex;             
00055   const Scene *scene;       
00056 
00062   float minRange, maxRange;
00063 
00064   int need_recalc_minmax;   
00065   MoleculeList *molList;    
00066   DrawMolecule *mol;        
00067   int parse_cmd(const char *); 
00068 
00069 public:
00070   AtomColor(MoleculeList *, const Scene *);
00071   AtomColor(AtomColor &);
00072   ~AtomColor(void);
00073   
00075   AtomColor& operator=(const AtomColor &);
00076 
00079   int current_color_use(int);
00080 
00082   int find(DrawMolecule *);
00083 
00086   int change(const char *newcmd) {
00087     int retval = parse_cmd(newcmd);
00088     if(retval && mol)
00089       retval = find(mol);
00090     return retval;
00091   }
00092 
00093   //
00094   // info about current settings
00095   //
00096 
00098   int method(void) { return colorMethod; }
00099   
00101   int color_index(void) { return colIndex; }
00102 
00104   int volume_index(void) { return volIndex; }
00105 
00107   void get_colorscale_minmax(float *min, float *max) const {
00108     *min = minRange;
00109     *max = maxRange;
00110   }
00111 
00113   int set_colorscale_minmax(float min, float max) {
00114     if (min > max) return FALSE;
00115     minRange = min;
00116     maxRange = max;
00117     need_recalc_minmax = FALSE;  // don't override these values
00118     return TRUE;
00119   }
00120 
00122   void rescale_colorscale_minmax() {
00123     need_recalc_minmax = TRUE;
00124   }
00125 
00127   int uses_colorscale() const;
00128 
00130   int do_update;
00131 };
00132 
00134 extern const char *AtomColorName[AtomColor::TOTAL];
00135 extern const char *AtomColorMenuName[AtomColor::TOTAL];
00136 
00137 #endif
00138 

Generated on Tue Apr 23 04:22:23 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002