blob: 264cd050aa6392e5aaabea72f0160f16806f54c0 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include <IFSelect_SelectSuite.ixx>
#include <IFSelect_SelectPointed.hxx>
#include <stdio.h>
IFSelect_SelectSuite::IFSelect_SelectSuite () { }
Standard_Boolean IFSelect_SelectSuite::AddInput
(const Handle(IFSelect_Selection)& item)
{
if (item.IsNull()) return Standard_False;
Handle(IFSelect_Selection) input = Input();
if (!input.IsNull()) return Standard_False;
Handle(IFSelect_SelectDeduct) first = Handle(IFSelect_SelectDeduct)::DownCast(item);
if (first.IsNull()) SetInput(item);
else thesel.Prepend (item);
return Standard_True;
}
void IFSelect_SelectSuite::AddPrevious
(const Handle(IFSelect_SelectDeduct)& item)
{ if (!item.IsNull()) thesel.Prepend (item); }
void IFSelect_SelectSuite::AddNext
(const Handle(IFSelect_SelectDeduct)& item)
{ if (!item.IsNull()) thesel.Append (item); }
Standard_Integer IFSelect_SelectSuite::NbItems () const
{ return thesel.Length(); }
Handle(IFSelect_SelectDeduct) IFSelect_SelectSuite::Item
(const Standard_Integer num) const
{ return Handle(IFSelect_SelectDeduct)::DownCast(thesel.Value(num)); }
void IFSelect_SelectSuite::SetLabel (const Standard_CString lab)
{ thelab.Clear(); thelab.AssignCat (lab); }
Interface_EntityIterator IFSelect_SelectSuite::RootResult
(const Interface_Graph& G) const
{
Interface_EntityIterator iter;
Standard_Boolean firstin = (HasInput() || HasAlternate());
if (firstin) iter = InputResult(G);
// Demarrage : on prend l Input/Alternate SI un des 2 est mis
// Sinon, on demarre sur la definition de base de la premiere selection
Standard_Integer i, nb = NbItems();
for (i = 1; i <= nb; i ++) {
Handle(IFSelect_SelectDeduct) anitem = Item(i);
if (firstin) anitem->Alternate()->SetList (iter.Content());
firstin = Standard_True; // ensuite c est systematique
iter = anitem->UniqueResult(G);
}
return iter;
}
TCollection_AsciiString IFSelect_SelectSuite::Label () const
{
if (thelab.Length() > 0) return thelab;
char txt[100];
sprintf (txt,"Suite of %d Selections",NbItems());
TCollection_AsciiString lab(txt);
return lab;
}
|