Integration of OCCT 6.5.0 from SVN
[occt.git] / src / IFSelect / IFSelect_AppliedModifiers.cxx
CommitLineData
7fd59977 1#include <IFSelect_AppliedModifiers.ixx>
2
3
4 IFSelect_AppliedModifiers::IFSelect_AppliedModifiers
5 (const Standard_Integer nbmax, const Standard_Integer nbent)
6 : thelists (nbmax+1)
7{
8 thenbent = nbent; theentcnt = 0;
9}
10
11 Standard_Boolean IFSelect_AppliedModifiers::AddModif
12 (const Handle(IFSelect_GeneralModifier)& modif)
13{
14 if (themodifs.Length() >= thelists.NbEntities()) return Standard_False;
15 themodifs.Append(modif);
16 thelists.SetNumber (themodifs.Length());
17 return Standard_True;
18}
19
20 Standard_Boolean IFSelect_AppliedModifiers::AddNum
21 (const Standard_Integer nument)
22{
23 thelists.Add (nument);
24 return Standard_True;
25}
26
27
28 Standard_Integer IFSelect_AppliedModifiers::Count () const
29 { return themodifs.Length(); }
30
31 Standard_Boolean IFSelect_AppliedModifiers::Item
32 (const Standard_Integer num,
33 Handle(IFSelect_GeneralModifier)& modif,
34 Standard_Integer& entcount)
35{
36 if (num < 1 || num > themodifs.Length()) return Standard_False;
37 modif = themodifs.Value(num);
38 thelists.SetNumber (num);
39 theentcnt = thelists.Length();
40 entcount = (theentcnt > 0 ? theentcnt : thenbent);
41 return Standard_True;
42}
43
44 Standard_Integer IFSelect_AppliedModifiers::ItemNum
45 (const Standard_Integer nument) const
46 { return (theentcnt > 0 ? thelists.Value(nument) : nument); }
47
48 Handle(TColStd_HSequenceOfInteger) IFSelect_AppliedModifiers::ItemList () const
49{
50 Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
51 Standard_Integer i, nb = (theentcnt > 0 ? theentcnt : thenbent);
52 for (i = 1; i <= nb; i ++) list->Append (ItemNum(i));
53 return list;
54}
55
56 Standard_Boolean IFSelect_AppliedModifiers::IsForAll () const
57 { return (theentcnt == 0); }