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_AllShared.hxx> |
16 | #include <IFGraph_Compare.hxx> |
17 | #include <Interface_EntityIterator.hxx> |
18 | #include <Interface_Graph.hxx> |
19 | #include <Standard_Transient.hxx> |
7fd59977 |
20 | |
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 |
b311480e |
25 | IFGraph_Compare::IFGraph_Compare (const Interface_Graph& agraph) |
7fd59977 |
26 | : thegraph (agraph) { } |
27 | |
28 | void IFGraph_Compare::GetFromEntity |
29 | (const Handle(Standard_Transient)& ent, const Standard_Boolean first) |
30 | { |
31 | IFGraph_AllShared iter(thegraph.Model(),ent); |
32 | GetFromIter(iter,first); |
33 | } |
34 | |
35 | void IFGraph_Compare::GetFromIter |
36 | (const Interface_EntityIterator& iter, const Standard_Boolean first) |
37 | { |
38 | Standard_Integer stat = 2; |
39 | if (first) stat = 1; |
40 | thegraph.GetFromIter(iter,stat,3,Standard_False); |
41 | } |
42 | |
43 | |
44 | void IFGraph_Compare::Merge () |
45 | { |
46 | thegraph.ChangeStatus (2,1); |
47 | thegraph.ChangeStatus (3,1); |
48 | } |
49 | |
50 | void IFGraph_Compare::RemoveSecond () |
51 | { |
52 | thegraph.ChangeStatus (3,1); |
53 | thegraph.RemoveStatus (2); |
54 | } |
55 | |
56 | void IFGraph_Compare::KeepCommon () |
57 | { |
58 | thegraph.RemoveStatus (1); |
59 | thegraph.RemoveStatus (2); |
60 | thegraph.ChangeStatus (3,1); |
61 | } |
62 | |
63 | void IFGraph_Compare::ResetData () |
64 | { Reset(); thegraph.Reset(); } |
65 | |
66 | void IFGraph_Compare::Evaluate () |
67 | { |
68 | Reset(); GetFromGraph(thegraph); // Evaluation deja faite par le graphe |
69 | } |
70 | |
71 | Interface_EntityIterator IFGraph_Compare::Common () const |
72 | { return Interface_GraphContent(thegraph,3); } |
73 | |
74 | Interface_EntityIterator IFGraph_Compare::FirstOnly () const |
75 | { return Interface_GraphContent(thegraph,1); } |
76 | |
77 | Interface_EntityIterator IFGraph_Compare::SecondOnly () const |
78 | { return Interface_GraphContent(thegraph,2); } |