Warnings on vc14 were eliminated
[occt.git] / src / IGESSelect / IGESSelect_DispPerSingleView.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <IFGraph_SubPartsIterator.hxx>
16 #include <IFSelect_PacketList.hxx>
17 #include <IFSelect_Selection.hxx>
18 #include <IGESData_IGESModel.hxx>
19 #include <IGESSelect_DispPerSingleView.hxx>
20 #include <IGESSelect_ViewSorter.hxx>
21 #include <Interface_EntityIterator.hxx>
22 #include <Interface_Graph.hxx>
23 #include <Interface_Macros.hxx>
24 #include <Standard_Type.hxx>
25 #include <TCollection_AsciiString.hxx>
26
27 IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_DispPerSingleView,IFSelect_Dispatch)
28
29 IGESSelect_DispPerSingleView::IGESSelect_DispPerSingleView ()
30       {  thesorter = new IGESSelect_ViewSorter;  }
31
32     TCollection_AsciiString  IGESSelect_DispPerSingleView::Label () const
33 {
34   return TCollection_AsciiString("One File per single View or Drawing Frame");
35 }
36
37
38     void  IGESSelect_DispPerSingleView::Packets
39   (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
40 {
41   if (FinalSelection().IsNull()) return;
42   Interface_EntityIterator list = FinalSelection()->UniqueResult(G);
43   thesorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
44   thesorter->Clear();
45   thesorter->AddList (list.Content());
46   thesorter->SortSingleViews(Standard_True);
47   Handle(IFSelect_PacketList) sets = thesorter->Sets(Standard_True);
48
49   packs.SetLoad();
50   Standard_Integer nb = sets->NbPackets();
51   for (Standard_Integer i = 1; i <= nb; i ++) {
52     packs.AddPart();
53     packs.GetFromIter (sets->Entities(i));
54   }
55 }
56
57
58     Standard_Boolean  IGESSelect_DispPerSingleView::CanHaveRemainder () const
59       {  return Standard_True;  }
60
61     Interface_EntityIterator  IGESSelect_DispPerSingleView::Remainder
62   (const Interface_Graph& G) const
63 {
64   if (thesorter->NbEntities() == 0) {
65     Interface_EntityIterator list;
66     if (FinalSelection().IsNull()) return list;
67     list = FinalSelection()->UniqueResult(G);
68     thesorter->Clear();
69     thesorter->Add (list.Content());
70     thesorter->SortSingleViews(Standard_True);
71   }
72   return thesorter->Sets(Standard_True)->Duplicated (0,Standard_False);
73 }