File: Rep.h

package info (click to toggle)
pymol 1.8.4.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 42,248 kB
  • ctags: 24,095
  • sloc: cpp: 474,635; python: 75,034; ansic: 22,888; sh: 236; makefile: 78; csh: 21
file content (200 lines) | stat: -rw-r--r-- 5,705 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200

/* 
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific. 
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information. 
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-* 
-* 
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_Rep
#define _H_Rep

#include"Base.h"
#include"Ray.h"

#define cCartoon_skip -1
#define cCartoon_auto 0
#define cCartoon_loop 1
#define cCartoon_rect 2
#define cCartoon_oval 3
#define cCartoon_tube 4
#define cCartoon_arrow 5
#define cCartoon_dumbbell 6
#define cCartoon_putty 7
#define cCartoon_dash 8

#define cCartoon_skip_helix -2
#define cRepAll       -1
#define cRepNone      -2


/* WARNING: don't change these -- you'll break sessions!
   (you can add to them however, I think) */

enum {
  cRepCyl,             // 0
  cRepSphere,          // 1
  cRepSurface,         // 2
  cRepLabel,           // 3
  cRepNonbondedSphere, // 4
  cRepCartoon,         // 5
  cRepRibbon,          // 6
  cRepLine,            // 7
  cRepMesh,            // 8
  cRepDot,             // 9
  cRepDash,            // 10
  cRepNonbonded,       // 11
  cRepCell,            // 12
  cRepCGO,             // 13
  cRepCallback,        // 14
  cRepExtent,          // 15
  cRepSlice,           // 16
  cRepAngle,           // 17
  cRepDihedral,        // 18
  cRepEllipsoid,       // 19
  cRepVolume,          // 20
  // rep count
  cRepCnt
};

#define cRepCylBit             (1 << 0)
#define cRepSphereBit          (1 << 1)
#define cRepSurfaceBit         (1 << 2)
#define cRepLabelBit           (1 << 3)
#define cRepNonbondedSphereBit (1 << 4)
#define cRepCartoonBit         (1 << 5)
#define cRepRibbonBit          (1 << 6)
#define cRepLineBit            (1 << 7)
#define cRepMeshBit            (1 << 8)
#define cRepDotBit             (1 << 9)
#define cRepDashBit            (1 << 10)
#define cRepNonbondedBit       (1 << 11)
#define cRepCellBit            (1 << 12)
#define cRepCGOBit             (1 << 13)
#define cRepCallbackBit        (1 << 14)
#define cRepExtentBit          (1 << 15)
#define cRepSliceBit           (1 << 16)
#define cRepAngleBit           (1 << 17)
#define cRepDihedralBit        (1 << 18)
#define cRepEllipsoidBit       (1 << 19)
#define cRepVolumeBit          (1 << 20)

/* Add other reps here.  Don't forget to
 * update modules/constants.py::repres{}
 * update modules/constants.py::fb_module, if needed
 * update modules/viewing.py::rep_list
 * create your RepXYZ.h and RepXYZ.c
 */

#define cRepBitmask        ((1 << cRepCnt) - 1)

// all reps which can be shown for atoms
const int cRepsAtomMask = (cRepCylBit | cRepSphereBit | cRepSurfaceBit | \
    cRepLabelBit | cRepNonbondedSphereBit | cRepCartoonBit | cRepRibbonBit | \
    cRepLineBit | cRepMeshBit | cRepDotBit | cRepNonbondedBit | cRepEllipsoidBit);

// all reps which can be shown for objects
const int cRepsObjectMask = (cRepSurfaceBit | cRepMeshBit | cRepDotBit | \
    cRepCellBit | cRepCGOBit | cRepCallbackBit | cRepExtentBit | cRepSliceBit | \
    cRepAngleBit | cRepDihedralBit | cRepVolumeBit | cRepDashBit);

/* Hierarchical invalidation scheme - 
 * each higher level event implies all of the lower levels 
 * These used to be used just for graphics, but are now
 * used by the molecular editor as well */


/* invalite display (list) */

#define cRepInvDisplay 1

/* precomputed extents (can change if matrix changes) */
#define cRepInvExtents 5

/* invalidate pickable atoms */
#define cRepInvPick  9

/* invalidate external atom colors */
#define cRepInvExtColor  10

/* invalidate atom colors */
#define cRepInvColor  15

/* invalidate label text */
#define cRepInvText   16

/* invalidate visible atoms */
#define cRepInvVisib  20
#define cRepInvVisib2 21

/* invalidate atomic properties */
#define cRepInvProp   22

/* invalidate coordinates */
#define cRepInvCoord  30

/* invalidate graphic representation */
#define cRepInvRep    35

/* invalidate bond structure */
#define cRepInvBonds  40

/* invalidate atomic structure */
#define cRepInvAtoms  50

/* invalidate everything about a structure */
#define cRepInvAll    100

/* invalidate and furthermore, purge existing representations */
#define cRepInvPurge  110

struct CoordSet;
struct Object;

typedef struct Rep {
  PyMOLGlobals *G;
  void (*fRender) (struct Rep * I, RenderInfo * info);
  struct Rep *(*fUpdate) (struct Rep * I, struct CoordSet * cs, int state, int rep);
  void (*fInvalidate) (struct Rep * I, struct CoordSet * cs, int level);
  void (*fFree) (struct Rep * I);
  int MaxInvalid, Active;
  CObject *obj;
  struct CoordSet *cs;
  Pickable *P;
  PickContext context;
  /* private */
  void (*fRecolor) (struct Rep * I, struct CoordSet * cs);
  int (*fSameVis) (struct Rep * I, struct CoordSet * cs);
  int (*fSameColor) (struct Rep * I, struct CoordSet * cs);
  struct Rep *(*fRebuild) (struct Rep * I, struct CoordSet * cs, int state, int rep);
  struct Rep *(*fNew) (struct CoordSet * cs, int state);
} Rep;

void RepInit(PyMOLGlobals * G, Rep * I);
void RepPurge(Rep * I);
void RepInvalidate(struct Rep *I, struct CoordSet *cs, int level);

int RepGetAutoShowMask(PyMOLGlobals * G);

class RepIterator {
  int end;

public:
  int rep;

  RepIterator(PyMOLGlobals * G, int rep_);

  bool next() {
    return (++rep < end);
  };
};

#endif