0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / IFSelect / IFSelect_Dispatch.cxx
CommitLineData
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>
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>
7fd59977 26
25e59720 27IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Dispatch,Standard_Transient)
92efcf78 28
b311480e 29void IFSelect_Dispatch::SetRootName
7fd59977 30 (const Handle(TCollection_HAsciiString)& name)
31{
32 thename = name;
33}
34
35 Standard_Boolean IFSelect_Dispatch::HasRootName () const
36 { return (!thename.IsNull()); }
37
38 const Handle(TCollection_HAsciiString)& IFSelect_Dispatch::RootName () const
39 { return thename; }
40
41 void IFSelect_Dispatch::SetFinalSelection
42 (const Handle(IFSelect_Selection)& sel)
43 { thefinal = sel; }
44
45 Handle(IFSelect_Selection) IFSelect_Dispatch::FinalSelection () const
46 { return thefinal; }
47
48 IFSelect_SelectionIterator IFSelect_Dispatch::Selections () const
49{
50 IFSelect_SelectionIterator iter;
51 iter.AddItem(thefinal);
52 for(; iter.More(); iter.Next()) {
53 iter.Value()->FillIterator(iter); // Iterateur qui se court apres
54 }
55 return iter;
56}
57
58
59 Standard_Boolean IFSelect_Dispatch::CanHaveRemainder () const
60 { return Standard_False; }
61
62 Standard_Boolean IFSelect_Dispatch::LimitedMax
63 (const Standard_Integer , Standard_Integer& max) const
64 { max = 0; return Standard_False; }
65
66 Interface_EntityIterator IFSelect_Dispatch::GetEntities
67 (const Interface_Graph& G) const
68 { return thefinal->UniqueResult(G); }
69
7fd59977 70 Interface_EntityIterator IFSelect_Dispatch::Packeted
71 (const Interface_Graph& G) const
72{
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();
81}
82
83 Interface_EntityIterator IFSelect_Dispatch::Remainder
84 (const Interface_Graph& ) const
85 { Interface_EntityIterator iter; return iter; } // par defaut vide