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