Integration of OCCT 6.5.0 from SVN
[occt.git] / src / IGESSelect / IGESSelect_DispPerSingleView.cxx
1 #include <IGESSelect_DispPerSingleView.ixx>
2 #include <IFSelect_Selection.hxx>
3 #include <IGESData_IGESModel.hxx>
4 #include <IFSelect_PacketList.hxx>
5 #include <Interface_Macros.hxx>
6
7
8     IGESSelect_DispPerSingleView::IGESSelect_DispPerSingleView ()
9       {  thesorter = new IGESSelect_ViewSorter;  }
10
11     TCollection_AsciiString  IGESSelect_DispPerSingleView::Label () const
12 {
13   return TCollection_AsciiString("One File per single View or Drawing Frame");
14 }
15
16
17     void  IGESSelect_DispPerSingleView::Packets
18   (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
19 {
20   if (FinalSelection().IsNull()) return;
21   Interface_EntityIterator list = FinalSelection()->UniqueResult(G);
22   thesorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
23   thesorter->Clear();
24   thesorter->AddList (list.Content());
25   thesorter->SortSingleViews(Standard_True);
26   Handle(IFSelect_PacketList) sets = thesorter->Sets(Standard_True);
27
28   packs.SetLoad();
29   Standard_Integer nb = sets->NbPackets();
30   for (Standard_Integer i = 1; i <= nb; i ++) {
31     packs.AddPart();
32     packs.GetFromIter (sets->Entities(i));
33   }
34 }
35
36
37     Standard_Boolean  IGESSelect_DispPerSingleView::CanHaveRemainder () const
38       {  return Standard_True;  }
39
40     Interface_EntityIterator  IGESSelect_DispPerSingleView::Remainder
41   (const Interface_Graph& G) const
42 {
43   if (thesorter->NbEntities() == 0) {
44     Interface_EntityIterator list;
45     if (FinalSelection().IsNull()) return list;
46     list = FinalSelection()->UniqueResult(G);
47     thesorter->Clear();
48     thesorter->Add (list.Content());
49     thesorter->SortSingleViews(Standard_True);
50   }
51   return thesorter->Sets(Standard_True)->Duplicated (0,Standard_False);
52 }