1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <IFGraph_Compare.hxx>
16 #include <IFGraph_SubPartsIterator.hxx>
17 #include <IFSelect_Dispatch.hxx>
18 #include <IFSelect_Selection.hxx>
19 #include <IFSelect_SelectionIterator.hxx>
20 #include <Interface_EntityIterator.hxx>
21 #include <Interface_Graph.hxx>
22 #include <Interface_InterfaceError.hxx>
23 #include <Standard_Type.hxx>
24 #include <TCollection_AsciiString.hxx>
25 #include <TCollection_HAsciiString.hxx>
27 void IFSelect_Dispatch::SetRootName
28 (const Handle(TCollection_HAsciiString)& name)
33 Standard_Boolean IFSelect_Dispatch::HasRootName () const
34 { return (!thename.IsNull()); }
36 const Handle(TCollection_HAsciiString)& IFSelect_Dispatch::RootName () const
39 void IFSelect_Dispatch::SetFinalSelection
40 (const Handle(IFSelect_Selection)& sel)
43 Handle(IFSelect_Selection) IFSelect_Dispatch::FinalSelection () const
46 IFSelect_SelectionIterator IFSelect_Dispatch::Selections () const
48 IFSelect_SelectionIterator iter;
49 iter.AddItem(thefinal);
50 for(; iter.More(); iter.Next()) {
51 iter.Value()->FillIterator(iter); // Iterateur qui se court apres
57 Standard_Boolean IFSelect_Dispatch::CanHaveRemainder () const
58 { return Standard_False; }
60 Standard_Boolean IFSelect_Dispatch::LimitedMax
61 (const Standard_Integer , Standard_Integer& max) const
62 { max = 0; return Standard_False; }
64 Interface_EntityIterator IFSelect_Dispatch::GetEntities
65 (const Interface_Graph& G) const
66 { return thefinal->UniqueResult(G); }
68 Standard_Boolean IFSelect_Dispatch::PacketsCount
69 (const Interface_Graph& , Standard_Integer& pcount) const
70 { pcount = 0; return Standard_False; } // par defaut 0
72 Interface_EntityIterator IFSelect_Dispatch::Packeted
73 (const Interface_Graph& G) const
75 Interface_EntityIterator total = GetEntities(G);
76 Interface_EntityIterator remain = Remainder(G);
77 if (remain.NbEntities() == 0) return total;
78 // sinon, faire la difference !
79 IFGraph_Compare GC(G);
80 GC.GetFromIter (total, Standard_True);
81 GC.GetFromIter (remain,Standard_False);
82 return GC.FirstOnly();
85 Interface_EntityIterator IFSelect_Dispatch::Remainder
86 (const Interface_Graph& ) const
87 { Interface_EntityIterator iter; return iter; } // par defaut vide