DGtal  1.5.beta
Common.h
1 
17 #pragma once
18 
33 #if defined(Common_RECURSES)
34 #error Recursive header files inclusion detected in Common.h
35 #else // defined(Common_RECURSES)
37 #define Common_RECURSES
38 
39 #if !defined Common_h
40 #define Common_h
41 
43 // Inclusions
44 
45 #ifdef WITH_VISU3D_QGLVIEWER
46 #ifdef APPLE
47 /* Defined before OpenGL and GLUT includes to avoid deprecation messages */
48 #define GL_SILENCE_DEPRECATION
49 #endif
50 #pragma GCC diagnostic push
51 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
52 #pragma clang diagnostic push
53 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
54 #include <QGLViewer/qglviewer.h>
55 #include <QGLWidget>
56 #include <QKeyEvent>
57 #pragma clang diagnostic pop
58 #pragma GCC diagnostic pop
59 #endif
60 
61 #include <iostream>
62 #include <exception>
63 #include <boost/version.hpp>
64 #include <boost/concept_check.hpp>
65 #include <boost/static_assert.hpp>
66 #include <boost/concept/assert.hpp>
67 #include <boost/concept/requires.hpp>
68 #include <boost/iterator/iterator_concepts.hpp>
69 #include <boost/concept_archetype.hpp>
70 #include <boost/static_assert.hpp>
71 
72 #ifndef NDEBUG
73 #ifdef __linux__
74 #include <fenv.h>
75 #endif
76 #endif
77 
78 
79 #ifdef _MSC_VER
80 #define NOMINMAX
81 #include <windows.h>
82 #ifdef M_PI
83 #undef M_PI
84 #endif
85 
86 //C++ exception specification ignored except
87 //to indicate a function is not __declspec(nothrow)
88 #pragma warning(disable : 4290)
89 //C++ Perf Warning int <- bool
90 #pragma warning(disable : 4800)
91 #endif
92 
93 
94 #if defined( WIN32 )
95 #define _USE_MATH_DEFINES
96 #include <math.h>
97 #else
98 #include <cmath>
99 #endif //win32
100 
101 // Explicit M_PI definition if needed
102 // (issue https://github.com/DGtal-team/DGtal/issues/1204)
103 #ifndef M_PI
104 #define M_PI (3.14159265358979323846)
105 #endif
106 #ifndef M_PI_2
107 #define M_PI_2 (1.57079632679489661923)
108 #endif
109 
110 
111 #if defined( WIN32 )
112 #define secured_sprintf sprintf_s
113 #else
114 #include <stdio.h>
115 #define secured_sprintf snprintf
116 #endif // defined( WIN32 )
117 
118 #include "DGtal/base/Config.h"
119 #include "DGtal/base/Trace.h"
120 #include "DGtal/base/TraceWriterTerm.h"
121 #include "DGtal/base/TraceWriterFile.h"
122 #include "DGtal/base/Assert.h"
123 #include "DGtal/base/ConceptUtils.h"
124 #include "DGtal/base/BasicTypes.h"
125 #include "DGtal/base/BasicFunctors.h"
126 #include "DGtal/base/BasicArchetypes.h"
127 #include "DGtal/base/Exceptions.h"
128 
130 namespace DGtal
131 {
132 
137 
141  enum Orientation { INSIDE = 0, ON = 1, OUTSIDE = 2};
142 
147 
148 
153  extern Trace trace;
154 
155  class Board2D;
156 
157  template < class Space, class KSpace> class Display3D;
158 
159 
160 #if defined( WITH_CAIRO )
161  template < class Space, class KSpace> class Board3DTo2D;
162 #endif
163 #if defined( WITH_VISU3D_QGLVIEWER )
164  template < class Space, class KSpace> class Viewer3D;
165 #endif
166 
167 
168 #if defined( WITH_CAIRO )
178  template < typename S, typename KS>
179 
180 void setStyle( Board3DTo2D< S, KS> & ) const {}
182  };
183 #endif
184 
185 #if defined( WITH_VISU3D_QGLVIEWER )
191  struct DrawableWithViewer3D {
195  template < typename S, typename KS>
196  void setStyle( Viewer3D< S, KS> & ) const {}
197  virtual ~DrawableWithViewer3D() {}
198  };
199 #endif
200 
210  template < typename Sp, typename KSp>
211  void setStyle( Display3D< Sp, KSp> & ) const {}
213  };
214 
225  virtual void setStyle( Board2D & ) const {}
226  virtual ~DrawableWithBoard2D() {}
227  };
228 
229 } // namespace DGtal
230 
231 
232 // //
234 
235 #endif // !defined Common_h
236 
237 #undef Common_RECURSES
238 #endif // else defined(Common_RECURSES)
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:71
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection.
Definition: Board3DTo2D.h:71
Aim: This semi abstract class defines the stream mechanism to display 3d primitive (like BallVector,...
Definition: Display3D.h:93
Implements trace prefix for color terminals.
implementation of basic methods to trace out messages with indentation levels.
Definition: Trace.h:74
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::uint32_t uint32_t
unsigned 32-bit integer.
Definition: BasicTypes.h:63
Closest
Definition: Common.h:146
@ ClosestBOTH
Definition: Common.h:146
@ ClosestSECOND
Definition: Common.h:146
@ ClosestFIRST
Definition: Common.h:146
DGtal::uint32_t Dimension
Definition: Common.h:136
Trace trace
Definition: Common.h:153
Orientation
Definition: Common.h:141
@ INSIDE
Definition: Common.h:141
@ OUTSIDE
Definition: Common.h:141
@ ON
Definition: Common.h:141
TraceWriterTerm traceWriterTerm(std::cerr)
Definition: Common.h:152
virtual void setStyle(Board2D &) const
Definition: Common.h:225
virtual ~DrawableWithBoard2D()
Definition: Common.h:226
void setStyle(Board3DTo2D< S, KS > &) const
Definition: Common.h:180
virtual ~DrawableWithBoard3DTo2D()
Definition: Common.h:181
void setStyle(Display3D< Sp, KSp > &) const
Definition: Common.h:211
virtual ~DrawableWithDisplay3D()
Definition: Common.h:212