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.
15 #include <IFSelect_AppliedModifiers.hxx>
16 #include <IFSelect_GeneralModifier.hxx>
17 #include <Standard_Type.hxx>
19 IMPLEMENT_STANDARD_RTTIEXT(IFSelect_AppliedModifiers,Standard_Transient)
21 IFSelect_AppliedModifiers::IFSelect_AppliedModifiers
22 (const Standard_Integer nbmax, const Standard_Integer nbent)
25 thenbent = nbent; theentcnt = 0;
28 Standard_Boolean IFSelect_AppliedModifiers::AddModif
29 (const Handle(IFSelect_GeneralModifier)& modif)
31 if (themodifs.Length() >= thelists.NbEntities()) return Standard_False;
32 themodifs.Append(modif);
33 thelists.SetNumber (themodifs.Length());
37 Standard_Boolean IFSelect_AppliedModifiers::AddNum
38 (const Standard_Integer nument)
40 thelists.Add (nument);
45 Standard_Integer IFSelect_AppliedModifiers::Count () const
46 { return themodifs.Length(); }
48 Standard_Boolean IFSelect_AppliedModifiers::Item
49 (const Standard_Integer num,
50 Handle(IFSelect_GeneralModifier)& modif,
51 Standard_Integer& entcount)
53 if (num < 1 || num > themodifs.Length()) return Standard_False;
54 modif = themodifs.Value(num);
55 thelists.SetNumber (num);
56 theentcnt = thelists.Length();
57 entcount = (theentcnt > 0 ? theentcnt : thenbent);
61 Standard_Integer IFSelect_AppliedModifiers::ItemNum
62 (const Standard_Integer nument) const
63 { return (theentcnt > 0 ? thelists.Value(nument) : nument); }
65 Handle(TColStd_HSequenceOfInteger) IFSelect_AppliedModifiers::ItemList () const
67 Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
68 Standard_Integer i, nb = (theentcnt > 0 ? theentcnt : thenbent);
69 for (i = 1; i <= nb; i ++) list->Append (ItemNum(i));
73 Standard_Boolean IFSelect_AppliedModifiers::IsForAll () const
74 { return (theentcnt == 0); }