0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / IFGraph / IFGraph_ExternalSources.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
42cf5bc1 15#include <IFGraph_ExternalSources.hxx>
16#include <Interface_EntityIterator.hxx>
17#include <Interface_Graph.hxx>
18#include <Standard_Transient.hxx>
7fd59977 19
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
23// Les status :
24// - Les entites de depart sont au Status 0
25// - Les entites Sharing NOUVELLES (ExternalSources) sont au Status 1
b311480e 26IFGraph_ExternalSources::IFGraph_ExternalSources
7fd59977 27 (const Interface_Graph& agraph)
28 : thegraph (agraph) { }
29
30
31 void IFGraph_ExternalSources::GetFromEntity
32 (const Handle(Standard_Transient)& ent)
33 { thegraph.GetFromEntity(ent,Standard_True); }
34
35 void IFGraph_ExternalSources::GetFromIter
36 (const Interface_EntityIterator& iter)
37 { thegraph.GetFromIter(iter,0); }
38
39 void IFGraph_ExternalSources::ResetData ()
40 { Reset(); thegraph.Reset(); }
41
42
43 void IFGraph_ExternalSources::Evaluate ()
44{
45 Reset();
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 );
51 }
52 GetFromGraph(thegraph,1);
53}
54
55 Standard_Boolean IFGraph_ExternalSources::IsEmpty ()
56{
57 Evaluate();
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;
62 }
63 return Standard_True;
64}