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