1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <IFGraph_ExternalSources.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <Interface_Graph.hxx>
18 #include <Standard_Transient.hxx>
20 // ExternalSources exploite les resultats stockes dans le Graphe sur Sharings
21 // Soit les "Sharings" des entites notees par GetFromEntity et GetFromIter
22 // Celles des "Sharings" qui n etaient pas deja notees sont ExternalSources
24 // - Les entites de depart sont au Status 0
25 // - Les entites Sharing NOUVELLES (ExternalSources) sont au Status 1
26 IFGraph_ExternalSources::IFGraph_ExternalSources
27 (const Interface_Graph& agraph)
28 : thegraph (agraph) { }
31 void IFGraph_ExternalSources::GetFromEntity
32 (const Handle(Standard_Transient)& ent)
33 { thegraph.GetFromEntity(ent,Standard_True); }
35 void IFGraph_ExternalSources::GetFromIter
36 (const Interface_EntityIterator& iter)
37 { thegraph.GetFromIter(iter,0); }
39 void IFGraph_ExternalSources::ResetData ()
40 { Reset(); thegraph.Reset(); }
43 void IFGraph_ExternalSources::Evaluate ()
46 thegraph.RemoveStatus(1);
47 Standard_Integer nb = thegraph.Size();
48 for (Standard_Integer i = 1; i <= nb; i ++) {
49 if (thegraph.IsPresent(i) && thegraph.Status(i) == 0)
50 thegraph.GetFromIter ( thegraph.Sharings(thegraph.Entity(i)), 1 );
52 GetFromGraph(thegraph,1);
55 Standard_Boolean IFGraph_ExternalSources::IsEmpty ()
58 Standard_Integer nb = thegraph.Size();
59 for (Standard_Integer i = 1; i <= nb; i ++) {
60 if (thegraph.IsPresent(i) || thegraph.Status(i) == 1)
61 return Standard_False;