1 #include <IFSelect_SelectSent.ixx>
5 IFSelect_SelectSent::IFSelect_SelectSent
6 (const Standard_Integer sentcount, const Standard_Boolean atleast)
7 { thecnt = sentcount; thelst = atleast; }
9 Standard_Integer IFSelect_SelectSent::SentCount () const
12 Standard_Boolean IFSelect_SelectSent::AtLeast () const
15 Interface_EntityIterator IFSelect_SelectSent::RootResult
16 (const Interface_Graph& G) const
18 Standard_Boolean direct = IsDirect();
19 Interface_EntityIterator res;
20 Interface_EntityIterator inp = InputResult(G);
22 for (inp.Start(); inp.More(); inp.Next()) {
23 Standard_Integer num = G.EntityNumber(inp.Value());
24 if (num == 0) continue;
25 Standard_Integer nb = G.Status(num); // nb sent
27 if (thecnt == 0) ok = (nb == 0);
28 else if (thelst) ok = (nb >= thecnt);
29 else ok = (nb == thecnt);
30 if (ok == direct) res.AddItem (G.Entity(num));
35 Standard_Boolean IFSelect_SelectSent::Sort
36 (const Standard_Integer ,
37 const Handle(Standard_Transient)&,
38 const Handle(Interface_InterfaceModel)& ) const
39 { return Standard_False; }
42 TCollection_AsciiString IFSelect_SelectSent::ExtractLabel () const
45 TCollection_AsciiString lab;
46 if (thecnt == 0) lab.AssignCat ("Remaining (non-sent) entities");
47 if (thecnt == 1 && thelst) lab.AssignCat ("Sent entities");
48 if (thecnt == 1 && !thelst) lab.AssignCat ("Sent once (non-duplicated) entities");
49 if (thecnt == 2 && thelst) lab.AssignCat ("Sent several times entities");
50 if (thecnt == 2 && !thelst) lab.AssignCat ("Sent just twice entities");
52 if (thelst) sprintf (lb,"Sent at least %d times entities", thecnt);
53 else sprintf (lb,"Sent just %d times entities", thecnt);