MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CutSurf.hpp
1 #ifndef CUT_SURF_H
2 #define CUT_SURF_H
3 
4 #include <Config.hpp>
5 #include <GL.hpp>
6 
7 #include <Color.hpp>
8 #include <CuttingSurface.hpp>
9 #include <Geometry.hpp>
10 #include <MGXViewer/qglviewer.h>
11 #include <Parms.hpp>
12 
13 namespace mgx {
14 
15  typedef util::Color<float> Color3f;
16  class Shader;
17  class ImgData;
18  class Stack;
19 
20  // Class to handle rotatable cutting plane.
21  class mgx_EXPORT CutSurf : public QObject {
22  Q_OBJECT
23  public:
24  CutSurf();
25  ~CutSurf();
26 
27  CuttingSurface* cut;
28 
29  std::set<uint> selectV; // List of selected vertices
30 
31  protected:
32  uint BlendSlices;
33  uint Material;
34  float LineWidth;
35 
36  void drawSurface(ImgData& stk, bool select);
37 
38  public:
39  // Read clipping plane parameters
40  void readParms(util::Parms& parms, QString section);
41 
42  // write parms to file
43  void writeParms(QTextStream& out, QString section);
44 
45  // Draw cutting plane
46  void drawCutSurf(ImgData& stk, bool select, Shader* shader = 0);
47  void drawCutSurfGrid(ImgData& stk);
48  void drawSelect();
49 
50  // Get frame
51  qglviewer::ManipulatedFrame* getFrame() {
52  return &cut->frame();
53  }
54 
55  // Clear selection
56  void clearSelect();
57 
58  // Find the spline point selected
59  int findSelectPoint(uint x, uint y);
60 
61  // Return true if the cutting surface is opaque if drawn for this stack
62  bool showOpaqueSurface(const ImgData& stk);
63 
64  // Return true if the cutting surface is transparent if drawn for this stack
65  bool showTransparentSurface(const ImgData& stk);
66 
67  float getSceneRadius() {
68  return SceneRadius;
69  };
70 
71  protected:
72  void initBez();
73  double SceneRadius;
74  float getSize(int val);
75 
76  public slots:
77  // Set sizes
78  void DrawCutSurfSlot(bool val);
79  void ThreeAxisSlot(bool val);
80  void CutSurfGridSlot(bool val);
81  void CutSurfPlaneSlot(bool val);
82  void CutSurfBezierSlot(bool val);
83  void SizeXSlot(int val);
84  void SizeYSlot(int val);
85  void SizeZSlot(int val);
86  void Reset(double sceneRadius);
87  void setSceneBoundingBox(const Point3f& bbox);
88 
89  signals:
90  void DrawCutSurfSignal(bool val);
91  void ThreeAxisSignal(bool val);
92  void CutSurfGridSignal(bool val);
93  void CutSurfPlaneSignal(bool val);
94  void CutSurfBezierSignal(bool val);
95  void SizeXSignal(int val);
96  void SizeYSignal(int val);
97  void SizeZSignal(int val);
98  void ViewerUpdateSignal();
99  };
100 
101 }
102 
103 #endif
Definition: CuttingSurface.hpp:18
Defines the util::Parms class.
Definition: Shader.hpp:269
Common definitions and utilities for all geometry algorithms This file is shared by cuda...
A utility class to parse L-Studio like parameter files.
Definition: Parms.hpp:105
Definition: CutSurf.hpp:21
Definition: ImageData.hpp:37
Defines the Color class template.