1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
27 //----------------------------------------------------------------------------------------------------------------
28 // Class definition include
29 //----------------------------------------------------------------------------------------------------------------
30 #include "ContourWorkspace.h"
32 //----------------------------------------------------------------------------------------------------------------
33 // Class implementation
34 //----------------------------------------------------------------------------------------------------------------
35 /** @file ContourWorkspace.cxx */
37 //------------------------------------------------------------------------------------------------------------
38 // Constructors & Destructors
39 //------------------------------------------------------------------------------------------------------------
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
46 ContourWorkspace :: ContourWorkspace (OutlineModelManager * parent)
48 theModelBoss = parent;
49 commHandler = new CommandsHandler();
50 commHandler->setModelBoss(this);
54 * Destroys the ContourWorkspace
56 ContourWorkspace :: ~ ContourWorkspace()
61 //------------------------------------------------------------------------------------------------------------
63 //------------------------------------------------------------------------------------------------------------
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.
70 bool ContourWorkspace :: executeCommand(CommandObject * theCommand, bool fromRegistration)
72 return theModelBoss->executeCommand(theCommand, fromRegistration);
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.
80 bool ContourWorkspace :: executeCommandsQueue(std::deque<CommandObject *> & executionQueue, bool fromRegistration)
82 return theModelBoss->executeCommandsQueue(executionQueue, fromRegistration);
86 * Method that propagates an outline over the deep concept of the axe
88 void ContourWorkspace :: spreadInDepth()
90 //Getting the vector of the actual instant
92 //Getting the basic object name and patter to create the spreaded outlines
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
96 //Calling the creation of the section or plane and including it in the correspondig enviroment using the outlineManager for that
98 //Creating the (i-th) outline and including it in the correspondig enviroment using the outlineManager for that
100 //Including the (i-th) outline in a new propagation group calling the outlineManager
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
109 void ContourWorkspace :: setWorkingGroup( int theWorkingGroupKey , OutlineGroup * theGroup)
111 workingGroupKey = theWorkingGroupKey;
112 actualGroup = theGroup;
116 * Gets the working group key
117 * @return theGroupKey Is the correspondig key (id) of the working group
119 int ContourWorkspace :: getWorkingGroupKey( )
121 return workingGroupKey;
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
128 void ContourWorkspace :: callOutline_Union_Of( std::vector<std::string> outlinesNamesToCall )
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
137 void ContourWorkspace :: callOutline_Intersection_Of( std::vector<std::string> outlinesNamesToCall )
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
147 void ContourWorkspace :: callOutline_Combination_Of( std::vector<std::string> outlinesNamesToCall )
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
157 void ContourWorkspace :: callOutline_Fragmentation_Of( std::vector<std::string> outlinesNamesToCall )
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
166 void ContourWorkspace :: callOutline_Agrupation_Of( std::vector<std::string> outlinesNamesToCall )
172 * Calls to redo a the actual REDO command.
173 * @return Returns true if the actual command to execute has been executed.
175 bool ContourWorkspace :: callREDO()
177 return commHandler->redo();
181 * Calls to undo the actual UNDO command.
182 * @return Returns true if the inverse command is executed.
184 bool ContourWorkspace :: callUNDO()
186 return commHandler->undo();
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.
195 void ContourWorkspace :: callRegisterCommand(CommandObject * doCommand, CommandObject * unDoCommand)
197 commHandler->registerCommand( doCommand, unDoCommand );
201 * Gets the command handler
203 CommandsHandler * ContourWorkspace :: getCommandHandler()
208 void ContourWorkspace :: setCommandHandler(CommandsHandler * aCommHandler)
210 commHandler = aCommHandler;