DATAKIT SDK  V2026.2
cgrw.hpp
Go to the documentation of this file.
1 /**********************************************************
2 CGRW.HPP
3 ***********************************************************/
4 #ifndef _CGRW_HPP_
5 #define _CGRW_HPP_
6 #include "util/util_stl_dtk.hpp"
8 #include "util/util_ent_dtk.hpp"
9 #include "util/util_ptr_dtk.hpp"
10 #include "util/util_mesh_dtk.hpp"
11 
12  //! \defgroup cgrw_utils cgr Write Util Functions
13  //! \brief.
14 
15  class Dtk_mesh_instance;
16 
17 
18  //! \class Dtk_mesh_asm_node
19  //! \brief This class gathers asm node related datas.
21  {
22  protected:
23  int id;
29 
30  public:
31 
32  //! \brief Used to store global computed bounding box
33  Dtk_bounding_box BB;
34 
35  //! \brief Default constructor
37  //! \brief Default destructor
39 
40  //! \brief Return the nb of instances in the current node
42  //! \brief Return the i-th instance
43  Dtk_mesh_instance* get_instance(int i);
44  //! \brief Add an asm instance to the current asm node
46  //! \brief Add an Dtk_mesh in Dtk_mesh_asm_node in the current asm node
47  int add_mesh(Dtk_MeshPtr mesh);
48  //! \brief Add an Dtk_AxisSystemPtr in Dtk_mesh_asm_node in the current asm node
50  //! \brief Set an Id
51  void set_id(int inId);
52  //! \brief Set an material
53  void set_material(Dtk_MaterialPtr inMaterial);
54  //! \brief Set an render
56 
57  //! \brief Get an Id
58  int get_id();
59  //! \brief Get an material
61  //! \brief Get an material
63 
64  //! \brief Compute Bounding Boxes
66 
67  //! \brief set color on Dtk_mesh_asm_node
68  void set_color(Dtk_RGB& inColor);
69 
70  //! \brief get color on Dtk_mesh_asm_node
72  };
73 
74 
75  //! \class WriteOptions
76  //! \brief This class provides several options to tunes cgr Writter.\n
77  //! It must be provided to cgr::cgrw_InitWrite method.
78  //! \code
79  //! //...
80  //! \endcode
82  {
83  protected:
85  public:
86  //! \BaseConstructor
88 
89  //! \BaseDestructor
91 
92  //! \brief Sets the release for the written files.
93  //! \brief the valid versions are 14 and 19.
94  //! \param [in] inRelease : The file release.
95  inline void SetFileRelease(const Dtk_UInt32 inRelease)
96  {
97  switch (inRelease)
98  {
99  case 19:
100  _FileRelease = (Dtk_UChar8)inRelease; return;
101  case 14:
102  default:
103  _FileRelease = 14; return;
104  }
105  }
106  //! \brief Retrieve the Written file release.
107  inline Dtk_UInt32 GetFileRelease() const { return _FileRelease; }
108  };
109 
110  //! \ingroup cgrw_utils
111  //! \brief Initialize the Cgr Writer
112  //! \return DTK_NOERROR if it is ok DTK_ISERROR else.
113  //! \remark This is the first function called for the writer.
114  //! \param [in] inFileWritten : File to write
115  //! \param [in] inLogFile : Log file
116  //! \param [in] inLicFct : Licence fuction or Null
117  //! \param [in] inLicFile : Datakit Licence file or Null
118  //! \param [in] inOptions : Options (release,...)
119  int cgrw_InitWrite(Dtk_string inFileWritten, Dtk_string inLogFile, Licence_dtk inLicFct, Dtk_string inLicenceFile, const WriteOptions & inOptions = WriteOptions());
120 
121  //! \ingroup cgrw_utils
122  //! \brief Write a mesh assembly
123  //! \return DTK_NOERROR if it is ok DTK_ISERROR else.
125 
126  //! \ingroup cgrw_utils
127  //! \brief Free the Cgr Writer
128  //! \return DTK_NOERROR if it is ok DTK_ISERROR else.
129  //! \remark used at the last function used for the writer.
131  //! \ingroup cgrw_utils
132  //! \brief write material
133  //! \param [bool] inVal
134  //!
135  //! SetCfgCgrWriteMaterial(const Dtk_bool &inVal);
136  //! \endcode
137  void SetCfgCgrWriteMaterial(const Dtk_bool &inVal);
138 
139 #endif
140 
141 
WriteOptions::_FileRelease
Dtk_UChar8 _FileRelease
Definition: cgrw.hpp:84
Dtk_mesh_asm_node
This class gathers asm node related datas.
Definition: cgrw.hpp:21
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Dtk_mesh_asm_node::set_material
void set_material(Dtk_MaterialPtr inMaterial)
Set an material.
Dtk_mesh_asm_node::set_id
void set_id(int inId)
Set an Id.
WriteOptions::WriteOptions
WriteOptions()
Default constructor.
Definition: cgrw.hpp:87
Dtk_mesh_asm_node::Dtk_mesh_asm_node
Dtk_mesh_asm_node()
Default constructor.
catiav5w::inTransfo
const Dtk_string const Dtk_transfo & inTransfo
Definition: catiav5w.hpp:622
Dtk_mesh_asm_node::add_axis_system
int add_axis_system(Dtk_AxisSystemPtr inAxisSystem)
Add an Dtk_AxisSystemPtr in Dtk_mesh_asm_node in the current asm node.
Dtk_UInt32
uint32_t Dtk_UInt32
Definition: define.h:680
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:704
Dtk_mesh_asm_node::render
Dtk_RenderInfosPtr render
Definition: cgrw.hpp:27
Dtk_mesh_asm_node::node_color
Dtk_RGB node_color
Definition: cgrw.hpp:25
Dtk_status
Definition: dtk_status.hpp:16
Dtk_bool
char Dtk_bool
Definition: define.h:717
Dtk_mesh_asm_node::get_id
int get_id()
Get an Id.
Dtk_mesh_asm_node::set_color
void set_color(Dtk_RGB &inColor)
set color on Dtk_mesh_asm_node
cgrw_EndWrite
int cgrw_EndWrite()
Free the Cgr Writer
Dtk_mesh_asm_node::get_instance
Dtk_mesh_instance * get_instance(int i)
Return the i-th instance.
WriteOptions::~WriteOptions
~WriteOptions()
Destructor.
Definition: cgrw.hpp:90
util_mesh_dtk.hpp
Dtk_mesh_asm_node::id
int id
Definition: cgrw.hpp:23
SetCfgCgrWriteMaterial
void SetCfgCgrWriteMaterial(const Dtk_bool &inVal)
write material
Dtk_mesh_asm_node::phys_mat
Dtk_PhysicalMaterialInfosPtr phys_mat
Definition: cgrw.hpp:28
util_ent_dtk.hpp
cgrw_WriteMeshAsm
Dtk_status cgrw_WriteMeshAsm(Dtk_mesh_asm_node *inRoot)
Write a mesh assembly.
cgrw_InitWrite
int cgrw_InitWrite(Dtk_string inFileWritten, Dtk_string inLogFile, Licence_dtk inLicFct, Dtk_string inLicenceFile, const WriteOptions &inOptions=WriteOptions())
Initialize the Cgr Writer
Dtk_mesh_asm_node::get_color
Dtk_RGB get_color()
get color on Dtk_mesh_asm_node
Dtk_SmartPtr< Dtk_material >
WriteOptions::GetFileRelease
Dtk_UInt32 GetFileRelease() const
Retrieve the Written file release.
Definition: cgrw.hpp:107
Dtk_mesh_asm_node::get_nb_instances
Dtk_Size_t get_nb_instances()
Return the nb of instances in the current node.
Dtk_UChar8
unsigned char Dtk_UChar8
Definition: define.h:690
Dtk_mesh_asm_node::cgrw_ComputeBBs
Dtk_status cgrw_ComputeBBs()
Compute Bounding Boxes.
Dtk_mesh_asm_node::add_mesh
int add_mesh(Dtk_MeshPtr mesh)
Add an Dtk_mesh in Dtk_mesh_asm_node in the current asm node.
Dtk_mesh_asm_node::get_render_infos
Dtk_RenderInfosPtr get_render_infos()
Get an material.
util_stl_dtk.hpp
util_ptr_dtk.hpp
Dtk_tab< Dtk_mesh_instance * >
WriteOptions
This class provides several options to tunes cgr Writter. It must be provided to cgr::cgrw_InitWrite ...
Definition: cgrw.hpp:82
Dtk_mesh_asm_node::get_material
Dtk_MaterialPtr get_material()
Get an material.
Dtk_mesh_asm_node::inst
Dtk_tab< Dtk_mesh_instance * > inst
Definition: cgrw.hpp:24
Dtk_mesh_asm_node::~Dtk_mesh_asm_node
~Dtk_mesh_asm_node()
Default destructor.
Dtk_mesh_asm_node::material
Dtk_MaterialPtr material
Definition: cgrw.hpp:26
Dtk_mesh_asm_node::set_render_infos
void set_render_infos(Dtk_RenderInfosPtr inRender)
Set an render.
dtk_rgb.hpp
Dtk_RGB
Definition: dtk_rgb.hpp:7
Dtk_mesh_asm_node::BB
Dtk_bounding_box BB
Used to store global computed bounding box.
Definition: cgrw.hpp:33
WriteOptions::SetFileRelease
void SetFileRelease(const Dtk_UInt32 inRelease)
Sets the release for the written files.
Definition: cgrw.hpp:95
Licence_dtk
char *(* Licence_dtk)(char *)
Definition: str_def.h:71
Dtk_mesh_asm_node::add_asm_instance
int add_asm_instance(Dtk_mesh_asm_node *inMeshAsm, Dtk_transfo *inTransfo)
Add an asm instance to the current asm node.