1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <IFSelect_AppliedModifiers.ixx>
17 IFSelect_AppliedModifiers::IFSelect_AppliedModifiers
18 (const Standard_Integer nbmax, const Standard_Integer nbent)
21 thenbent = nbent; theentcnt = 0;
24 Standard_Boolean IFSelect_AppliedModifiers::AddModif
25 (const Handle(IFSelect_GeneralModifier)& modif)
27 if (themodifs.Length() >= thelists.NbEntities()) return Standard_False;
28 themodifs.Append(modif);
29 thelists.SetNumber (themodifs.Length());
33 Standard_Boolean IFSelect_AppliedModifiers::AddNum
34 (const Standard_Integer nument)
36 thelists.Add (nument);
41 Standard_Integer IFSelect_AppliedModifiers::Count () const
42 { return themodifs.Length(); }
44 Standard_Boolean IFSelect_AppliedModifiers::Item
45 (const Standard_Integer num,
46 Handle(IFSelect_GeneralModifier)& modif,
47 Standard_Integer& entcount)
49 if (num < 1 || num > themodifs.Length()) return Standard_False;
50 modif = themodifs.Value(num);
51 thelists.SetNumber (num);
52 theentcnt = thelists.Length();
53 entcount = (theentcnt > 0 ? theentcnt : thenbent);
57 Standard_Integer IFSelect_AppliedModifiers::ItemNum
58 (const Standard_Integer nument) const
59 { return (theentcnt > 0 ? thelists.Value(nument) : nument); }
61 Handle(TColStd_HSequenceOfInteger) IFSelect_AppliedModifiers::ItemList () const
63 Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
64 Standard_Integer i, nb = (theentcnt > 0 ? theentcnt : thenbent);
65 for (i = 1; i <= nb; i ++) list->Append (ItemNum(i));
69 Standard_Boolean IFSelect_AppliedModifiers::IsForAll () const
70 { return (theentcnt == 0); }