]> Creatis software - creaContours.git/blob - lib/kernel_ManagerContour_NDimensions/ContourWorkspace.cxx
d79922c9dca8e126f2c0e3615d7a85f7f8f9e6e4
[creaContours.git] / lib / kernel_ManagerContour_NDimensions / ContourWorkspace.cxx
1
2 //----------------------------------------------------------------------------------------------------------------
3 // Class definition include
4 //----------------------------------------------------------------------------------------------------------------
5 #include "ContourWorkspace.h"
6
7 //----------------------------------------------------------------------------------------------------------------
8 // Class implementation
9 //----------------------------------------------------------------------------------------------------------------
10 /** @file ContourWorkspace.cxx */
11
12 //------------------------------------------------------------------------------------------------------------
13 // Constructors & Destructors
14 //------------------------------------------------------------------------------------------------------------
15
16 /*
17         * Constructs the workspace with the corresponding given parent
18         * @param parent Is the parent relation with
19         * @return Returns a pointer to the created ContourWorkspace
20         */
21         ContourWorkspace :: ContourWorkspace (OutlineModelManager * parent)
22         {
23                 theModelBoss = parent;
24                 commHandler = new CommandsHandler(); 
25                 commHandler->setModelBoss(this);
26         }
27
28         /*
29         * Destroys the ContourWorkspace
30         */
31         ContourWorkspace :: ~ ContourWorkspace()
32         {
33
34         }
35
36 //------------------------------------------------------------------------------------------------------------
37 // Methods
38 //------------------------------------------------------------------------------------------------------------
39
40         /*
41         * Executes a command by resending the received parameters to its parent to do the appropiate interpretation and execution.
42         * @param theCommand Is the command to execute
43         * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
44         */
45         bool ContourWorkspace :: executeCommand(CommandObject * theCommand, bool fromRegistration)
46         {
47                 return theModelBoss->executeCommand(theCommand, fromRegistration);
48         }
49
50         /*
51         * Executes a command queue by resending the received parameters to its parent to do the appropiate interpretation and execution.
52         * @param executionQueue Is the command queue to execute
53         * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
54         */
55         bool ContourWorkspace ::  executeCommandsQueue(std::deque<CommandObject *> & executionQueue, bool fromRegistration)
56         {
57                 return theModelBoss->executeCommandsQueue(executionQueue, fromRegistration);
58         }
59
60         /**
61         * Method that propagates an outline over the deep concept of the axe
62         */
63         void ContourWorkspace :: spreadInDepth()
64         {
65                 //Getting the vector of the actual instant
66
67                 //Getting the basic object name and patter to create the spreaded outlines
68
69                 //Variating (i) the depth in the current axe, previously getting the axe size as maxmimum value conditioned by the imageSource deep in the axe direction
70
71                 //Calling the creation of the section or plane and including it in the correspondig enviroment using the outlineManager for that
72
73                 //Creating the (i-th) outline and including it in the correspondig enviroment using the outlineManager for that
74
75                 //Including the (i-th) outline in a new propagation group calling the outlineManager
76                 
77         }
78
79         /*
80         * Sets the working group id and pointer
81         * @param theWorkingGroupKey Is the correspondig key (id) of the working group 
82         * @param theGroup Is the correspondig group to work with
83         */
84         void ContourWorkspace :: setWorkingGroup( int theWorkingGroupKey , OutlineGroup * theGroup)
85         {
86                 workingGroupKey = theWorkingGroupKey;
87                 actualGroup = theGroup;         
88         }
89
90         /*
91         * Gets the working group key
92         * @return theGroupKey Is the correspondig key (id) of the working group 
93         */
94         int ContourWorkspace :: getWorkingGroupKey( )
95         {
96                 return workingGroupKey;
97         }
98
99         /*
100         * Calls the execution for UNION of the given outlines
101         * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
102         */
103         void ContourWorkspace :: callOutline_Union_Of( std::vector<std::string> outlinesNamesToCall )
104         {
105
106         }
107
108         /*
109         * Calls the execution for INTERSECTION of the given outlines
110         * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
111         */
112         void ContourWorkspace :: callOutline_Intersection_Of( std::vector<std::string> outlinesNamesToCall )
113         {
114
115         }
116
117         
118         /*
119         * Calls the execution for COMBINATION of the given outlines
120         * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
121         */
122         void ContourWorkspace :: callOutline_Combination_Of( std::vector<std::string> outlinesNamesToCall )
123         {
124
125         }
126
127
128         /*
129         * Calls the execution for FRAGMENTATION of the given outlines
130         * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
131         */
132         void ContourWorkspace :: callOutline_Fragmentation_Of( std::vector<std::string> outlinesNamesToCall )
133         {
134
135         }
136
137         /*
138         * Calls the execution for AGRUPATION of the given outlines
139         * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
140         */
141         void ContourWorkspace :: callOutline_Agrupation_Of( std::vector<std::string> outlinesNamesToCall )
142         {
143
144         }
145
146         /*
147         * Calls to redo a the actual REDO command. 
148         * @return Returns true if the actual command to execute has been executed. 
149         */
150         bool ContourWorkspace :: callREDO()
151         {
152                 return commHandler->redo();
153         }
154
155         /*
156         * Calls to undo the actual UNDO command. 
157         * @return Returns true if the inverse command is executed. 
158         */
159         bool ContourWorkspace :: callUNDO()
160         {
161                 return commHandler->undo();
162         }
163
164         /*
165         * Calls the registration of the given commands (do, undo) in the commands handler
166         * If is the first registered command notifies the posibleUNDO avaliability.
167         * @param doCommand Is the command to register in the redo_commands vector.
168         * @param unDoCommand Is the command to register in the unDo_commands vector.
169         */
170         void ContourWorkspace :: callRegisterCommand(CommandObject * doCommand, CommandObject * unDoCommand)
171         {
172                 commHandler->registerCommand( doCommand, unDoCommand );
173         }
174
175         /*
176         * Gets the command handler
177         */
178         CommandsHandler * ContourWorkspace :: getCommandHandler()
179         {
180                 return commHandler;
181         }
182
183         void ContourWorkspace :: setCommandHandler(CommandsHandler * aCommHandler)
184         {
185                 commHandler = aCommHandler;
186         }