summaryrefslogtreecommitdiff
path: root/src/IFSelect/IFSelect_SelectCombine.cxx
blob: 12e229061cf453b262ad523ed7ce931d730fdd78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <IFSelect_SelectCombine.ixx>
#include <IFGraph_Cumulate.hxx>


    IFSelect_SelectCombine::IFSelect_SelectCombine ()    {  }
//      {  thelist = new IFSelect_SequenceOfSelection();  }

    Standard_Integer  IFSelect_SelectCombine::NbInputs () const 
      {  return thelist.Length();  }

    Handle(IFSelect_Selection)  IFSelect_SelectCombine::Input
  (const Standard_Integer num) const 
      {  return thelist.Value(num);  }

    Standard_Integer  IFSelect_SelectCombine::InputRank
  (const Handle(IFSelect_Selection)& sel) const 
{
  if (sel.IsNull()) return 0;
  Standard_Integer i, nb = thelist.Length();
  for (i = 1; i <= nb; i ++)
    if (sel == thelist.Value(i)) return i;
  return 0;
}

    void  IFSelect_SelectCombine::Add
  (const Handle(IFSelect_Selection)& sel, const Standard_Integer atnum)
{
  if (atnum <= 0 || atnum > thelist.Length()) thelist.Append(sel);
  else thelist.InsertBefore(atnum,sel);
}

    Standard_Boolean  IFSelect_SelectCombine::Remove
  (const Handle(IFSelect_Selection)& sel)
      {  return Remove (InputRank(sel));  }

    Standard_Boolean  IFSelect_SelectCombine::Remove
  (const Standard_Integer num)
{
  if (num <= 0 || num > thelist.Length()) return Standard_False;
  thelist.Remove(num);
  return Standard_True;
}


    Standard_Boolean  IFSelect_SelectCombine::HasUniqueResult () const 
      {  return Standard_True;  }

    void  IFSelect_SelectCombine::FillIterator
  (IFSelect_SelectionIterator& iter) const 
      {  iter.AddList(thelist);  }