DGtal  0.9.2
Board3D.h
1 
17 #pragma once
18 
31 #if defined(Board3D_RECURSES)
32 #error Recursive header files inclusion detected in Board3D.h
33 #else // defined(Board3D_RECURSES)
34 
35 #define Board3D_RECURSES
36 
37 #if !defined Board3D_h
38 
39 #define Board3D_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <vector>
45 #include <algorithm>
46 #include <map>
47 
48 #include "DGtal/base/Common.h"
49 #include "DGtal/base/CountedPtr.h"
50 #include "DGtal/io/Display3D.h"
51 #include "DGtal/io/DrawWithDisplay3DModifier.h"
52 #include "DGtal/io/Color.h"
53 
55 
56 namespace DGtal
57 {
58 
59 
61  // class Board3D
80  template < typename Space = Z3i::Space, typename KSpace = Z3i::KSpace>
81  class Board3D : public Display3D<Space, KSpace>
82  {
83  public:
84 
85 
89  Board3D();
90 
95  Board3D(const KSpace &KSEmb):Display3D<Space,KSpace>(KSEmb)
96  {
97  init();
98  }
99 
100 
104  ~Board3D(){};
105 
109  std::string className() const
110  {
111  return "Board3D";
112  }
113 
120  void saveOBJ(const std::string & filename,
121  const bool isNormalized = false);
122 
123 
124 
126 
127 
134  Board3D & operator<<(const DGtal::Color & aColor);
135 
136 
145  template <typename TDrawableWithDisplay3D>
146  Board3D & operator<<( const TDrawableWithDisplay3D & object );
147 
148 
153  void selfDisplay ( std::ostream & out ) const;
154 
155 
160  bool isValid() const;
161 
171  unsigned int getMaterialIndex(const DGtal::Color &aColor);
172 
173  // ------------------------- Private Datas --------------------------------
174  private:
175 
176 
178  std::map<DGtal::Color,unsigned int> myMaterialMap;
180  unsigned int myMaterialIndex;
182  std::stringstream myMTLBuffer;
183 
184 
185  protected :
189  void init();
190 
191  }; // end of class Board3D
192 
193 
200  template < typename Space, typename KSpace>
201  std::ostream&
202  operator<< ( std::ostream & out, const Board3D<Space, KSpace> & object );
203 
204 } // namespace DGtal
205 
206 
208 // Includes inline functions.
209 #include "DGtal/io/boards/Board3D.ih"
210 
211 
212 // //
214 
215 #endif // !defined Board3D_h
216 
217 #undef Board3D_RECURSES
218 #endif // else defined(Board3D_RECURSES)
bool isValid() const
std::map< DGtal::Color, unsigned int > myMaterialMap
Material Map.
Definition: Board3D.h:178
std::stringstream myMTLBuffer
Material buffer.
Definition: Board3D.h:182
void saveOBJ(const std::string &filename, const bool isNormalized=false)
Aim: SpaceND is a utility class that defines the fundamental structure of a Digital Space in ND...
Definition: SpaceND.h:95
Board3D(const KSpace &KSEmb)
Definition: Board3D.h:95
unsigned int myMaterialIndex
Last Material index.
Definition: Board3D.h:180
The class Board3D is a type of Display3D which export the figures in the format OBJ/MTL when calling ...
Definition: Board3D.h:81
DGtal is the top-level namespace which contains all DGtal functions and types.
void selfDisplay(std::ostream &out) const
DGtal::Color myDefaultColor
default color
Definition: Board3D.h:125
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
Board3D & operator<<(const DGtal::Color &aColor)
std::string className() const
Definition: Board3D.h:109
Aim: This semi abstract class defines the stream mechanism to display 3d primitive (like BallVector...
Definition: Common.h:134
unsigned int getMaterialIndex(const DGtal::Color &aColor)