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