1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
18 #include <IFSelect_SelectRootComps.ixx>
19 #include <IFGraph_StrongComponants.hxx>
20 #include <IFGraph_Cumulate.hxx>
23 IFSelect_SelectRootComps::IFSelect_SelectRootComps () { }
26 // Refait pour travailler en une fois
27 // ATTENTION, il ne faut pas s interesser aux ENTITES mais aux COMPOSANTS
28 // c-a-d gerer les CYCLES s il y en a
30 Interface_EntityIterator IFSelect_SelectRootComps::RootResult
31 (const Interface_Graph& G) const
33 Interface_EntityIterator IEIinput = InputResult(G);
34 Interface_EntityIterator iter;
35 // ICI, extraire les Componants, puis considerer une Entite de chacun
36 IFGraph_StrongComponants comps(G,Standard_False);
38 comps.GetFromIter(IEIinput);
39 Interface_EntityIterator inp1; // IEIinput reduit a une Entite par Composant
41 IFGraph_Cumulate GC(G);
43 // On note dans le graphe : le cumul de chaque ensemble (Entite + Shared tous
44 // niveaux). Les Roots initiales comptees une seule fois sont bonnes
45 // Pour Entite : une par Componant (peu importe)
46 for (comps.Start(); comps.More(); comps.Next()) {
47 Handle(Standard_Transient) ent = comps.FirstEntity();
48 GC.GetFromEntity(ent);
51 // A present, on retient, parmi les inputs, celles comptees une seule fois
52 // (N.B.: on prend inp1, qui donne UNE entite par composant, simple ou cycle)
53 for (inp1.Start(); inp1.More(); inp1.Next()) {
54 Handle(Standard_Transient) ent = inp1.Value();
55 if ((Standard_Boolean)(GC.NbTimes(ent) <= 1) == IsDirect()) iter.GetOneItem(ent);
60 Standard_Boolean IFSelect_SelectRootComps::HasUniqueResult () const
61 { return Standard_True; }
64 Standard_Boolean IFSelect_SelectRootComps::Sort
65 (const Standard_Integer , const Handle(Standard_Transient)& ,
66 const Handle(Interface_InterfaceModel)& ) const
67 { return Standard_True; }
69 TCollection_AsciiString IFSelect_SelectRootComps::ExtractLabel () const
70 { return TCollection_AsciiString("Local Root Componants"); }