0023948: Wrong intersection between a surface of revolution and a plane.
[occt.git] / src / IFSelect / IFSelect_AppliedModifiers.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14#include <IFSelect_AppliedModifiers.ixx>
15
16
b311480e 17IFSelect_AppliedModifiers::IFSelect_AppliedModifiers
7fd59977 18 (const Standard_Integer nbmax, const Standard_Integer nbent)
19 : thelists (nbmax+1)
20{
21 thenbent = nbent; theentcnt = 0;
22}
23
24 Standard_Boolean IFSelect_AppliedModifiers::AddModif
25 (const Handle(IFSelect_GeneralModifier)& modif)
26{
27 if (themodifs.Length() >= thelists.NbEntities()) return Standard_False;
28 themodifs.Append(modif);
29 thelists.SetNumber (themodifs.Length());
30 return Standard_True;
31}
32
33 Standard_Boolean IFSelect_AppliedModifiers::AddNum
34 (const Standard_Integer nument)
35{
36 thelists.Add (nument);
37 return Standard_True;
38}
39
40
41 Standard_Integer IFSelect_AppliedModifiers::Count () const
42 { return themodifs.Length(); }
43
44 Standard_Boolean IFSelect_AppliedModifiers::Item
45 (const Standard_Integer num,
46 Handle(IFSelect_GeneralModifier)& modif,
47 Standard_Integer& entcount)
48{
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);
54 return Standard_True;
55}
56
57 Standard_Integer IFSelect_AppliedModifiers::ItemNum
58 (const Standard_Integer nument) const
59 { return (theentcnt > 0 ? thelists.Value(nument) : nument); }
60
61 Handle(TColStd_HSequenceOfInteger) IFSelect_AppliedModifiers::ItemList () const
62{
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));
66 return list;
67}
68
69 Standard_Boolean IFSelect_AppliedModifiers::IsForAll () const
70 { return (theentcnt == 0); }