DGtal  1.4.beta
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)
35 #define Board3D_RECURSES
36 
37 #if !defined Board3D_h
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 
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)
The class Board3D is a type of Display3D which export the figures in the format OBJ/MTL when calling ...
Definition: Board3D.h:82
unsigned int getMaterialIndex(const DGtal::Color &aColor)
std::map< DGtal::Color, unsigned int > myMaterialMap
Material Map.
Definition: Board3D.h:178
Board3D & operator<<(const DGtal::Color &aColor)
unsigned int myMaterialIndex
Last Material index.
Definition: Board3D.h:180
std::string className() const
Definition: Board3D.h:109
Board3D(const KSpace &KSEmb)
Definition: Board3D.h:95
void selfDisplay(std::ostream &out) const
void saveOBJ(const std::string &filename, const bool isNormalized=false)
std::stringstream myMTLBuffer
Material buffer.
Definition: Board3D.h:182
DGtal::Color myDefaultColor
default color
Definition: Board3D.h:125
bool isValid() const
Board3D & operator<<(const TDrawableWithDisplay3D &object)
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
Aim: This semi abstract class defines the stream mechanism to display 3d primitive (like BallVector,...
Definition: Display3D.h:93
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)