b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | #include <IFSelect_Dispatch.ixx> |
19 | #include <IFGraph_Compare.hxx> |
20 | |
21 | |
b311480e |
22 | void IFSelect_Dispatch::SetRootName |
7fd59977 |
23 | (const Handle(TCollection_HAsciiString)& name) |
24 | { |
25 | thename = name; |
26 | } |
27 | |
28 | Standard_Boolean IFSelect_Dispatch::HasRootName () const |
29 | { return (!thename.IsNull()); } |
30 | |
31 | const Handle(TCollection_HAsciiString)& IFSelect_Dispatch::RootName () const |
32 | { return thename; } |
33 | |
34 | void IFSelect_Dispatch::SetFinalSelection |
35 | (const Handle(IFSelect_Selection)& sel) |
36 | { thefinal = sel; } |
37 | |
38 | Handle(IFSelect_Selection) IFSelect_Dispatch::FinalSelection () const |
39 | { return thefinal; } |
40 | |
41 | IFSelect_SelectionIterator IFSelect_Dispatch::Selections () const |
42 | { |
43 | IFSelect_SelectionIterator iter; |
44 | iter.AddItem(thefinal); |
45 | for(; iter.More(); iter.Next()) { |
46 | iter.Value()->FillIterator(iter); // Iterateur qui se court apres |
47 | } |
48 | return iter; |
49 | } |
50 | |
51 | |
52 | Standard_Boolean IFSelect_Dispatch::CanHaveRemainder () const |
53 | { return Standard_False; } |
54 | |
55 | Standard_Boolean IFSelect_Dispatch::LimitedMax |
56 | (const Standard_Integer , Standard_Integer& max) const |
57 | { max = 0; return Standard_False; } |
58 | |
59 | Interface_EntityIterator IFSelect_Dispatch::GetEntities |
60 | (const Interface_Graph& G) const |
61 | { return thefinal->UniqueResult(G); } |
62 | |
63 | Standard_Boolean IFSelect_Dispatch::PacketsCount |
64 | (const Interface_Graph& , Standard_Integer& pcount) const |
65 | { pcount = 0; return Standard_False; } // par defaut 0 |
66 | |
67 | Interface_EntityIterator IFSelect_Dispatch::Packeted |
68 | (const Interface_Graph& G) const |
69 | { |
70 | Interface_EntityIterator total = GetEntities(G); |
71 | Interface_EntityIterator remain = Remainder(G); |
72 | if (remain.NbEntities() == 0) return total; |
73 | // sinon, faire la difference ! |
74 | IFGraph_Compare GC(G); |
75 | GC.GetFromIter (total, Standard_True); |
76 | GC.GetFromIter (remain,Standard_False); |
77 | return GC.FirstOnly(); |
78 | } |
79 | |
80 | Interface_EntityIterator IFSelect_Dispatch::Remainder |
81 | (const Interface_Graph& ) const |
82 | { Interface_EntityIterator iter; return iter; } // par defaut vide |