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 IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Dispatch,MMgt_TShared)
29 void IFSelect_Dispatch::SetRootName
30 (const Handle(TCollection_HAsciiString)& name)
35 Standard_Boolean IFSelect_Dispatch::HasRootName () const
36 { return (!thename.IsNull()); }
38 const Handle(TCollection_HAsciiString)& IFSelect_Dispatch::RootName () const
41 void IFSelect_Dispatch::SetFinalSelection
42 (const Handle(IFSelect_Selection)& sel)
45 Handle(IFSelect_Selection) IFSelect_Dispatch::FinalSelection () const
48 IFSelect_SelectionIterator IFSelect_Dispatch::Selections () const
50 IFSelect_SelectionIterator iter;
51 iter.AddItem(thefinal);
52 for(; iter.More(); iter.Next()) {
53 iter.Value()->FillIterator(iter); // Iterateur qui se court apres
59 Standard_Boolean IFSelect_Dispatch::CanHaveRemainder () const
60 { return Standard_False; }
62 Standard_Boolean IFSelect_Dispatch::LimitedMax
63 (const Standard_Integer , Standard_Integer& max) const
64 { max = 0; return Standard_False; }
66 Interface_EntityIterator IFSelect_Dispatch::GetEntities
67 (const Interface_Graph& G) const
68 { return thefinal->UniqueResult(G); }
70 Interface_EntityIterator IFSelect_Dispatch::Packeted
71 (const Interface_Graph& G) const
73 Interface_EntityIterator total = GetEntities(G);
74 Interface_EntityIterator remain = Remainder(G);
75 if (remain.NbEntities() == 0) return total;
76 // sinon, faire la difference !
77 IFGraph_Compare GC(G);
78 GC.GetFromIter (total, Standard_True);
79 GC.GetFromIter (remain,Standard_False);
80 return GC.FirstOnly();
83 Interface_EntityIterator IFSelect_Dispatch::Remainder
84 (const Interface_Graph& ) const
85 { Interface_EntityIterator iter; return iter; } // par defaut vide