]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager.cxx
#3507 Undo and Redo Meshes
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkMeshManager.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbcreaVtkMeshManager.h"
5 #include "bbcreaVtkPackage.h"
6 namespace bbcreaVtk
7 {
8
9 MeshManagerModel_Box::MeshManagerModel_Box( MeshManager *box )
10 {
11     mBox=box;
12 }
13
14 MeshManagerModel_Box::~MeshManagerModel_Box( )
15 {
16 }
17
18 void MeshManagerModel_Box::RefreshOutputs(bool signalBox)
19 {
20     mBox->bbSetOutputMeshBase( GetMeshBase() );
21     mBox->bbSetOutputMeshTemp( GetMeshTemp() );
22     mBox->bbSetOutputMeshNames( GetMeshNames() );
23     mBox->bbSetOutputAllPolyDatas( GetAllPolyDatas() );
24     mBox->bbSetOutputMeshSelection( GetCurrentMesh() );
25     if(signalBox==true){
26                 mBox->bbSignalOutputModification();
27     }
28 }
29
30
31 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MeshManager)
32 BBTK_BLACK_BOX_IMPLEMENTATION(MeshManager,bbtk::AtomicBlackBox);
33 //===== 
34 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
35 //===== 
36 void MeshManager::Process()
37 {
38 // THE MAIN PROCESSING METHOD BODY
39 //   Here we simply set the input 'In' value to the output 'Out'
40 //   And print out the output value
41 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
42 //    void bbSet{Input|Output}NAME(const TYPE&)
43 //    const TYPE& bbGet{Input|Output}NAME() const 
44 //    Where :
45 //    * NAME is the name of the input/output
46 //      (the one provided in the attribute 'name' of the tag 'input')
47 //    * TYPE is the C++ type of the input/output
48 //      (the one provided in the attribute 'type' of the tag 'input')
49 //    bbSetOutputOut( bbGetInputIn() );
50 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
51     
52     if (meshManagerModel_Box==NULL)
53     {
54         meshManagerModel_Box = new MeshManagerModel_Box(this);
55
56                 if(bbGetInputMemoryMode() == false){
57                         meshManagerModel_Box->MeshMemoryModeOff();
58                         meshManagerModel_Box->AddMeshes_( bbGetInputMeshVector() );
59                         meshManagerModel_Box->AddMesh_( bbGetInputMesh() );
60                         meshManagerModel_Box->ResetHistory();
61                 }
62                 else{
63                         meshManagerModel_Box->MeshMemoryModeOn();
64                         meshManagerModel_Box->SetHistory(50);
65                         meshManagerModel_Box->AddMesh_( bbGetInputMesh() );
66                         meshManagerModel_Box->SaveMemoryMode();
67                 }
68                 
69         //meshManagerModel_Box->SetMeshBase( bbGetInputMesh() );
70         meshManagerModel_Box->RefreshOutputs(false);
71         bbSetOutputMeshManagerModel( meshManagerModel_Box );
72     } // if meshManagerModel_Box
73 }
74
75 //===== 
76 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
77 //===== 
78 void MeshManager::bbUserSetDefaultValues()
79 {
80 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
81 //    Here we initialize the input 'In' to 0
82 //   bbSetInputIn(0);
83     meshManagerModel_Box = NULL;
84     bbSetInputMesh(NULL);
85 }
86
87 //===== 
88 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
89 //===== 
90 void MeshManager::bbUserInitializeProcessing()
91 {
92 //  THE INITIALIZATION METHOD BODY :
93 //    Here does nothing 
94 //    but this is where you should allocate the internal/output pointers 
95 //    if any
96 }
97
98 //===== 
99 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
100 //===== 
101 void MeshManager::bbUserFinalizeProcessing()
102 {
103 //  THE FINALIZATION METHOD BODY :
104 //    Here does nothing 
105 //    but this is where you should desallocate the internal/output pointers 
106 //    if any
107 }
108
109 } // EO namespace bbcreaVtk
110
111