DGtal  1.3.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)
36 
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 <algorithm>
64 #include <boost/version.hpp>
65 #include <boost/concept_check.hpp>
66 #include <boost/static_assert.hpp>
67 #include <boost/concept/assert.hpp>
68 #include <boost/concept/requires.hpp>
69 #include <boost/iterator/iterator_concepts.hpp>
70 #include <boost/concept_archetype.hpp>
71 #include <boost/static_assert.hpp>
72 
73 #ifndef NDEBUG
74 #ifdef __linux__
75 #include <fenv.h>
76 #endif
77 #endif
78 
79 
80 #ifdef _MSC_VER
81 #define NOMINMAX
82 #include <windows.h>
83 #ifdef M_PI
84 #undef M_PI
85 #endif
86 
87 //C++ exception specification ignored except
88 //to indicate a function is not __declspec(nothrow)
89 #pragma warning(disable : 4290)
90 //C++ Perf Warning int <- bool
91 #pragma warning(disable : 4800)
92 #endif
93 
94 
95 #if defined( WIN32 )
96 #define _USE_MATH_DEFINES
97 #include <math.h>
98 #else
99 #include <cmath>
100 #endif //win32
101 
102 // Explicit M_PI definition if needed
103 // (issue https://github.com/DGtal-team/DGtal/issues/1204)
104 #ifndef M_PI
105 #define M_PI (3.14159265358979323846)
106 #endif
107 #ifndef M_PI_2
108 #define M_PI_2 (1.57079632679489661923)
109 #endif
110 
111 
112 #if defined( WIN32 )
113 #define secured_sprintf sprintf_s
114 #else
115 #include <stdio.h>
116 #define secured_sprintf snprintf
117 #endif // defined( WIN32 )
118 
119 #include "DGtal/base/Config.h"
120 #include "DGtal/base/Trace.h"
121 #include "DGtal/base/TraceWriterTerm.h"
122 #include "DGtal/base/TraceWriterFile.h"
123 #include "DGtal/base/Assert.h"
124 #include "DGtal/base/ConceptUtils.h"
125 #include "DGtal/base/BasicTypes.h"
126 #include "DGtal/base/BasicFunctors.h"
127 #include "DGtal/base/BasicArchetypes.h"
128 #include "DGtal/base/Exceptions.h"
129 
131 namespace DGtal
132 {
133 
138 
142  enum Orientation { INSIDE = 0, ON = 1, OUTSIDE = 2};
143 
148 
149 
154  extern Trace trace;
155 
156  class Board2D;
157 
158  template < class Space, class KSpace> class Display3D;
159 
160 
161 #if defined( WITH_CAIRO )
162  template < class Space, class KSpace> class Board3DTo2D;
163 #endif
164 #if defined( WITH_VISU3D_QGLVIEWER )
165  template < class Space, class KSpace> class Viewer3D;
166 #endif
167 
168 
169 #if defined( WITH_CAIRO )
170 
179  template < typename S, typename KS>
180 
181 void setStyle( Board3DTo2D< S, KS> & ) const {}
183  };
184 #endif
185 
186 #if defined( WITH_VISU3D_QGLVIEWER )
187 
192  struct DrawableWithViewer3D {
196  template < typename S, typename KS>
197  void setStyle( Viewer3D< S, KS> & ) const {}
198  virtual ~DrawableWithViewer3D() {}
199  };
200 #endif
201 
211  template < typename Sp, typename KSp>
212  void setStyle( Display3D< Sp, KSp> & ) const {}
214  };
215 
226  virtual void setStyle( Board2D & ) const {}
227  virtual ~DrawableWithBoard2D() {}
228  };
229 
230 } // namespace DGtal
231 
232 
233 // //
235 
236 #endif // !defined Common_h
237 
238 #undef Common_RECURSES
239 #endif // else defined(Common_RECURSES)
DGtal::DrawableWithBoard2D::setStyle
virtual void setStyle(Board2D &) const
Definition: Common.h:226
DGtal::Display3D
Aim: This semi abstract class defines the stream mechanism to display 3d primitive (like BallVector,...
Definition: Common.h:158
DGtal::DrawableWithBoard2D::~DrawableWithBoard2D
virtual ~DrawableWithBoard2D()
Definition: Common.h:227
DGtal::uint32_t
boost::uint32_t uint32_t
unsigned 32-bit integer.
Definition: BasicTypes.h:63
DGtal::ON
@ ON
Definition: Common.h:142
DGtal::trace
Trace trace
Definition: Common.h:154
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:137
DGtal::DrawableWithDisplay3D::~DrawableWithDisplay3D
virtual ~DrawableWithDisplay3D()
Definition: Common.h:213
DGtal::Closest
Closest
Definition: Common.h:147
DGtal::ClosestBOTH
@ ClosestBOTH
Definition: Common.h:147
DGtal::Trace
implementation of basic methods to trace out messages with indentation levels.
Definition: Trace.h:73
DGtal::Orientation
Orientation
Definition: Common.h:142
DGtal::Viewer3D
Definition: Viewer3D.h:135
DGtal::traceWriterTerm
TraceWriterTerm traceWriterTerm(std::cerr)
Definition: Common.h:153
DGtal::Board3DTo2D
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection.
Definition: Common.h:162
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::TraceWriterTerm
Implements trace prefix for color terminals.
Definition: TraceWriterTerm.h:63
DGtal::DrawableWithBoard3DTo2D
Definition: Common.h:175
DGtal::DrawableWithBoard3DTo2D::setStyle
void setStyle(Board3DTo2D< S, KS > &) const
Definition: Common.h:181
DGtal::ClosestFIRST
@ ClosestFIRST
Definition: Common.h:147
DGtal::DrawableWithBoard2D
Definition: Common.h:221
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70
DGtal::OUTSIDE
@ OUTSIDE
Definition: Common.h:142
DGtal::DrawableWithDisplay3D
Definition: Common.h:207
DGtal::ClosestSECOND
@ ClosestSECOND
Definition: Common.h:147
DGtal::DrawableWithBoard3DTo2D::~DrawableWithBoard3DTo2D
virtual ~DrawableWithBoard3DTo2D()
Definition: Common.h:182
DGtal::DrawableWithDisplay3D::setStyle
void setStyle(Display3D< Sp, KSp > &) const
Definition: Common.h:212
DGtal::INSIDE
@ INSIDE
Definition: Common.h:142