DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DGtalInventor.h
1 
17 #pragma once
18 
31 #if defined(DGtalInventor_RECURSES)
32 #error Recursive header files inclusion detected in DGtalInventor.h
33 #else // defined(DGtalInventor_RECURSES)
34 
35 #define DGtalInventor_RECURSES
36 
37 #if !defined DGtalInventor_h
38 
39 #define DGtalInventor_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <string>
45 #include <map>
46 #include <set>
47 #include <Inventor/nodes/SoCoordinate3.h>
48 #include <Inventor/nodes/SoDrawStyle.h>
49 #include <Inventor/nodes/SoFaceSet.h>
50 #include <Inventor/nodes/SoLineSet.h>
51 #include <Inventor/nodes/SoMaterial.h>
52 #include <Inventor/nodes/SoMaterialBinding.h>
53 #include <Inventor/nodes/SoNormal.h>
54 #include <Inventor/nodes/SoNormalBinding.h>
55 #include <Inventor/nodes/SoPointSet.h>
56 #include <Inventor/nodes/SoSeparator.h>
57 #include <Inventor/nodes/SoShapeHints.h>
58 #include <Inventor/nodes/SoSphere.h>
59 #include <Inventor/nodes/SoTranslation.h>
60 #include "DGtal/io/viewers/IVViewer.h"
61 #include "DGtal/io/viewers/Lattice.h"
62 #include "DGtal/base/Common.h"
63 #include "DGtal/kernel/CSpace.h"
65 
66 namespace DGtal
67 {
68 
70  // template class DGtalInventor
82  template <typename TSpace>
84  {
85  // ----------------------- Concept checks ------------------------------
87 
88  // ----------------------- Associated types ------------------------------
89  public:
90  typedef TSpace Space;
91  typedef typename TSpace::Point Point;
92  typedef typename TSpace::Dimension Dimension;
93  typedef typename TSpace::Integer Integer;
94 
99  typedef std::map< std::string, std::string > ModeMapping;
100 
101  typedef SbVec3f Vec3f;
102  typedef Vec3f Color;
103  typedef std::map< Point, bool > CellSet;
104  typedef std::map< Point, Vec3f > ColorMapping;
105  typedef std::map< Point, Color > NormalMapping;
106 
107  // ----------------------- Standard services ------------------------------
108  public:
109 
113  ~DGtalInventor();
114 
118  DGtalInventor();
119 
127  void setLattice( const Lattice<Space> & l );
128 
133  void clear();
134 
142  std::string getMode( const std::string & objectName ) const;
143 
144  // ----------------------- Graphics services ------------------------------
145  public:
146 
150  void setDiffuseColor( const float* color );
154  void setDiffuseColor( const Color & color );
155 
164  void drawCell( const Point & c, bool orient, const float* n = 0 );
165 
172  void drawPoint( const Point & c, const float* n = 0 );
173 
174  // ----------------------- Inventor methods --------------------------------
175  public:
176 
183  void generate( SoGroup* result ) const;
184 
185  // ----------------------- Interface --------------------------------------
186  public:
187 
192  void selfDisplay ( std::ostream & out ) const;
193 
198  bool isValid() const;
199 
200  // ------------------------- Protected Datas ------------------------------
201  private:
202  // ------------------------- Private Datas --------------------------------
203  private:
204 
209 
219 
224 
225  // ------------------------- Hidden services ------------------------------
226  protected:
227 
228 
229  private:
230 
236  DGtalInventor ( const DGtalInventor & other );
237 
244  DGtalInventor & operator= ( const DGtalInventor & other );
245 
246  // ------------------------- Internals ------------------------------------
247  private:
248 
249  }; // end of class DGtalInventor
250 
251 
258  template <typename TSpace>
259  std::ostream&
260  operator<< ( std::ostream & out, const DGtalInventor<TSpace> & object );
261 
262 } // namespace DGtal
263 
264 
266 // Includes inline functions.
267 #include "DGtal/io/viewers/DGtalInventor.ih"
268 
269 // //
271 
272 #endif // !defined DGtalInventor_h
273 
274 #undef DGtalInventor_RECURSES
275 #endif // else defined(DGtalInventor_RECURSES)