MorphoGraphX  2.0-1-227
CutSurf.hpp
Go to the documentation of this file.
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 
12 // Draw the cutting surface.
13 
14 #ifndef CUT_SURF_H
15 #define CUT_SURF_H
16 
17 #include <Config.hpp>
18 #include <GL.hpp>
19 
20 #include <Color.hpp>
21 #include <CuttingSurface.hpp>
22 #include <Geometry.hpp>
23 #include <MGXViewer/qglviewer.h>
24 #include <Parms.hpp>
25 
26 namespace mgx
27 {
28  typedef Color<float> Color3f;
29  class Shader;
30  class ImgData;
31  class Stack;
32 
33  // Class to handle rotatable cutting plane.
34  class mgx_EXPORT CutSurf : public QObject
35  {
36  Q_OBJECT
37  public:
38  CutSurf();
39  ~CutSurf();
40 
42 
43  std::set<uint> selectV; // List of selected vertices
44 
45  protected:
48  float LineWidth;
49 
50  void drawSurface(ImgData& stk, bool select);
51 
52  public:
53  // Read clipping plane parameters
54  void readParms(Parms& parms, QString section);
55 
56  // write parms to file
57  void writeParms(QTextStream& out, QString section);
58 
59  // Draw cutting plane
60  void drawCutSurf(ImgData& stk, bool select, Shader* shader = 0);
61  void drawCutSurfGrid(ImgData& stk);
62 
63  // Get frame
65 
66  // Clear selection
67  void clearSelect();
68 
69  // Return true if the cutting surface is opaque if drawn for this stack
70  bool showOpaqueSurface(const ImgData& stk);
71 
72  // Return true if the cutting surface is transparent if drawn for this stack
73  bool showTransparentSurface(const ImgData& stk);
74 
75  float getSceneRadius() {
76  return SceneRadius;
77  };
78 
79  protected:
80  double SceneRadius;
81  float getSize(int val);
82 
83  public slots:
84  // Set sizes
85  void DrawCutSurfSlot(bool val);
86  void ThreeAxisSlot(bool val);
87  void CutSurfGridSlot(bool val);
88  void CutSurfPlaneSlot(bool val);
89  void CutSurfBezierSlot(bool val);
90  void SizeXSlot(int val);
91  void SizeYSlot(int val);
92  void SizeZSlot(int val);
93  void Reset(double sceneRadius);
94  void setSceneBoundingBox(const Point3f& bbox);
95 
96  signals:
97  void DrawCutSurfSignal(bool val);
98  void ThreeAxisSignal(bool val);
99  void CutSurfGridSignal(bool val);
100  void CutSurfPlaneSignal(bool val);
101  void CutSurfBezierSignal(bool val);
102  void SizeXSignal(int val);
103  void SizeYSignal(int val);
104  void SizeZSignal(int val);
105  void ViewerUpdateSignal();
106  };
107 }
108 #endif
mgx::uint
unsigned int uint
Definition: Geometry.hpp:41
mgx::CutSurf::Material
uint Material
Definition: CutSurf.hpp:47
mgx::CutSurf::getFrame
qglviewer::ManipulatedFrame * getFrame()
Definition: CutSurf.hpp:64
GL.hpp
qglviewer::ManipulatedFrame
mgx::CutSurf::BlendSlices
uint BlendSlices
Definition: CutSurf.hpp:46
mgx::Shader
Definition: Shader.hpp:274
Geometry.hpp
mgx::CuttingSurface
Definition: CuttingSurface.hpp:27
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::CuttingSurface::frame
qglviewer::ManipulatedFrame & frame()
Definition: CuttingSurface.hpp:110
mgx::CutSurf::cut
CuttingSurface * cut
Definition: CutSurf.hpp:41
Parms.hpp
mgx::Color3f
Color< float > Color3f
Definition: ClipRegion.hpp:32
mgx::CutSurf::getSceneRadius
float getSceneRadius()
Definition: CutSurf.hpp:75
mgx::Information::out
mgx_EXPORT QTextStream out
mgx::ImgData
Definition: ImageData.hpp:45
mgx::Vector< 3, float >
CuttingSurface.hpp
Color.hpp
mgx::CutSurf::selectV
std::set< uint > selectV
Definition: CutSurf.hpp:43
mgx::CutSurf::LineWidth
float LineWidth
Definition: CutSurf.hpp:48
mgx::CutSurf
Definition: CutSurf.hpp:34
mgx::Parms
A utility class to parse L-Studio like parameter files.
Definition: Parms.hpp:116