DATAKIT SDK  V2026.4
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
45  int add_asm_instance(Dtk_mesh_asm_node* inMeshAsm, Dtk_transfo* inTransfo);
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 
53  //! \brief Set an material
54  //! \deprecated use set_render_infos instead
55  SetAsDeprecated( "2026.4", "Use set_render_infos instead." )
56  void set_material(Dtk_MaterialPtr inMaterial);
57 
58  //! \brief Set an render
60 
61  //! \brief Get an Id
62  int get_id();
63 
64  //! \brief Get an material
65  //! \deprecated use get_render_infos instead
66  SetAsDeprecated( "2026.4", "Use get_render_infos instead." )
67  Dtk_MaterialPtr get_material();
68 
69  //! \brief Get an material
71 
72  //! \brief Compute Bounding Boxes
73  //! \deprecated use ComputeBBs instead
74  SetAsDeprecated( "2026.4", "Use ComputeBBs instead." )
75  Dtk_status cgrw_ComputeBBs();
76 
77  //! \brief Compute Bounding Boxes
79 
80  //! \brief set color on Dtk_mesh_asm_node
81  void set_color(Dtk_RGB& inColor);
82 
83  //! \brief get color on Dtk_mesh_asm_node
85  };
86 
87 
88  //! \class WriteOptions
89  //! \brief This class provides several options to tunes cgr Writter.\n
90  //! It must be provided to cgr::cgrw_InitWrite method.
91  //! \code
92  //! //...
93  //! \endcode
95  {
96  protected:
98  public:
99  //! \BaseConstructor
100  WriteOptions() :_FileRelease(14) {}
101 
102  //! \BaseDestructor
104 
105  //! \brief Sets the release for the written files.
106  //! \brief the valid versions are 14 and 19.
107  //! \param [in] inRelease : The file release.
108  inline void SetFileRelease(const Dtk_UInt32 inRelease)
109  {
110  switch (inRelease)
111  {
112  case 19:
113  _FileRelease = (Dtk_UChar8)inRelease; return;
114  case 14:
115  default:
116  _FileRelease = 14; return;
117  }
118  }
119  //! \brief Retrieve the Written file release.
120  inline Dtk_UInt32 GetFileRelease() const { return _FileRelease; }
121  };
122 
123  //! \ingroup cgrw_utils
124  //! \brief Initialize the Cgr Writer
125  //! \return DTK_NOERROR if it is ok DTK_ISERROR else.
126  //! \remark This is the first function called for the writer.
127  //! \param [in] inFileWritten : File to write
128  //! \param [in] inLogFile : Log file
129  //! \param [in] inLicFct : Licence fuction or Null
130  //! \param [in] inLicFile : Datakit Licence file or Null
131  //! \param [in] inOptions : Options (release,...)
132  int cgrw_InitWrite(Dtk_string inFileWritten, Dtk_string inLogFile, Licence_dtk inLicFct, Dtk_string inLicenceFile, const WriteOptions & inOptions = WriteOptions());
133 
134  //! \ingroup cgrw_utils
135  //! \brief Write a mesh assembly
136  //! \return DTK_NOERROR if it is ok DTK_ISERROR else.
137  //! \deprecated use cgrw_WriteMeshAsmNode instead
138  SetAsDeprecated( "2026.4", "Use cgrw_WriteMeshAsmNode instead." )
139  Dtk_status cgrw_WriteMeshAsm(Dtk_mesh_asm_node * inRoot);
140 
141  //! \ingroup cgrw_utils
142  //! \brief Write a mesh assembly
143  //! \return dtkNoError if it is ok, dtkError else.
145 
146  //! \ingroup cgrw_utils
147  //! \brief Free the Cgr Writer
148  //! \return DTK_NOERROR if it is ok DTK_ISERROR else.
149  //! \remark used at the last function used for the writer.
151  //! \ingroup cgrw_utils
152  //! \brief write material
153  //! \param [bool] inVal
154  //!
155  //! SetCfgCgrWriteMaterial(const Dtk_bool &inVal);
156  //! \endcode
157  void SetCfgCgrWriteMaterial(const Dtk_bool &inVal);
158 
159 #endif
160 
161 
WriteOptions::_FileRelease
Dtk_UChar8 _FileRelease
Definition: cgrw.hpp:97
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_id
void set_id(int inId)
Set an Id.
WriteOptions::WriteOptions
WriteOptions()
Default constructor.
Definition: cgrw.hpp:100
Dtk_mesh_asm_node::Dtk_mesh_asm_node
Dtk_mesh_asm_node()
Default constructor.
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:687
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:711
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:724
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:103
Dtk_mesh_asm_node::SetAsDeprecated
SetAsDeprecated("2026.4", "Use set_render_infos instead.") void set_material(Dtk_MaterialPtr inMaterial)
Set an material.
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
Dtk_mesh_asm_node::ComputeBBs
Dtk_ErrorStatus ComputeBBs()
Compute Bounding Boxes.
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_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
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:120
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:697
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.
cgrw_WriteMeshAsmNode
Dtk_ErrorStatus cgrw_WriteMeshAsmNode(Dtk_mesh_asm_node *inRoot)
Write a mesh assembly.
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:95
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:8
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:108
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.