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 | #include <IFSelect_Dispatch.ixx> |
15 | #include <IFGraph_Compare.hxx> |
16 | |
17 | |
b311480e |
18 | void IFSelect_Dispatch::SetRootName |
7fd59977 |
19 | (const Handle(TCollection_HAsciiString)& name) |
20 | { |
21 | thename = name; |
22 | } |
23 | |
24 | Standard_Boolean IFSelect_Dispatch::HasRootName () const |
25 | { return (!thename.IsNull()); } |
26 | |
27 | const Handle(TCollection_HAsciiString)& IFSelect_Dispatch::RootName () const |
28 | { return thename; } |
29 | |
30 | void IFSelect_Dispatch::SetFinalSelection |
31 | (const Handle(IFSelect_Selection)& sel) |
32 | { thefinal = sel; } |
33 | |
34 | Handle(IFSelect_Selection) IFSelect_Dispatch::FinalSelection () const |
35 | { return thefinal; } |
36 | |
37 | IFSelect_SelectionIterator IFSelect_Dispatch::Selections () const |
38 | { |
39 | IFSelect_SelectionIterator iter; |
40 | iter.AddItem(thefinal); |
41 | for(; iter.More(); iter.Next()) { |
42 | iter.Value()->FillIterator(iter); // Iterateur qui se court apres |
43 | } |
44 | return iter; |
45 | } |
46 | |
47 | |
48 | Standard_Boolean IFSelect_Dispatch::CanHaveRemainder () const |
49 | { return Standard_False; } |
50 | |
51 | Standard_Boolean IFSelect_Dispatch::LimitedMax |
52 | (const Standard_Integer , Standard_Integer& max) const |
53 | { max = 0; return Standard_False; } |
54 | |
55 | Interface_EntityIterator IFSelect_Dispatch::GetEntities |
56 | (const Interface_Graph& G) const |
57 | { return thefinal->UniqueResult(G); } |
58 | |
59 | Standard_Boolean IFSelect_Dispatch::PacketsCount |
60 | (const Interface_Graph& , Standard_Integer& pcount) const |
61 | { pcount = 0; return Standard_False; } // par defaut 0 |
62 | |
63 | Interface_EntityIterator IFSelect_Dispatch::Packeted |
64 | (const Interface_Graph& G) const |
65 | { |
66 | Interface_EntityIterator total = GetEntities(G); |
67 | Interface_EntityIterator remain = Remainder(G); |
68 | if (remain.NbEntities() == 0) return total; |
69 | // sinon, faire la difference ! |
70 | IFGraph_Compare GC(G); |
71 | GC.GetFromIter (total, Standard_True); |
72 | GC.GetFromIter (remain,Standard_False); |
73 | return GC.FirstOnly(); |
74 | } |
75 | |
76 | Interface_EntityIterator IFSelect_Dispatch::Remainder |
77 | (const Interface_Graph& ) const |
78 | { Interface_EntityIterator iter; return iter; } // par defaut vide |