0025367: IGES and BRep persistence - support unicode file names on Windows
[occt.git] / src / IFSelect / IFSelect_SelectRootComps.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14#include <IFSelect_SelectRootComps.ixx>
15#include <IFGraph_StrongComponants.hxx>
16#include <IFGraph_Cumulate.hxx>
17
18
b311480e 19IFSelect_SelectRootComps::IFSelect_SelectRootComps () { }
7fd59977 20
21
22// Refait pour travailler en une fois
23// ATTENTION, il ne faut pas s interesser aux ENTITES mais aux COMPOSANTS
24// c-a-d gerer les CYCLES s il y en a
25
26 Interface_EntityIterator IFSelect_SelectRootComps::RootResult
27 (const Interface_Graph& G) const
28{
29 Interface_EntityIterator IEIinput = InputResult(G);
30 Interface_EntityIterator iter;
31// ICI, extraire les Componants, puis considerer une Entite de chacun
32 IFGraph_StrongComponants comps(G,Standard_False);
33 comps.SetLoad();
34 comps.GetFromIter(IEIinput);
35 Interface_EntityIterator inp1; // IEIinput reduit a une Entite par Composant
36
37 IFGraph_Cumulate GC(G);
38
39// On note dans le graphe : le cumul de chaque ensemble (Entite + Shared tous
40// niveaux). Les Roots initiales comptees une seule fois sont bonnes
41// Pour Entite : une par Componant (peu importe)
42 for (comps.Start(); comps.More(); comps.Next()) {
43 Handle(Standard_Transient) ent = comps.FirstEntity();
44 GC.GetFromEntity(ent);
45 inp1.GetOneItem(ent);
46 }
47// A present, on retient, parmi les inputs, celles comptees une seule fois
48// (N.B.: on prend inp1, qui donne UNE entite par composant, simple ou cycle)
49 for (inp1.Start(); inp1.More(); inp1.Next()) {
50 Handle(Standard_Transient) ent = inp1.Value();
51 if ((Standard_Boolean)(GC.NbTimes(ent) <= 1) == IsDirect()) iter.GetOneItem(ent);
52 }
53 return iter;
54}
55
56 Standard_Boolean IFSelect_SelectRootComps::HasUniqueResult () const
57 { return Standard_True; }
58
59
60 Standard_Boolean IFSelect_SelectRootComps::Sort
61 (const Standard_Integer , const Handle(Standard_Transient)& ,
62 const Handle(Interface_InterfaceModel)& ) const
63 { return Standard_True; }
64
65 TCollection_AsciiString IFSelect_SelectRootComps::ExtractLabel () const
66{ return TCollection_AsciiString("Local Root Componants"); }