0023024: Update headers of OCCT files
[occt.git] / src / IFSelect / IFSelect_SelectRoots.cxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
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.
7 //
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.
10 //
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.
17
18 #include <IFSelect_SelectRoots.ixx>
19 #include <IFGraph_Cumulate.hxx>
20
21
22 IFSelect_SelectRoots::IFSelect_SelectRoots ()    {  }
23
24
25 // Refait pour travailler en une fois
26
27     Interface_EntityIterator  IFSelect_SelectRoots::RootResult
28   (const Interface_Graph& G) const
29 {
30   Interface_EntityIterator input = InputResult(G);
31   Interface_EntityIterator iter;
32   IFGraph_Cumulate GC(G);
33
34 //  On note dans le graphe : le cumul de chaque ensemble (Entite + Shared tous
35 //  niveaux). Les Roots initiales comptees une seule fois sont bonnes
36   for (input.Start(); input.More(); input.Next()) {
37     Handle(Standard_Transient) ent = input.Value();
38     GC.GetFromEntity(ent);
39   }
40 //  A present, on retient, parmi les inputs, celles comptees une seule fois
41   for (input.Start(); input.More(); input.Next()) {
42     Handle(Standard_Transient) ent = input.Value();
43     if ((Standard_Boolean)(GC.NbTimes(ent) <= 1) == IsDirect()) iter.GetOneItem(ent);
44   }
45   return iter;
46 }
47
48     Standard_Boolean  IFSelect_SelectRoots::HasUniqueResult () const
49       {  return Standard_True;  }
50
51     Standard_Boolean  IFSelect_SelectRoots::Sort
52   (const Standard_Integer , const Handle(Standard_Transient)& ,
53    const Handle(Interface_InterfaceModel)& ) const 
54       {  return Standard_True;  }
55
56     TCollection_AsciiString  IFSelect_SelectRoots::ExtractLabel () const 
57       {  return TCollection_AsciiString("Local Roots");  }