2 //----------------------------------------------------------------------------------------------------------------
3 // Class definition include
4 //----------------------------------------------------------------------------------------------------------------
5 #include "OutlineGroup.h"
7 //----------------------------------------------------------------------------------------------------------------
8 // Class implementation
9 //----------------------------------------------------------------------------------------------------------------
10 /** @file OutlineGroup.cxx */
12 //------------------------------------------------------------------------------------------------------------
13 // Constructors & Destructors
14 //------------------------------------------------------------------------------------------------------------
17 * Constructs an outline group with the given name
18 * @param theName Is the name for the group
19 * @param theGroupType Is the type for the group corresponding to one of the constants of this class
21 OutlineGroup :: OutlineGroup(std::string theName, int theGroupType)
24 groupType = theGroupType;
27 if ( groupType == PROPAGATION || groupType == PLANE_SECTION )
30 selectedGroup = false;
33 acceptsRepetedOutlines = false;
35 else if ( groupType == STRIP )
38 selectedGroup = false;
41 acceptsRepetedOutlines = true;
43 else if ( groupType == OVERLAPED )
46 selectedGroup = false;
49 acceptsRepetedOutlines = false;
51 else if ( groupType == MANUAL_GROUP )
57 acceptsRepetedOutlines = true;
62 * Destroyes the outline and its dependencies
64 OutlineGroup :: ~ OutlineGroup()
66 outlines_keyNames.clear();
69 //------------------------------------------------------------------------------------------------------------
71 //------------------------------------------------------------------------------------------------------------
75 * Indicates if a given name of an outline is member of the group or not
76 * @param aKeyName Is the name of an outline to search for
78 bool OutlineGroup :: isMemberOfGroup(std::string aKeyName)
80 for (int a=0; a < outlines_keyNames.size(); a++)
82 if ( outlines_keyNames[a].compare(aKeyName) == 0 )
89 * Removes an outline with the given name from the group
90 * @param theNameToRemove Is the name to remove from member name list
92 void OutlineGroup :: removeOutline(std::string theNameToRemove, bool allOcurrencies)
94 std::vector <std::string>::iterator iter;
96 bool ifContinue = true;
98 for ( iter = outlines_keyNames.begin( ); iter != outlines_keyNames.end( ) && ifContinue; iter++ )
100 if ( (*iter).compare(theNameToRemove)==0 )
102 outlines_keyNames.erase(iter);
105 ifContinue = allOcurrencies ? acceptsRepetedOutlines : deleted;
107 //delete iter; Se incluye esta linea o no ????????????????????
111 * Adds an outline with the given name to the group members list
112 * @param theNameNw Is the name to add to the group
114 void OutlineGroup :: addOutline(std::string theNameNw)
116 bool ifInclude = acceptsRepetedOutlines ? true : !isMemberOfGroup(theNameNw);
118 outlines_keyNames.push_back(theNameNw);
120 if( groupType == PROPAGATION )
121 addOutline_PropagationType( theNameNw );
122 else if ( groupType == PLANE_SECTION )
123 addOutline_PlaneSectionType( theNameNw );
124 else if ( groupType == OVERLAPED )
125 addOutline_OverlapedType( theNameNw );
126 else if ( groupType == STRIP )
127 addOutline_StripType( theNameNw );
128 else if ( groupType == MANUAL_GROUP )
129 addOutline_ManualType( theNameNw );
134 * Gets the name of the group
135 * @return name Is the name of the group
137 std::string OutlineGroup :: getName()
143 * Sets the name of the group as the given one
144 * @param name Is the new name of the group
146 void OutlineGroup :: setName(std::string theNwName)
152 * Gets the state of visiblility (true:visible) or not of the group
153 * @return visibleGroup Is the corresponding state
155 bool OutlineGroup :: getIfVisibleGroup()
161 * Sets state of visible (true) or not of the with the given one
162 * @param theNwVisiblity Is the corresponding state
164 void OutlineGroup :: setIfVisibleGroup(bool theNwVisiblity)
166 visibleGroup = theNwVisiblity;
170 * Gets the state of static (true:static) or not of the group
171 * @return staticGroup Is the corresponding state
173 bool OutlineGroup :: getIfStaticGroup()
179 * Sets state of static (true) or not of the with the given one
180 * @param theNwStatic Is the corresponding state
182 void OutlineGroup :: setIfStaticGroup(bool theNwStatic)
184 staticGroup = theNwStatic;
188 * Gets the state of selection (true:selected) or not of the group
189 * @return selecetedGroup Is the corresponding state
191 bool OutlineGroup :: getIfSelectedGroup()
193 return selectedGroup;
197 * Sets state of visible (true) or not of the with the given one
198 * @param theNwSelected Is the corresponding state
200 void OutlineGroup :: setIfSelectedGroup(bool theNwSelected)
202 selectedGroup = theNwSelected;
206 * Gets the state of edition (true:editing) or not of the group
207 * @return editingGroup Is the corresponding state
209 bool OutlineGroup :: getIfEditingGroup()
215 * Sets state of editing (true) or not of the with the given one
216 * @param theNwEditing Is the corresponding state
218 void OutlineGroup :: setIfEditingGroup(bool theNwEditing)
220 editingGroup = theNwEditing;
224 * Gets the total count of outlines in the group
225 * @return totalCount Is the corresponding number of elements
227 int OutlineGroup :: getGroupType()
233 * Sets the group type
234 * @param theType Is the corresponding new type to assign
236 void OutlineGroup :: setGroupType(int theType)
242 * Sets the total count of outlines in the group
243 * @param theNwVisiblity Is the corresponding state
245 void OutlineGroup :: setIfEditingGroup(int theTotal)
247 totalCount = theTotal;
251 * Gets the group type
252 * @return type Is the corresponding number of elements
254 int OutlineGroup :: getOutlinesCount()
260 * Adds an outline to the group as propagation type
261 * @param theOutlineKeyName Is the name used as identifier of the outline
263 void OutlineGroup :: addOutline_PropagationType(std::string theOutlineKeyName)
265 outlines_keyNames.push_back(theOutlineKeyName);
269 * Adds an outline to the group as plane section type
270 * @param theOutlineKeyName Is the name used as identifier of the outline
272 void OutlineGroup :: addOutline_PlaneSectionType(std::string theOutlineKeyName)
274 outlines_keyNames.push_back(theOutlineKeyName);
279 * Adds an outline to the group as overlaped type
280 * @param theOutlineKeyName Is the name used as identifier of the outline
282 void OutlineGroup :: addOutline_OverlapedType(std::string theOutlineKeyName)
284 bool ifInclude = isMemberOfGroup(theOutlineKeyName);
286 outlines_keyNames.push_back(theOutlineKeyName);
290 * Adds an outline to the group as strip type
291 * @param theOutlineKeyName Is the name used as identifier of the outline
293 void OutlineGroup :: addOutline_StripType(std::string theOutlineKeyName)
295 outlines_keyNames.push_back(theOutlineKeyName);
299 * Adds an outline to the group as manual type
300 * @param theOutlineKeyName Is the name used as identifier of the outline
302 void OutlineGroup :: addOutline_ManualType(std::string theOutlineKeyName)
304 outlines_keyNames.push_back(theOutlineKeyName);
308 * Gets the outlines of the group
309 * @return Returns the names of the outlines that belong to the group
311 std::vector< std::string > OutlineGroup :: getGroupOutlinesNames ( )
313 return outlines_keyNames;