7fd59977 |
1 | #include <IFSelect_SelectRootComps.ixx> |
2 | #include <IFGraph_StrongComponants.hxx> |
3 | #include <IFGraph_Cumulate.hxx> |
4 | |
5 | |
6 | IFSelect_SelectRootComps::IFSelect_SelectRootComps () { } |
7 | |
8 | |
9 | // Refait pour travailler en une fois |
10 | // ATTENTION, il ne faut pas s interesser aux ENTITES mais aux COMPOSANTS |
11 | // c-a-d gerer les CYCLES s il y en a |
12 | |
13 | Interface_EntityIterator IFSelect_SelectRootComps::RootResult |
14 | (const Interface_Graph& G) const |
15 | { |
16 | Interface_EntityIterator IEIinput = InputResult(G); |
17 | Interface_EntityIterator iter; |
18 | // ICI, extraire les Componants, puis considerer une Entite de chacun |
19 | IFGraph_StrongComponants comps(G,Standard_False); |
20 | comps.SetLoad(); |
21 | comps.GetFromIter(IEIinput); |
22 | Interface_EntityIterator inp1; // IEIinput reduit a une Entite par Composant |
23 | |
24 | IFGraph_Cumulate GC(G); |
25 | |
26 | // On note dans le graphe : le cumul de chaque ensemble (Entite + Shared tous |
27 | // niveaux). Les Roots initiales comptees une seule fois sont bonnes |
28 | // Pour Entite : une par Componant (peu importe) |
29 | for (comps.Start(); comps.More(); comps.Next()) { |
30 | Handle(Standard_Transient) ent = comps.FirstEntity(); |
31 | GC.GetFromEntity(ent); |
32 | inp1.GetOneItem(ent); |
33 | } |
34 | // A present, on retient, parmi les inputs, celles comptees une seule fois |
35 | // (N.B.: on prend inp1, qui donne UNE entite par composant, simple ou cycle) |
36 | for (inp1.Start(); inp1.More(); inp1.Next()) { |
37 | Handle(Standard_Transient) ent = inp1.Value(); |
38 | if ((Standard_Boolean)(GC.NbTimes(ent) <= 1) == IsDirect()) iter.GetOneItem(ent); |
39 | } |
40 | return iter; |
41 | } |
42 | |
43 | Standard_Boolean IFSelect_SelectRootComps::HasUniqueResult () const |
44 | { return Standard_True; } |
45 | |
46 | |
47 | Standard_Boolean IFSelect_SelectRootComps::Sort |
48 | (const Standard_Integer , const Handle(Standard_Transient)& , |
49 | const Handle(Interface_InterfaceModel)& ) const |
50 | { return Standard_True; } |
51 | |
52 | TCollection_AsciiString IFSelect_SelectRootComps::ExtractLabel () const |
53 | { return TCollection_AsciiString("Local Root Componants"); } |