]> Creatis software - creaContours.git/blob - lib/kernel_ManagerContour_NDimensions/ContourWorkspace.h
54aa84af6218bfb6daf6cb5a8baa24464978273d
[creaContours.git] / lib / kernel_ManagerContour_NDimensions / ContourWorkspace.h
1 #ifndef __CONTOUR_WORKSPACE__
2 #define __CONTOUR_WORKSPACE__
3
4
5 //------------------------------------------------------------------------------------------------------------
6 // Includes
7 //------------------------------------------------------------------------------------------------------------
8
9 #include <iostream>
10 #include <vector>
11 #include  "ICommandsUser.h"
12 #include  "OutlineModelManager.h"
13 #include  "OutlineGroup.h"
14 #include  "CommandObject.h"
15 #include  "CommandsHandler.h"
16 #include  "ICommandsUser.h"
17
18 class OutlineModelManager;
19 class CommandsHandler; 
20
21 class ContourWorkspace : public ICommandsUser{
22
23 //------------------------------------------------------------------------------------------------------------
24 // Constructors & Destructors
25 //------------------------------------------------------------------------------------------------------------
26 public:
27
28         /*
29         * Constructs the workspace with the corresponding given parent
30         * @param parent Is the parent relation with
31         * @return Returns a pointer to the created ContourWorkspace
32         */
33         ContourWorkspace (OutlineModelManager * parent);
34
35         /*
36         * Destroys the ContourWorkspace
37         */
38         ~ ContourWorkspace();
39
40 //------------------------------------------------------------------------------------------------------------
41 // Implamented methods from ICommandsUser.h
42 //------------------------------------------------------------------------------------------------------------
43
44         /*
45         * Executes a command by resending the received parameters to its parent to do the appropiate interpretation and execution.
46         * @param theCommand Is the command to execute
47         * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
48         */
49         virtual bool executeCommand(CommandObject * theCommand, bool fromRegistration=false);
50         
51         /*
52         * Executes a command queue by resending the received parameters to its parent to do the appropiate interpretation and execution.
53         * @param executionQueue Is the command queue to execute
54         * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
55         */
56         virtual bool executeCommandsQueue(std::deque<CommandObject *> & executionQueue, bool fromRegistration);
57
58 //------------------------------------------------------------------------------------------------------------
59 // Methods
60 //------------------------------------------------------------------------------------------------------------
61
62         /**
63         * Method that propagates an outline over the deep concept of the axe
64         */
65         void spreadInDepth();
66
67         /*
68         * Sets the working group id and pointer
69         * @param theWorkingGroupKey Is the correspondig key (id) of the working group 
70         * @param theGroup Is the correspondig group to work with
71         */
72         void setWorkingGroup( int theWorkingGroupKey , OutlineGroup * theGroup);
73
74         /*
75         * Gets the working group key
76         * @return theGroupKey Is the correspondig key (id) of the working group 
77         */
78         int getWorkingGroupKey( );
79
80         /*
81         * Calls the execution for UNION of the given outlines
82         * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
83         */
84         void callOutline_Union_Of( std::vector<std::string> outlinesNamesToCall );
85
86         /*
87         * Calls the execution for INTERSECTION of the given outlines
88         * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
89         */
90         void callOutline_Intersection_Of( std::vector<std::string> outlinesNamesToCall );
91         
92         /*
93         * Calls the execution for COMBINATION of the given outlines
94         * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
95         */
96         void callOutline_Combination_Of( std::vector<std::string> outlinesNamesToCall );
97
98         /*
99         * Calls the execution for FRAGMENTATION of the given outlines
100         * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
101         */
102         void callOutline_Fragmentation_Of( std::vector<std::string> outlinesNamesToCall );
103         
104         /*
105         * Calls the execution for AGRUPATION of the given outlines
106         * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
107         */
108         void callOutline_Agrupation_Of( std::vector<std::string> outlinesNamesToCall );
109
110         /*
111         * Calls to redo a the actual REDO command. 
112         * @return Returns true if the actual command to execute has been executed. 
113         */
114         bool callREDO();
115
116         /*
117         * Calls to undo the actual UNDO command. 
118         * @return Returns true if the inverse command is executed. 
119         */
120         bool callUNDO();
121         
122         /*
123         * Calls the registration of the given commands (do, undo) in the commands handler
124         * If is the first registered command notifies the posibleUNDO avaliability.
125         * @param doCommand Is the command to register in the redo_commands vector.
126         * @param unDoCommand Is the command to register in the unDo_commands vector.
127         */
128         void callRegisterCommand(CommandObject * doCommand, CommandObject * unDoCommand);
129
130         /*
131         * Gets the command handler
132         */
133         CommandsHandler * getCommandHandler();
134
135         void setCommandHandler(CommandsHandler * aCommHandler);
136
137 //------------------------------------------------------------------------------------------------------------
138 // Constants
139 //------------------------------------------------------------------------------------------------------------
140
141 private:        
142 //------------------------------------------------------------------------------------------------------------
143 // Attributes
144 //------------------------------------------------------------------------------------------------------------
145
146         std::vector<std::string> selectedOutlineskNames;
147
148         std::string actualOutlinekName;
149
150         int workingGroupKey;
151
152         OutlineModelManager * theModelBoss;
153         
154         CommandsHandler * commHandler;
155
156         OutlineGroup * actualGroup;
157
158 };
159 #endif