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 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: GeometryList.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.43 $ $Date: 2019年01月17日 21:20:59 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * 00019 * This maintains a set of lists of geometry monitors, and draws them to 00020 * the scene. This is a Displayable which keeps the graphical representations 00021 * of the geometry monitors; this is also a Pickable, and creates and controls 00022 * the PickMode objects which create new geometry monitors via the pointers. 00023 * This object keeps a set of ResizeArray, each of which is a 'category' for 00024 * geometry monitors (i.e Atoms, Bonds, etc.) containing GeometryMol objects. 00025 * 00026 ***************************************************************************/ 00027 #ifndef GEOMETRYLIST_H 00028 #define GEOMETRYLIST_H 00029 00030 #include "Displayable.h" 00031 #include "NameList.h" 00032 #include "ResizeArray.h" 00033 #include "GeometryMol.h" 00034 #include "DispCmds.h" 00035 class VMDApp; 00036 00037 00039 typedef ResizeArray<GeometryMol *> *GeomListPtr; 00040 00042 typedef struct { 00043 GeomListPtr geomList; 00044 int defaultColor; 00045 int curColor; 00046 } GeomListStruct; 00047 00048 00050 class GeometryList : public Displayable { 00051 private: 00053 NameList<GeomListStruct *> geomLists; 00054 00056 int colorCat; 00057 00058 VMDApp *app; 00059 00062 int add_geom_list(const char *, int); 00063 00065 int del_geom_list(int); 00066 00068 float labelsize; 00070 float labelthickness; 00071 00072 protected: 00074 virtual void do_color_changed(int); 00075 00076 public: 00077 GeometryList(VMDApp *, Displayable *); 00078 00080 virtual ~GeometryList(void); 00081 00082 // 00083 // return information about this class 00084 // 00085 00087 int num_lists(void) { return geomLists.num(); } 00088 00090 GeomListPtr geom_list(int n) { return (geomLists.data(n))->geomList; } 00091 00093 GeomListPtr geom_list(const char *nm) { 00094 int glistindex = geom_list_index(nm); 00095 return (glistindex >= 0 ? geom_list(glistindex) : (GeomListPtr) NULL); 00096 } 00097 00099 const char *geom_list_name(int n) { return geomLists.name(n); } 00100 00102 int geom_list_index(const char *nm) { return geomLists.typecode(nm); } 00103 00104 // 00105 // routines to add/delete/modify geometry objects 00106 // NOTE: after GeometryMol objects have been added, they remain in the 00107 // lists until either explicitely deleted, or their 'ok' routine 00108 // no longer returns 'TRUE'. If 'ok' returns FALSE, they are 00109 // deleted. 00110 // 00111 00115 int add_geometry(const char *geomcat, const int *molids, const int *atomids, 00116 const int *cells, float k, int toggle); 00117 00119 int del_geometry(int, int); 00120 00122 int del_geometry(const char *nm, int n) { 00123 return del_geometry(geom_list_index(nm), n); 00124 } 00125 00129 int show_geometry(int, int, int); 00130 00132 int show_geometry(const char *nm, int n, int s) { 00133 return show_geometry(geom_list_index(nm), n, s); 00134 } 00135 00137 float getTextSize() const { return labelsize; } 00138 int setTextSize(float); 00139 00141 float getTextThickness() const { return labelthickness; } 00142 int setTextThickness(float); 00143 00144 const float *getTextOffset(const char *nm, int n); 00145 00147 int setTextOffset(const char *nm, int n, const float delta[2]); 00148 00149 const char *getTextFormat(const char *nm, int n); 00150 int setTextFormat(const char *nm, int n, const char *format); 00151 00152 // 00153 // public virtual drawing routines 00154 // 00155 00157 virtual void prepare(); 00158 }; 00159 00160 #endif 00161