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