00001 #ifndef __CONTOUR_WORKSPACE__ 00002 #define __CONTOUR_WORKSPACE__ 00003 00004 00005 //------------------------------------------------------------------------------------------------------------ 00006 // Includes 00007 //------------------------------------------------------------------------------------------------------------ 00008 00009 #include <iostream> 00010 #include <vector> 00011 #include "ICommandsUser.h" 00012 #include "OutlineModelManager.h" 00013 #include "OutlineGroup.h" 00014 #include "CommandObject.h" 00015 #include "CommandsHandler.h" 00016 #include "ICommandsUser.h" 00017 00018 class OutlineModelManager; 00019 class CommandsHandler; 00020 00021 class ContourWorkspace : public ICommandsUser{ 00022 00023 //------------------------------------------------------------------------------------------------------------ 00024 // Constructors & Destructors 00025 //------------------------------------------------------------------------------------------------------------ 00026 public: 00027 00028 /* 00029 * Constructs the workspace with the corresponding given parent 00030 * @param parent Is the parent relation with 00031 * @return Returns a pointer to the created ContourWorkspace 00032 */ 00033 ContourWorkspace (OutlineModelManager * parent); 00034 00035 /* 00036 * Destroys the ContourWorkspace 00037 */ 00038 ~ ContourWorkspace(); 00039 00040 //------------------------------------------------------------------------------------------------------------ 00041 // Implamented methods from ICommandsUser.h 00042 //------------------------------------------------------------------------------------------------------------ 00043 00044 /* 00045 * Executes a command by resending the received parameters to its parent to do the appropiate interpretation and execution. 00046 * @param theCommand Is the command to execute 00047 * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false. 00048 */ 00049 virtual bool executeCommand(CommandObject * theCommand, bool fromRegistration=false); 00050 00051 /* 00052 * Executes a command queue by resending the received parameters to its parent to do the appropiate interpretation and execution. 00053 * @param executionQueue Is the command queue to execute 00054 * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false. 00055 */ 00056 virtual bool executeCommandsQueue(std::deque<CommandObject *> & executionQueue, bool fromRegistration); 00057 00058 //------------------------------------------------------------------------------------------------------------ 00059 // Methods 00060 //------------------------------------------------------------------------------------------------------------ 00061 00065 void spreadInDepth(); 00066 00067 /* 00068 * Sets the working group id and pointer 00069 * @param theWorkingGroupKey Is the correspondig key (id) of the working group 00070 * @param theGroup Is the correspondig group to work with 00071 */ 00072 void setWorkingGroup( int theWorkingGroupKey , OutlineGroup * theGroup); 00073 00074 /* 00075 * Gets the working group key 00076 * @return theGroupKey Is the correspondig key (id) of the working group 00077 */ 00078 int getWorkingGroupKey( ); 00079 00080 /* 00081 * Calls the execution for UNION of the given outlines 00082 * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate 00083 */ 00084 void callOutline_Union_Of( std::vector<std::string> outlinesNamesToCall ); 00085 00086 /* 00087 * Calls the execution for INTERSECTION of the given outlines 00088 * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate 00089 */ 00090 void callOutline_Intersection_Of( std::vector<std::string> outlinesNamesToCall ); 00091 00092 /* 00093 * Calls the execution for COMBINATION of the given outlines 00094 * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate 00095 */ 00096 void callOutline_Combination_Of( std::vector<std::string> outlinesNamesToCall ); 00097 00098 /* 00099 * Calls the execution for FRAGMENTATION of the given outlines 00100 * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate 00101 */ 00102 void callOutline_Fragmentation_Of( std::vector<std::string> outlinesNamesToCall ); 00103 00104 /* 00105 * Calls the execution for AGRUPATION of the given outlines 00106 * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate 00107 */ 00108 void callOutline_Agrupation_Of( std::vector<std::string> outlinesNamesToCall ); 00109 00110 /* 00111 * Calls to redo a the actual REDO command. 00112 * @return Returns true if the actual command to execute has been executed. 00113 */ 00114 bool callREDO(); 00115 00116 /* 00117 * Calls to undo the actual UNDO command. 00118 * @return Returns true if the inverse command is executed. 00119 */ 00120 bool callUNDO(); 00121 00122 /* 00123 * Calls the registration of the given commands (do, undo) in the commands handler 00124 * If is the first registered command notifies the posibleUNDO avaliability. 00125 * @param doCommand Is the command to register in the redo_commands vector. 00126 * @param unDoCommand Is the command to register in the unDo_commands vector. 00127 */ 00128 void callRegisterCommand(CommandObject * doCommand, CommandObject * unDoCommand); 00129 00130 /* 00131 * Gets the command handler 00132 */ 00133 CommandsHandler * getCommandHandler(); 00134 00135 void setCommandHandler(CommandsHandler * aCommHandler); 00136 00137 //------------------------------------------------------------------------------------------------------------ 00138 // Constants 00139 //------------------------------------------------------------------------------------------------------------ 00140 00141 private: 00142 //------------------------------------------------------------------------------------------------------------ 00143 // Attributes 00144 //------------------------------------------------------------------------------------------------------------ 00145 00146 std::vector<std::string> selectedOutlineskNames; 00147 00148 std::string actualOutlinekName; 00149 00150 int workingGroupKey; 00151 00152 OutlineModelManager * theModelBoss; 00153 00154 CommandsHandler * commHandler; 00155 00156 OutlineGroup * actualGroup; 00157 00158 }; 00159 #endif