1 #include <IFSelect_SelectSuite.ixx>
2 #include <IFSelect_SelectPointed.hxx>
6 IFSelect_SelectSuite::IFSelect_SelectSuite () { }
8 Standard_Boolean IFSelect_SelectSuite::AddInput
9 (const Handle(IFSelect_Selection)& item)
11 if (item.IsNull()) return Standard_False;
12 Handle(IFSelect_Selection) input = Input();
13 if (!input.IsNull()) return Standard_False;
14 Handle(IFSelect_SelectDeduct) first = Handle(IFSelect_SelectDeduct)::DownCast(item);
15 if (first.IsNull()) SetInput(item);
16 else thesel.Prepend (item);
20 void IFSelect_SelectSuite::AddPrevious
21 (const Handle(IFSelect_SelectDeduct)& item)
22 { if (!item.IsNull()) thesel.Prepend (item); }
24 void IFSelect_SelectSuite::AddNext
25 (const Handle(IFSelect_SelectDeduct)& item)
26 { if (!item.IsNull()) thesel.Append (item); }
28 Standard_Integer IFSelect_SelectSuite::NbItems () const
29 { return thesel.Length(); }
31 Handle(IFSelect_SelectDeduct) IFSelect_SelectSuite::Item
32 (const Standard_Integer num) const
33 { return Handle(IFSelect_SelectDeduct)::DownCast(thesel.Value(num)); }
35 void IFSelect_SelectSuite::SetLabel (const Standard_CString lab)
36 { thelab.Clear(); thelab.AssignCat (lab); }
39 Interface_EntityIterator IFSelect_SelectSuite::RootResult
40 (const Interface_Graph& G) const
42 Interface_EntityIterator iter;
43 Standard_Boolean firstin = (HasInput() || HasAlternate());
44 if (firstin) iter = InputResult(G);
45 // Demarrage : on prend l Input/Alternate SI un des 2 est mis
46 // Sinon, on demarre sur la definition de base de la premiere selection
48 Standard_Integer i, nb = NbItems();
49 for (i = 1; i <= nb; i ++) {
50 Handle(IFSelect_SelectDeduct) anitem = Item(i);
51 if (firstin) anitem->Alternate()->SetList (iter.Content());
52 firstin = Standard_True; // ensuite c est systematique
53 iter = anitem->UniqueResult(G);
58 TCollection_AsciiString IFSelect_SelectSuite::Label () const
60 if (thelab.Length() > 0) return thelab;
62 sprintf (txt,"Suite of %d Selections",NbItems());
63 TCollection_AsciiString lab(txt);