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 # ------------------------------------------------------------------------ */
26 #ifndef __CONTOUR_WORKSPACE__
27 #define __CONTOUR_WORKSPACE__
30 //------------------------------------------------------------------------------------------------------------
32 //------------------------------------------------------------------------------------------------------------
36 #include "ICommandsUser.h"
37 #include "OutlineModelManager.h"
38 #include "OutlineGroup.h"
39 #include "CommandObject.h"
40 #include "CommandsHandler.h"
41 #include "ICommandsUser.h"
43 class OutlineModelManager;
44 class CommandsHandler;
46 class ContourWorkspace : public ICommandsUser{
48 //------------------------------------------------------------------------------------------------------------
49 // Constructors & Destructors
50 //------------------------------------------------------------------------------------------------------------
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
58 ContourWorkspace (OutlineModelManager * parent);
61 * Destroys the ContourWorkspace
65 //------------------------------------------------------------------------------------------------------------
66 // Implamented methods from ICommandsUser.h
67 //------------------------------------------------------------------------------------------------------------
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.
74 virtual bool executeCommand(CommandObject * theCommand, bool fromRegistration=false);
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.
81 virtual bool executeCommandsQueue(std::deque<CommandObject *> & executionQueue, bool fromRegistration);
83 //------------------------------------------------------------------------------------------------------------
85 //------------------------------------------------------------------------------------------------------------
88 * Method that propagates an outline over the deep concept of the axe
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
97 void setWorkingGroup( int theWorkingGroupKey , OutlineGroup * theGroup);
100 * Gets the working group key
101 * @return theGroupKey Is the correspondig key (id) of the working group
103 int getWorkingGroupKey( );
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
109 void callOutline_Union_Of( std::vector<std::string> outlinesNamesToCall );
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
115 void callOutline_Intersection_Of( std::vector<std::string> outlinesNamesToCall );
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
121 void callOutline_Combination_Of( std::vector<std::string> outlinesNamesToCall );
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
127 void callOutline_Fragmentation_Of( std::vector<std::string> outlinesNamesToCall );
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
133 void callOutline_Agrupation_Of( std::vector<std::string> outlinesNamesToCall );
136 * Calls to redo a the actual REDO command.
137 * @return Returns true if the actual command to execute has been executed.
142 * Calls to undo the actual UNDO command.
143 * @return Returns true if the inverse command is executed.
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.
153 void callRegisterCommand(CommandObject * doCommand, CommandObject * unDoCommand);
156 * Gets the command handler
158 CommandsHandler * getCommandHandler();
160 void setCommandHandler(CommandsHandler * aCommHandler);
162 //------------------------------------------------------------------------------------------------------------
164 //------------------------------------------------------------------------------------------------------------
167 //------------------------------------------------------------------------------------------------------------
169 //------------------------------------------------------------------------------------------------------------
171 std::vector<std::string> selectedOutlineskNames;
173 std::string actualOutlinekName;
177 OutlineModelManager * theModelBoss;
179 CommandsHandler * commHandler;
181 OutlineGroup * actualGroup;