File: ObjectSlice.h

package info (click to toggle)
pymol 2.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 42,288 kB
  • sloc: cpp: 476,472; python: 76,538; ansic: 29,510; javascript: 6,792; sh: 47; makefile: 24
file content (94 lines) | stat: -rw-r--r-- 2,752 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

/* 
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_ObjectSlice
#define _H_ObjectSlice

#include"ObjectMap.h"

struct ObjectSliceState {
  PyMOLGlobals *G;
  /* stored in a session */

  int Active = true;
  ObjectNameType MapName{};
  int MapState = 0;
  float MapMean = 0.0f;
  float MapStdev = 0.0f;

  float ExtentMin[3]{};
  float ExtentMax[3]{};
  int ExtentFlag = false;

  float origin[3]{};              /* the origin of the plane */
  float system[9]{              /* x, y, and z of the system */
    1.f, 0.f, 0.f,
    0.f, 1.f, 0.f,
    0.f, 0.f, 1.0f};

  /* not stored in session */

  int RefreshFlag = true;
  int min[2]{}, max[2]{};           /* extents of the arrays */
  float last_scale = 0.0f;

  /* the data is normalized for easier ploting */
  int n_points = 0;

  pymol::vla<float> values;
  pymol::vla<float> points;
  pymol::vla<int> flags;
  pymol::vla<float> colors;
  pymol::vla<float> normals;

  int n_strips = 0;
  pymol::vla<int> strips;

  pymol::cache_ptr<CGO> shaderCGO;
  float Corner[24];

  float outline_points[36];
  int outline_n_points = 0;
  float outline_zaxis[3];
  ObjectSliceState(PyMOLGlobals* G)
      : G(G){};
};

struct ObjectSlice : public pymol::CObject {
  std::vector<ObjectSliceState> State;
  PickContext context{};
  ObjectSlice(PyMOLGlobals* G);

  // virtual methods
  void update() override;
  void render(RenderInfo* info) override;
  void invalidate(cRep_t rep, cRepInv_t level, int state) override;
  int getNFrame() const override;
  pymol::CObject* clone() const override;
};

ObjectSlice *ObjectSliceFromMap(PyMOLGlobals * G, ObjectSlice * obj, ObjectMap * map,
                                int state, int map_state);

PyObject *ObjectSliceAsPyList(ObjectSlice * I);
int ObjectSliceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSlice ** result);

ObjectSliceState *ObjectSliceStateGetActive(ObjectSlice * I, int state);
void ObjectSliceDrag(ObjectSlice * I, int state, int mode, float *pt, float *mov,
                     float *z_dir);
int ObjectSliceGetVertex(ObjectSlice * I, int index, int base, float *v);

#endif