2 //----------------------------------------------------------------------------------------------------------------
3 // Class definition include
4 //----------------------------------------------------------------------------------------------------------------
5 #include "ContourWorkspace.h"
7 //----------------------------------------------------------------------------------------------------------------
8 // Class implementation
9 //----------------------------------------------------------------------------------------------------------------
10 /** @file ContourWorkspace.cxx */
12 //------------------------------------------------------------------------------------------------------------
13 // Constructors & Destructors
14 //------------------------------------------------------------------------------------------------------------
17 * Constructs the workspace with the corresponding given parent
18 * @param parent Is the parent relation with
19 * @return Returns a pointer to the created ContourWorkspace
21 ContourWorkspace :: ContourWorkspace (OutlineModelManager * parent)
23 theModelBoss = parent;
24 commHandler = new CommandsHandler();
25 commHandler->setModelBoss(this);
29 * Destroys the ContourWorkspace
31 ContourWorkspace :: ~ ContourWorkspace()
36 //------------------------------------------------------------------------------------------------------------
38 //------------------------------------------------------------------------------------------------------------
41 * Executes a command by resending the received parameters to its parent to do the appropiate interpretation and execution.
42 * @param theCommand Is the command to execute
43 * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
45 bool ContourWorkspace :: executeCommand(CommandObject * theCommand, bool fromRegistration)
47 return theModelBoss->executeCommand(theCommand, fromRegistration);
51 * Executes a command queue by resending the received parameters to its parent to do the appropiate interpretation and execution.
52 * @param executionQueue Is the command queue to execute
53 * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
55 bool ContourWorkspace :: executeCommandsQueue(std::deque<CommandObject *> & executionQueue, bool fromRegistration)
57 return theModelBoss->executeCommandsQueue(executionQueue, fromRegistration);
61 * Method that propagates an outline over the deep concept of the axe
63 void ContourWorkspace :: spreadInDepth()
65 //Getting the vector of the actual instant
67 //Getting the basic object name and patter to create the spreaded outlines
69 //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
71 //Calling the creation of the section or plane and including it in the correspondig enviroment using the outlineManager for that
73 //Creating the (i-th) outline and including it in the correspondig enviroment using the outlineManager for that
75 //Including the (i-th) outline in a new propagation group calling the outlineManager
80 * Sets the working group id and pointer
81 * @param theWorkingGroupKey Is the correspondig key (id) of the working group
82 * @param theGroup Is the correspondig group to work with
84 void ContourWorkspace :: setWorkingGroup( int theWorkingGroupKey , OutlineGroup * theGroup)
86 workingGroupKey = theWorkingGroupKey;
87 actualGroup = theGroup;
91 * Gets the working group key
92 * @return theGroupKey Is the correspondig key (id) of the working group
94 int ContourWorkspace :: getWorkingGroupKey( )
96 return workingGroupKey;
100 * Calls the execution for UNION of the given outlines
101 * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
103 void ContourWorkspace :: callOutline_Union_Of( std::vector<std::string> outlinesNamesToCall )
109 * Calls the execution for INTERSECTION of the given outlines
110 * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
112 void ContourWorkspace :: callOutline_Intersection_Of( std::vector<std::string> outlinesNamesToCall )
119 * Calls the execution for COMBINATION of the given outlines
120 * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
122 void ContourWorkspace :: callOutline_Combination_Of( std::vector<std::string> outlinesNamesToCall )
129 * Calls the execution for FRAGMENTATION of the given outlines
130 * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
132 void ContourWorkspace :: callOutline_Fragmentation_Of( std::vector<std::string> outlinesNamesToCall )
138 * Calls the execution for AGRUPATION of the given outlines
139 * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
141 void ContourWorkspace :: callOutline_Agrupation_Of( std::vector<std::string> outlinesNamesToCall )
147 * Calls to redo a the actual REDO command.
148 * @return Returns true if the actual command to execute has been executed.
150 bool ContourWorkspace :: callREDO()
152 return commHandler->redo();
156 * Calls to undo the actual UNDO command.
157 * @return Returns true if the inverse command is executed.
159 bool ContourWorkspace :: callUNDO()
161 return commHandler->undo();
165 * Calls the registration of the given commands (do, undo) in the commands handler
166 * If is the first registered command notifies the posibleUNDO avaliability.
167 * @param doCommand Is the command to register in the redo_commands vector.
168 * @param unDoCommand Is the command to register in the unDo_commands vector.
170 void ContourWorkspace :: callRegisterCommand(CommandObject * doCommand, CommandObject * unDoCommand)
172 commHandler->registerCommand( doCommand, unDoCommand );
176 * Gets the command handler
178 CommandsHandler * ContourWorkspace :: getCommandHandler()
183 void ContourWorkspace :: setCommandHandler(CommandsHandler * aCommHandler)
185 commHandler = aCommHandler;