creaContours_lib
ContourWorkspace.h
Go to the documentation of this file.
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 # pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
15 #
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
20 # liability.
21 #
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25 
26 #ifndef __CONTOUR_WORKSPACE__
27 #define __CONTOUR_WORKSPACE__
28 
29 
30 //------------------------------------------------------------------------------------------------------------
31 // Includes
32 //------------------------------------------------------------------------------------------------------------
33 
34 #include <iostream>
35 #include <vector>
36 #include "ICommandsUser.h"
37 #include "OutlineModelManager.h"
38 #include "OutlineGroup.h"
39 #include "CommandObject.h"
40 #include "CommandsHandler.h"
41 #include "ICommandsUser.h"
42 
44 class CommandsHandler;
45 
47 
48 //------------------------------------------------------------------------------------------------------------
49 // Constructors & Destructors
50 //------------------------------------------------------------------------------------------------------------
51 public:
52 
53  /*
54  * Constructs the workspace with the corresponding given parent
55  * @param parent Is the parent relation with
56  * @return Returns a pointer to the created ContourWorkspace
57  */
59 
60  /*
61  * Destroys the ContourWorkspace
62  */
64 
65 //------------------------------------------------------------------------------------------------------------
66 // Implamented methods from ICommandsUser.h
67 //------------------------------------------------------------------------------------------------------------
68 
69  /*
70  * Executes a command by resending the received parameters to its parent to do the appropiate interpretation and execution.
71  * @param theCommand Is the command to execute
72  * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
73  */
74  virtual bool executeCommand(CommandObject * theCommand, bool fromRegistration=false);
75 
76  /*
77  * Executes a command queue by resending the received parameters to its parent to do the appropiate interpretation and execution.
78  * @param executionQueue Is the command queue to execute
79  * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
80  */
81  virtual bool executeCommandsQueue(std::deque<CommandObject *> & executionQueue, bool fromRegistration);
82 
83 //------------------------------------------------------------------------------------------------------------
84 // Methods
85 //------------------------------------------------------------------------------------------------------------
86 
90  void spreadInDepth();
91 
92  /*
93  * Sets the working group id and pointer
94  * @param theWorkingGroupKey Is the correspondig key (id) of the working group
95  * @param theGroup Is the correspondig group to work with
96  */
97  void setWorkingGroup( int theWorkingGroupKey , OutlineGroup * theGroup);
98 
99  /*
100  * Gets the working group key
101  * @return theGroupKey Is the correspondig key (id) of the working group
102  */
103  int getWorkingGroupKey( );
104 
105  /*
106  * Calls the execution for UNION of the given outlines
107  * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
108  */
109  void callOutline_Union_Of( std::vector<std::string> outlinesNamesToCall );
110 
111  /*
112  * Calls the execution for INTERSECTION of the given outlines
113  * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
114  */
115  void callOutline_Intersection_Of( std::vector<std::string> outlinesNamesToCall );
116 
117  /*
118  * Calls the execution for COMBINATION of the given outlines
119  * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
120  */
121  void callOutline_Combination_Of( std::vector<std::string> outlinesNamesToCall );
122 
123  /*
124  * Calls the execution for FRAGMENTATION of the given outlines
125  * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
126  */
127  void callOutline_Fragmentation_Of( std::vector<std::string> outlinesNamesToCall );
128 
129  /*
130  * Calls the execution for AGRUPATION of the given outlines
131  * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
132  */
133  void callOutline_Agrupation_Of( std::vector<std::string> outlinesNamesToCall );
134 
135  /*
136  * Calls to redo a the actual REDO command.
137  * @return Returns true if the actual command to execute has been executed.
138  */
139  bool callREDO();
140 
141  /*
142  * Calls to undo the actual UNDO command.
143  * @return Returns true if the inverse command is executed.
144  */
145  bool callUNDO();
146 
147  /*
148  * Calls the registration of the given commands (do, undo) in the commands handler
149  * If is the first registered command notifies the posibleUNDO avaliability.
150  * @param doCommand Is the command to register in the redo_commands vector.
151  * @param unDoCommand Is the command to register in the unDo_commands vector.
152  */
153  void callRegisterCommand(CommandObject * doCommand, CommandObject * unDoCommand);
154 
155  /*
156  * Gets the command handler
157  */
159 
160  void setCommandHandler(CommandsHandler * aCommHandler);
161 
162 //------------------------------------------------------------------------------------------------------------
163 // Constants
164 //------------------------------------------------------------------------------------------------------------
165 
166 private:
167 //------------------------------------------------------------------------------------------------------------
168 // Attributes
169 //------------------------------------------------------------------------------------------------------------
170 
171  std::vector<std::string> selectedOutlineskNames;
172 
173  std::string actualOutlinekName;
174 
176 
178 
180 
182 
183 };
184 #endif