OutlineGroup.cxx

Go to the documentation of this file.
00001 
00002 //----------------------------------------------------------------------------------------------------------------
00003 // Class definition include
00004 //----------------------------------------------------------------------------------------------------------------
00005 #include "OutlineGroup.h"
00006 
00007 //----------------------------------------------------------------------------------------------------------------
00008 // Class implementation
00009 //----------------------------------------------------------------------------------------------------------------
00012 //------------------------------------------------------------------------------------------------------------
00013 // Constructors & Destructors
00014 //------------------------------------------------------------------------------------------------------------
00015 
00016         /*
00017         * Constructs an outline group with the given name
00018         * @param theName Is the name for the group
00019         * @param theGroupType Is the type for the group corresponding to one of the constants of this class
00020         */ 
00021         OutlineGroup :: OutlineGroup(std::string theName, int theGroupType)
00022         {
00023                 name = theName;         
00024                 groupType = theGroupType;
00025                 totalCount = 0;
00026                 
00027                 if ( groupType == PROPAGATION || groupType == PLANE_SECTION  )
00028                 {
00029                         visibleGroup = true;                    
00030                         selectedGroup = false;
00031                         editingGroup = false;
00032                         staticGroup = false;
00033                         acceptsRepetedOutlines = false;
00034                 }
00035                 else if ( groupType ==  STRIP )
00036                 {       
00037                         visibleGroup = true;                    
00038                         selectedGroup = false;
00039                         editingGroup = false;
00040                         staticGroup = false;
00041                         acceptsRepetedOutlines = true;
00042                 }
00043                 else if ( groupType == OVERLAPED )
00044                 {                               
00045                         visibleGroup = true;                    
00046                         selectedGroup = false;
00047                         editingGroup = false;
00048                         staticGroup = true;
00049                         acceptsRepetedOutlines = false;
00050                 }
00051                 else if ( groupType ==  MANUAL_GROUP )
00052                 {                               
00053                         visibleGroup = true;
00054                         selectedGroup = true;
00055                         editingGroup = true;
00056                         staticGroup = false;
00057                         acceptsRepetedOutlines = true;
00058                 }                               
00059         }
00060         
00061         /*
00062         * Destroyes the outline and its dependencies
00063         */
00064         OutlineGroup :: ~ OutlineGroup()
00065         {
00066                 outlines_keyNames.clear();
00067         }
00068 
00069 //------------------------------------------------------------------------------------------------------------
00070 // Methods
00071 //------------------------------------------------------------------------------------------------------------
00072 
00073 
00074         /*
00075         * Indicates if a given name of an outline is member of the group or not
00076         * @param aKeyName Is the name of an outline to search for
00077         */
00078         bool OutlineGroup :: isMemberOfGroup(std::string aKeyName)
00079         {
00080                 for (int a=0; a < outlines_keyNames.size(); a++)
00081                 {
00082                         if ( outlines_keyNames[a].compare(aKeyName) == 0 )
00083                                 return true;
00084                 }               
00085                 return false;
00086         }
00087 
00088         /*
00089         * Removes an outline with the given name from the group 
00090         * @param theNameToRemove Is the name to remove from member name list
00091         */
00092         void OutlineGroup :: removeOutline(std::string theNameToRemove, bool allOcurrencies)
00093         {
00094                 std::vector <std::string>::iterator iter;               
00095                 
00096                 bool ifContinue = true;
00097                 bool deleted = false;
00098                 for ( iter = outlines_keyNames.begin( ); iter != outlines_keyNames.end( ) && ifContinue; iter++ )
00099                 {
00100                         if ( (*iter).compare(theNameToRemove)==0 )
00101                         {
00102                                 outlines_keyNames.erase(iter);
00103                                 deleted = true;
00104                         }
00105                         ifContinue = allOcurrencies ? acceptsRepetedOutlines : deleted; 
00106                 }
00107                 //delete iter; Se incluye esta linea o no ????????????????????
00108         }
00109         
00110         /*
00111         * Adds an outline with the given name to the group members list
00112         * @param theNameNw Is the name to add to the group
00113         */
00114         void OutlineGroup :: addOutline(std::string theNameNw)
00115         {
00116                 bool ifInclude = acceptsRepetedOutlines ? true : !isMemberOfGroup(theNameNw);
00117                 if ( ifInclude )
00118                         outlines_keyNames.push_back(theNameNw);
00119         /*
00120                 if( groupType == PROPAGATION )
00121                         addOutline_PropagationType( theNameNw );
00122                 else if ( groupType == PLANE_SECTION )
00123                         addOutline_PlaneSectionType( theNameNw );
00124                 else if ( groupType == OVERLAPED )
00125                         addOutline_OverlapedType( theNameNw );
00126                 else if ( groupType == STRIP )
00127                         addOutline_StripType( theNameNw );
00128                 else if ( groupType == MANUAL_GROUP )
00129                         addOutline_ManualType( theNameNw );
00130         */
00131         }       
00132 
00133         /*
00134         * Gets the name of the group
00135         * @return name Is the name of the group
00136         */ 
00137         std::string OutlineGroup :: getName()
00138         { 
00139                 return name;
00140         }
00141 
00142         /*
00143         * Sets the name of the group as the given one 
00144         * @param name Is the new name of the group
00145         */ 
00146         void OutlineGroup :: setName(std::string theNwName)
00147         { 
00148                 name = theNwName;
00149         }
00150 
00151         /*
00152         * Gets the state of visiblility (true:visible) or not of the group
00153         * @return visibleGroup Is the corresponding state
00154         */ 
00155         bool OutlineGroup ::  getIfVisibleGroup()
00156         { 
00157                 return visibleGroup;
00158         }
00159 
00160         /*
00161         * Sets state of visible (true) or not of the with the given one 
00162         * @param theNwVisiblity Is the corresponding state
00163         */ 
00164         void OutlineGroup :: setIfVisibleGroup(bool theNwVisiblity)
00165         { 
00166                 visibleGroup = theNwVisiblity;
00167         }
00168 
00169         /*
00170         * Gets the state of static (true:static) or not of the group
00171         * @return staticGroup Is the corresponding state
00172         */ 
00173         bool OutlineGroup ::  getIfStaticGroup()
00174         { 
00175                 return staticGroup;
00176         }
00177 
00178         /*
00179         * Sets state of static (true) or not of the with the given one 
00180         * @param theNwStatic Is the corresponding state
00181         */ 
00182         void OutlineGroup :: setIfStaticGroup(bool theNwStatic)
00183         { 
00184                 staticGroup = theNwStatic;
00185         }
00186 
00187         /*
00188         * Gets the state of selection (true:selected) or not of the group
00189         * @return selecetedGroup Is the corresponding state
00190         */ 
00191         bool OutlineGroup ::  getIfSelectedGroup()
00192         { 
00193                 return selectedGroup;
00194         }
00195 
00196         /*
00197         * Sets state of visible (true) or not of the with the given one 
00198         * @param theNwSelected Is the corresponding state
00199         */ 
00200         void OutlineGroup :: setIfSelectedGroup(bool theNwSelected)
00201         { 
00202                 selectedGroup = theNwSelected;
00203         }
00204 
00205         /*
00206         * Gets the state of edition (true:editing) or not of the group
00207         * @return editingGroup Is the corresponding state
00208         */ 
00209         bool OutlineGroup ::  getIfEditingGroup()
00210         { 
00211                 return editingGroup;
00212         }
00213 
00214         /*
00215         * Sets state of editing (true) or not of the with the given one 
00216         * @param theNwEditing Is the corresponding state
00217         */ 
00218         void OutlineGroup :: setIfEditingGroup(bool theNwEditing)
00219         { 
00220                 editingGroup = theNwEditing;
00221         }
00222 
00223         /*
00224         * Gets the total count of outlines in the group
00225         * @return totalCount Is the corresponding number of elements
00226         */ 
00227         int  OutlineGroup :: getGroupType()
00228         {
00229                 return groupType;
00230         }
00231 
00232         /*
00233         * Sets the group type 
00234         * @param theType Is the corresponding new type to assign 
00235         */ 
00236         void OutlineGroup :: setGroupType(int  theType)
00237         {
00238                 groupType = theType;
00239         }
00240 
00241         /*
00242         * Sets the total count of outlines in the group
00243         * @param theNwVisiblity Is the corresponding state
00244         */ 
00245         void OutlineGroup :: setIfEditingGroup(int  theTotal)
00246         {
00247                 totalCount = theTotal;
00248         }
00249 
00250         /*
00251         * Gets the group type 
00252         * @return type Is the corresponding number of elements
00253         */ 
00254         int  OutlineGroup :: getOutlinesCount()
00255         {
00256                 return totalCount;
00257         }
00258 
00259         /*
00260         * Adds an outline to the group as propagation type
00261         * @param theOutlineKeyName Is the name used as identifier of the outline        
00262         */
00263         void OutlineGroup :: addOutline_PropagationType(std::string theOutlineKeyName)
00264         {
00265                 outlines_keyNames.push_back(theOutlineKeyName);
00266         }
00267 
00268         /*
00269         * Adds an outline to the group as plane section type
00270         * @param theOutlineKeyName Is the name used as identifier of the outline        
00271         */
00272         void OutlineGroup :: addOutline_PlaneSectionType(std::string theOutlineKeyName)
00273         {
00274                 outlines_keyNames.push_back(theOutlineKeyName);
00275         }
00276 
00277 
00278         /*
00279         * Adds an outline to the group as overlaped type
00280         * @param theOutlineKeyName Is the name used as identifier of the outline        
00281         */
00282         void OutlineGroup :: addOutline_OverlapedType(std::string theOutlineKeyName)
00283         {
00284                 bool ifInclude = isMemberOfGroup(theOutlineKeyName);
00285                 if ( ifInclude )
00286                         outlines_keyNames.push_back(theOutlineKeyName);
00287         }
00288 
00289         /*
00290         * Adds an outline to the group as strip type
00291         * @param theOutlineKeyName Is the name used as identifier of the outline        
00292         */
00293         void OutlineGroup :: addOutline_StripType(std::string theOutlineKeyName)
00294         {
00295                 outlines_keyNames.push_back(theOutlineKeyName);
00296         }
00297 
00298         /*
00299         * Adds an outline to the group as manual type
00300         * @param theOutlineKeyName Is the name used as identifier of the outline        
00301         */
00302         void OutlineGroup :: addOutline_ManualType(std::string theOutlineKeyName)
00303         {
00304                 outlines_keyNames.push_back(theOutlineKeyName);
00305         }
00306 
00307         /*
00308         * Gets the outlines of the group
00309         * @return Returns the names of the outlines that belong to the group
00310         */
00311          std::vector< std::string > OutlineGroup :: getGroupOutlinesNames ( )
00312          {
00313                  return outlines_keyNames;
00314          }
00315  

Generated on Wed Jun 27 23:28:33 2012 for creaContours_lib by  doxygen 1.5.7.1