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_AllShared.hxx>
16 #include <IFGraph_Compare.hxx>
17 #include <Interface_EntityIterator.hxx>
18 #include <Interface_Graph.hxx>
19 #include <Standard_Transient.hxx>
21 // Comparateur de deux sous-ensembles d un Modele
22 // Au premier sous-ensemble, est attribue le Status 1
23 // Au deuxieme sous-ensemble, est attribue le Status 2
24 // La partie commune se voit attribuer le Status 3
25 IFGraph_Compare::IFGraph_Compare (const Interface_Graph& agraph)
26 : thegraph (agraph) { }
28 void IFGraph_Compare::GetFromEntity
29 (const Handle(Standard_Transient)& ent, const Standard_Boolean first)
31 IFGraph_AllShared iter(thegraph.Model(),ent);
32 GetFromIter(iter,first);
35 void IFGraph_Compare::GetFromIter
36 (const Interface_EntityIterator& iter, const Standard_Boolean first)
38 Standard_Integer stat = 2;
40 thegraph.GetFromIter(iter,stat,3,Standard_False);
44 void IFGraph_Compare::Merge ()
46 thegraph.ChangeStatus (2,1);
47 thegraph.ChangeStatus (3,1);
50 void IFGraph_Compare::RemoveSecond ()
52 thegraph.ChangeStatus (3,1);
53 thegraph.RemoveStatus (2);
56 void IFGraph_Compare::KeepCommon ()
58 thegraph.RemoveStatus (1);
59 thegraph.RemoveStatus (2);
60 thegraph.ChangeStatus (3,1);
63 void IFGraph_Compare::ResetData ()
64 { Reset(); thegraph.Reset(); }
66 void IFGraph_Compare::Evaluate ()
68 Reset(); GetFromGraph(thegraph); // Evaluation deja faite par le graphe
71 Interface_EntityIterator IFGraph_Compare::Common () const
72 { return Interface_GraphContent(thegraph,3); }
74 Interface_EntityIterator IFGraph_Compare::FirstOnly () const
75 { return Interface_GraphContent(thegraph,1); }
77 Interface_EntityIterator IFGraph_Compare::SecondOnly () const
78 { return Interface_GraphContent(thegraph,2); }