DGtal  0.9.3beta
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 #ifdef _MSC_VER
64 #define NOMINMAX
65 #include <windows.h>
66 #ifdef M_PI
67 #undef M_PI
68 #endif
69 
70 //C++ exception specification ignored except
71 //to indicate a function is not __declspec(nothrow)
72 #pragma warning(disable : 4290)
73 //C++ Perf Warning int <- bool
74 #pragma warning(disable : 4800)
75 #endif
76 
77 
78 #if defined( WIN32 )
79 #define _USE_MATH_DEFINES
80 #include <math.h>
81 #else
82 #include <cmath>
83 #endif //win32
84 
85 // Explicit M_PI definition if needed
86 // (issue https://github.com/DGtal-team/DGtal/issues/1204)
87 #ifndef M_PI
88 #define M_PI (3.14159265358979323846)
89 #endif
90 #ifndef M_PI_2
91 #define M_PI_2 (1.57079632679489661923)
92 #endif
93 
94 
95 #if defined( WIN32 )
96 #define secured_sprintf sprintf_s
97 #else
98 #include <stdio.h>
99 #define secured_sprintf snprintf
100 #endif // defined( WIN32 )
101 
102 #include "DGtal/base/Config.h"
103 #include "DGtal/base/Trace.h"
104 #include "DGtal/base/TraceWriterTerm.h"
105 #include "DGtal/base/TraceWriterFile.h"
106 #include "DGtal/base/Assert.h"
107 #include "DGtal/base/ConceptUtils.h"
108 #include "DGtal/base/BasicTypes.h"
109 #include "DGtal/base/BasicFunctors.h"
110 #include "DGtal/base/BasicArchetypes.h"
111 #include "DGtal/base/Exceptions.h"
112 
114 namespace DGtal
115 {
116 
121 
125  enum Orientation { INSIDE = 0, ON = 1, OUTSIDE = 2};
126 
131 
132 
137  extern Trace trace;
138 
139  class Board2D;
140 
141  template < class Space, class KSpace> class Display3D;
142 
143 
144 #if defined( WITH_CAIRO )
145  template < class Space, class KSpace> class Board3DTo2D;
146 #endif
147 #if defined( WITH_VISU3D_QGLVIEWER )
148  template < class Space, class KSpace> class Viewer3D;
149 #endif
150 
151 
152 #if defined( WITH_CAIRO )
153 
162  template < typename S, typename KS>
163 
164 void setStyle( Board3DTo2D< S, KS> & ) const {}
166  };
167 #endif
168 
169 #if defined( WITH_VISU3D_QGLVIEWER )
170 
175  struct DrawableWithViewer3D {
179  template < typename S, typename KS>
180  void setStyle( Viewer3D< S, KS> & ) const {}
181  virtual ~DrawableWithViewer3D() {}
182  };
183 #endif
184 
194  template < typename Sp, typename KSp>
195  void setStyle( Display3D< Sp, KSp> & ) const {}
197  };
198 
209  virtual void setStyle( Board2D & ) const {}
210  virtual ~DrawableWithBoard2D() {}
211  };
212 
213 } // namespace DGtal
214 
215 
216 // //
218 
219 #endif // !defined Common_h
220 
221 #undef Common_RECURSES
222 #endif // else defined(Common_RECURSES)
boost::uint32_t uint32_t
unsigned 32-bit integer.
Definition: BasicTypes.h:63
Trace trace
Definition: Common.h:137
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection.
Definition: Common.h:145
TraceWriterTerm traceWriterTerm(std::cerr)
Definition: Common.h:136
virtual ~DrawableWithBoard2D()
Definition: Common.h:210
virtual ~DrawableWithBoard3DTo2D()
Definition: Common.h:165
DGtal::uint32_t Dimension
Definition: Common.h:120
virtual void setStyle(Board2D &) const
Definition: Common.h:209
virtual ~DrawableWithDisplay3D()
Definition: Common.h:196
Orientation
Definition: Common.h:125
Implements trace prefix for color terminals.
void setStyle(Board3DTo2D< S, KS > &) const
Definition: Common.h:164
DGtal is the top-level namespace which contains all DGtal functions and types.
void setStyle(Display3D< Sp, KSp > &) const
Definition: Common.h:195
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:141
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...
Definition: Board2D.h:70
Closest
Definition: Common.h:130