DGtal  1.0.0
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 #include <QGLViewer/qglviewer.h>
47 #include <QGLWidget>
48 #include <QKeyEvent>
49 #endif
50 
51 #include <iostream>
52 #include <exception>
53 #include <algorithm>
54 #include <boost/version.hpp>
55 #include <boost/concept_check.hpp>
56 #include <boost/static_assert.hpp>
57 #include <boost/concept/assert.hpp>
58 #include <boost/concept/requires.hpp>
59 #include <boost/iterator/iterator_concepts.hpp>
60 #include <boost/concept_archetype.hpp>
61 #include <boost/static_assert.hpp>
62 
63 #ifndef NDEBUG
64 #ifdef __linux__
65 #include <fenv.h>
66 #endif
67 #endif
68 
69 
70 #ifdef _MSC_VER
71 #define NOMINMAX
72 #include <windows.h>
73 #ifdef M_PI
74 #undef M_PI
75 #endif
76 
77 //C++ exception specification ignored except
78 //to indicate a function is not __declspec(nothrow)
79 #pragma warning(disable : 4290)
80 //C++ Perf Warning int <- bool
81 #pragma warning(disable : 4800)
82 #endif
83 
84 
85 #if defined( WIN32 )
86 #define _USE_MATH_DEFINES
87 #include <math.h>
88 #else
89 #include <cmath>
90 #endif //win32
91 
92 // Explicit M_PI definition if needed
93 // (issue https://github.com/DGtal-team/DGtal/issues/1204)
94 #ifndef M_PI
95 #define M_PI (3.14159265358979323846)
96 #endif
97 #ifndef M_PI_2
98 #define M_PI_2 (1.57079632679489661923)
99 #endif
100 
101 
102 #if defined( WIN32 )
103 #define secured_sprintf sprintf_s
104 #else
105 #include <stdio.h>
106 #define secured_sprintf snprintf
107 #endif // defined( WIN32 )
108 
109 #include "DGtal/base/Config.h"
110 #include "DGtal/base/Trace.h"
111 #include "DGtal/base/TraceWriterTerm.h"
112 #include "DGtal/base/TraceWriterFile.h"
113 #include "DGtal/base/Assert.h"
114 #include "DGtal/base/ConceptUtils.h"
115 #include "DGtal/base/BasicTypes.h"
116 #include "DGtal/base/BasicFunctors.h"
117 #include "DGtal/base/BasicArchetypes.h"
118 #include "DGtal/base/Exceptions.h"
119 
121 namespace DGtal
122 {
123 
128 
132  enum Orientation { INSIDE = 0, ON = 1, OUTSIDE = 2};
133 
138 
139 
144  extern Trace trace;
145 
146  class Board2D;
147 
148  template < class Space, class KSpace> class Display3D;
149 
150 
151 #if defined( WITH_CAIRO )
152  template < class Space, class KSpace> class Board3DTo2D;
153 #endif
154 #if defined( WITH_VISU3D_QGLVIEWER )
155  template < class Space, class KSpace> class Viewer3D;
156 #endif
157 
158 
159 #if defined( WITH_CAIRO )
160 
169  template < typename S, typename KS>
170 
171 void setStyle( Board3DTo2D< S, KS> & ) const {}
173  };
174 #endif
175 
176 #if defined( WITH_VISU3D_QGLVIEWER )
177 
182  struct DrawableWithViewer3D {
186  template < typename S, typename KS>
187  void setStyle( Viewer3D< S, KS> & ) const {}
188  virtual ~DrawableWithViewer3D() {}
189  };
190 #endif
191 
201  template < typename Sp, typename KSp>
202  void setStyle( Display3D< Sp, KSp> & ) const {}
204  };
205 
216  virtual void setStyle( Board2D & ) const {}
217  virtual ~DrawableWithBoard2D() {}
218  };
219 
220 } // namespace DGtal
221 
222 
223 // //
225 
226 #endif // !defined Common_h
227 
228 #undef Common_RECURSES
229 #endif // else defined(Common_RECURSES)
boost::uint32_t uint32_t
unsigned 32-bit integer.
Definition: BasicTypes.h:63
virtual void setStyle(Board2D &) const
Definition: Common.h:216
Trace trace
Definition: Common.h:144
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection.
Definition: Common.h:152
TraceWriterTerm traceWriterTerm(std::cerr)
Definition: Common.h:143
virtual ~DrawableWithBoard2D()
Definition: Common.h:217
virtual ~DrawableWithBoard3DTo2D()
Definition: Common.h:172
DGtal::uint32_t Dimension
Definition: Common.h:127
void setStyle(Board3DTo2D< S, KS > &) const
Definition: Common.h:171
virtual ~DrawableWithDisplay3D()
Definition: Common.h:203
Orientation
Definition: Common.h:132
Implements trace prefix for color terminals.
void setStyle(Display3D< Sp, KSp > &) const
Definition: Common.h:202
DGtal is the top-level namespace which contains all DGtal functions and types.
implementation of basic methods to trace out messages with indentation levels.
Definition: Trace.h:73
Aim: This semi abstract class defines the stream mechanism to display 3d primitive (like BallVector,...
Definition: Common.h:148
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70
Closest
Definition: Common.h:137