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 "OutlineGroup.h"
32 //----------------------------------------------------------------------------------------------------------------
33 // Class implementation
34 //----------------------------------------------------------------------------------------------------------------
35 /** @file OutlineGroup.cxx */
37 //------------------------------------------------------------------------------------------------------------
38 // Constructors & Destructors
39 //------------------------------------------------------------------------------------------------------------
42 * Constructs an outline group with the given name
43 * @param theName Is the name for the group
44 * @param theGroupType Is the type for the group corresponding to one of the constants of this class
46 OutlineGroup :: OutlineGroup(std::string theName, int theGroupType)
49 groupType = theGroupType;
52 if ( groupType == PROPAGATION || groupType == PLANE_SECTION )
55 selectedGroup = false;
58 acceptsRepetedOutlines = false;
60 else if ( groupType == STRIP )
63 selectedGroup = false;
66 acceptsRepetedOutlines = true;
68 else if ( groupType == OVERLAPED )
71 selectedGroup = false;
74 acceptsRepetedOutlines = false;
76 else if ( groupType == MANUAL_GROUP )
82 acceptsRepetedOutlines = true;
87 * Destroyes the outline and its dependencies
89 OutlineGroup :: ~ OutlineGroup()
91 outlines_keyNames.clear();
94 //------------------------------------------------------------------------------------------------------------
96 //------------------------------------------------------------------------------------------------------------
100 * Indicates if a given name of an outline is member of the group or not
101 * @param aKeyName Is the name of an outline to search for
103 bool OutlineGroup :: isMemberOfGroup(std::string aKeyName)
105 for (int a=0; a < outlines_keyNames.size(); a++)
107 if ( outlines_keyNames[a].compare(aKeyName) == 0 )
114 * Removes an outline with the given name from the group
115 * @param theNameToRemove Is the name to remove from member name list
117 void OutlineGroup :: removeOutline(std::string theNameToRemove, bool allOcurrencies)
119 std::vector <std::string>::iterator iter;
121 bool ifContinue = true;
122 bool deleted = false;
123 for ( iter = outlines_keyNames.begin( ); iter != outlines_keyNames.end( ) && ifContinue; iter++ )
125 if ( (*iter).compare(theNameToRemove)==0 )
127 outlines_keyNames.erase(iter);
130 ifContinue = allOcurrencies ? acceptsRepetedOutlines : deleted;
132 //delete iter; Se incluye esta linea o no ????????????????????
136 * Adds an outline with the given name to the group members list
137 * @param theNameNw Is the name to add to the group
139 void OutlineGroup :: addOutline(std::string theNameNw)
141 bool ifInclude = acceptsRepetedOutlines ? true : !isMemberOfGroup(theNameNw);
143 outlines_keyNames.push_back(theNameNw);
145 if( groupType == PROPAGATION )
146 addOutline_PropagationType( theNameNw );
147 else if ( groupType == PLANE_SECTION )
148 addOutline_PlaneSectionType( theNameNw );
149 else if ( groupType == OVERLAPED )
150 addOutline_OverlapedType( theNameNw );
151 else if ( groupType == STRIP )
152 addOutline_StripType( theNameNw );
153 else if ( groupType == MANUAL_GROUP )
154 addOutline_ManualType( theNameNw );
159 * Gets the name of the group
160 * @return name Is the name of the group
162 std::string OutlineGroup :: getName()
168 * Sets the name of the group as the given one
169 * @param name Is the new name of the group
171 void OutlineGroup :: setName(std::string theNwName)
177 * Gets the state of visiblility (true:visible) or not of the group
178 * @return visibleGroup Is the corresponding state
180 bool OutlineGroup :: getIfVisibleGroup()
186 * Sets state of visible (true) or not of the with the given one
187 * @param theNwVisiblity Is the corresponding state
189 void OutlineGroup :: setIfVisibleGroup(bool theNwVisiblity)
191 visibleGroup = theNwVisiblity;
195 * Gets the state of static (true:static) or not of the group
196 * @return staticGroup Is the corresponding state
198 bool OutlineGroup :: getIfStaticGroup()
204 * Sets state of static (true) or not of the with the given one
205 * @param theNwStatic Is the corresponding state
207 void OutlineGroup :: setIfStaticGroup(bool theNwStatic)
209 staticGroup = theNwStatic;
213 * Gets the state of selection (true:selected) or not of the group
214 * @return selecetedGroup Is the corresponding state
216 bool OutlineGroup :: getIfSelectedGroup()
218 return selectedGroup;
222 * Sets state of visible (true) or not of the with the given one
223 * @param theNwSelected Is the corresponding state
225 void OutlineGroup :: setIfSelectedGroup(bool theNwSelected)
227 selectedGroup = theNwSelected;
231 * Gets the state of edition (true:editing) or not of the group
232 * @return editingGroup Is the corresponding state
234 bool OutlineGroup :: getIfEditingGroup()
240 * Sets state of editing (true) or not of the with the given one
241 * @param theNwEditing Is the corresponding state
243 void OutlineGroup :: setIfEditingGroup(bool theNwEditing)
245 editingGroup = theNwEditing;
249 * Gets the total count of outlines in the group
250 * @return totalCount Is the corresponding number of elements
252 int OutlineGroup :: getGroupType()
258 * Sets the group type
259 * @param theType Is the corresponding new type to assign
261 void OutlineGroup :: setGroupType(int theType)
267 * Sets the total count of outlines in the group
268 * @param theNwVisiblity Is the corresponding state
270 void OutlineGroup :: setIfEditingGroup(int theTotal)
272 totalCount = theTotal;
276 * Gets the group type
277 * @return type Is the corresponding number of elements
279 int OutlineGroup :: getOutlinesCount()
285 * Adds an outline to the group as propagation type
286 * @param theOutlineKeyName Is the name used as identifier of the outline
288 void OutlineGroup :: addOutline_PropagationType(std::string theOutlineKeyName)
290 outlines_keyNames.push_back(theOutlineKeyName);
294 * Adds an outline to the group as plane section type
295 * @param theOutlineKeyName Is the name used as identifier of the outline
297 void OutlineGroup :: addOutline_PlaneSectionType(std::string theOutlineKeyName)
299 outlines_keyNames.push_back(theOutlineKeyName);
304 * Adds an outline to the group as overlaped type
305 * @param theOutlineKeyName Is the name used as identifier of the outline
307 void OutlineGroup :: addOutline_OverlapedType(std::string theOutlineKeyName)
309 bool ifInclude = isMemberOfGroup(theOutlineKeyName);
311 outlines_keyNames.push_back(theOutlineKeyName);
315 * Adds an outline to the group as strip type
316 * @param theOutlineKeyName Is the name used as identifier of the outline
318 void OutlineGroup :: addOutline_StripType(std::string theOutlineKeyName)
320 outlines_keyNames.push_back(theOutlineKeyName);
324 * Adds an outline to the group as manual type
325 * @param theOutlineKeyName Is the name used as identifier of the outline
327 void OutlineGroup :: addOutline_ManualType(std::string theOutlineKeyName)
329 outlines_keyNames.push_back(theOutlineKeyName);
333 * Gets the outlines of the group
334 * @return Returns the names of the outlines that belong to the group
336 std::vector< std::string > OutlineGroup :: getGroupOutlinesNames ( )
338 return outlines_keyNames;