DATAKIT SDK  V2026.2
WriteInstance.cpp File Reference

Functions

Dtk_ErrorStatus WriteInstance (Dtk_ComponentPtr inComponent)
 

Variables

Dtk_tab< Dtk_IDProcessedComponents
 

Function Documentation

◆ WriteInstance()

Dtk_ErrorStatus WriteInstance ( Dtk_ComponentPtr  inComponent)
17 {
18  // Get the prototype name.
19  Dtk_string prototypeName = inComponent->Name();
20 
21  // Get the instance name.
22  Dtk_string instanceName = inComponent->InstanceName();
23 
24  // Get the prototype component (first child of instance) and its transformation matrix.
25  Dtk_ComponentPtr prototype = inComponent->GetChild(0);
26  Dtk_transfo matrix = inComponent->TransformationMatrix();
27 
28  // Get the ID of the prototype component.
29  Dtk_ID childID = prototype->GetID();
30 
31  // Initialize PDF instance ID.
32  Dtk_ID pdfInstanceID = 0;
33 
34  // Initialize PDF output for the instance if PDF export is enabled.
35  if (IsPdfDumpActivated())
36  {
37  pdfInstanceID = PdfInitInstance(inComponent);
38  }
39 
40  // Write the prototype component.
41  // Note: The transformation matrix can be passed if needed for further processing.
42  WriteComponent(prototype, Dtk_transfo());
43 
44  // Finalize PDF output for the instance if PDF export is enabled.
45  if (IsPdfDumpActivated())
46  {
47  PdfEndInstance(pdfInstanceID, childID);
48  }
49 
50  // Track the processed component by its ID to avoid redundant processing.
51  if (ProcessedComponents.find(childID) < 0)
52  {
53  ProcessedComponents.push_back(childID);
54  }
55 
56  return dtkNoError;
57 }

Variable Documentation

◆ ProcessedComponents

Dtk_tab<Dtk_ID> ProcessedComponents
extern
Dtk_ID
uint32_t Dtk_ID
Definition: define.h:681
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
PdfEndInstance
void PdfEndInstance(Dtk_ID pdfInstID, Dtk_ID childID)
Definition: PdfWrite.cpp:111
WriteComponent
Dtk_ErrorStatus WriteComponent(Dtk_ComponentPtr inComponent, const Dtk_transfo &inMatrix=Dtk_transfo())
Definition: WriteComponent.cpp:12
ProcessedComponents
Dtk_tab< Dtk_ID > ProcessedComponents
Definition: WritePrototype.cpp:16
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
PdfInitInstance
Dtk_ID PdfInitInstance(Dtk_ComponentPtr inComponent)
Definition: PdfWrite.cpp:93
dtkNoError
@ dtkNoError
Definition: error_dtk.hpp:149
IsPdfDumpActivated
Dtk_bool IsPdfDumpActivated()
Definition: PdfWrite.cpp:29