0024428: Implementation of LGPL license
[occt.git] / src / IFGraph / IFGraph_Compare.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and / or modify it
6 // under the terms of the GNU Lesser General Public 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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #include <IFGraph_Compare.ixx>
15 #include <IFGraph_AllShared.hxx>
16
17
18
19 //  Comparateur de deux sous-ensembles d un Modele
20 //  Au premier  sous-ensemble, est attribue le Status 1
21 //  Au deuxieme sous-ensemble, est attribue le Status 2
22 //  La partie commune se voit attribuer le Status 3
23
24 IFGraph_Compare::IFGraph_Compare (const Interface_Graph& agraph)
25       : thegraph (agraph)    {  }
26
27     void  IFGraph_Compare::GetFromEntity
28   (const Handle(Standard_Transient)& ent, const Standard_Boolean first)
29 {
30   IFGraph_AllShared iter(thegraph.Model(),ent);
31   GetFromIter(iter,first);
32 }
33
34     void  IFGraph_Compare::GetFromIter
35   (const Interface_EntityIterator& iter, const Standard_Boolean first)
36 {
37   Standard_Integer stat = 2;
38   if (first) stat = 1;
39   thegraph.GetFromIter(iter,stat,3,Standard_False);
40 }
41
42
43     void  IFGraph_Compare::Merge ()
44 {
45   thegraph.ChangeStatus (2,1);
46   thegraph.ChangeStatus (3,1);
47 }
48
49     void  IFGraph_Compare::RemoveSecond ()
50 {
51   thegraph.ChangeStatus (3,1);
52   thegraph.RemoveStatus (2);
53 }
54
55     void  IFGraph_Compare::KeepCommon ()
56 {
57   thegraph.RemoveStatus (1);
58   thegraph.RemoveStatus (2);
59   thegraph.ChangeStatus (3,1);
60 }
61
62     void  IFGraph_Compare::ResetData ()
63       {  Reset();  thegraph.Reset();  }
64
65     void  IFGraph_Compare::Evaluate ()
66 {
67   Reset();  GetFromGraph(thegraph);  // Evaluation deja faite par le graphe
68 }
69
70     Interface_EntityIterator  IFGraph_Compare::Common () const
71       {  return Interface_GraphContent(thegraph,3);  }
72
73     Interface_EntityIterator  IFGraph_Compare::FirstOnly () const 
74       {  return Interface_GraphContent(thegraph,1);  }
75
76     Interface_EntityIterator  IFGraph_Compare::SecondOnly () const 
77       {  return Interface_GraphContent(thegraph,2);  }