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_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>
27 IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_DispPerSingleView,IFSelect_Dispatch)
29 IGESSelect_DispPerSingleView::IGESSelect_DispPerSingleView ()
30 { thesorter = new IGESSelect_ViewSorter; }
32 TCollection_AsciiString IGESSelect_DispPerSingleView::Label () const
34 return TCollection_AsciiString("One File per single View or Drawing Frame");
38 void IGESSelect_DispPerSingleView::Packets
39 (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
41 if (FinalSelection().IsNull()) return;
42 Interface_EntityIterator list = FinalSelection()->UniqueResult(G);
43 thesorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
45 thesorter->AddList (list.Content());
46 thesorter->SortSingleViews(Standard_True);
47 Handle(IFSelect_PacketList) sets = thesorter->Sets(Standard_True);
50 Standard_Integer nb = sets->NbPackets();
51 for (Standard_Integer i = 1; i <= nb; i ++) {
53 packs.GetFromIter (sets->Entities(i));
58 Standard_Boolean IGESSelect_DispPerSingleView::CanHaveRemainder () const
59 { return Standard_True; }
61 Interface_EntityIterator IGESSelect_DispPerSingleView::Remainder
62 (const Interface_Graph& G) const
64 if (thesorter->NbEntities() == 0) {
65 Interface_EntityIterator list;
66 if (FinalSelection().IsNull()) return list;
67 list = FinalSelection()->UniqueResult(G);
69 thesorter->Add (list.Content());
70 thesorter->SortSingleViews(Standard_True);
72 return thesorter->Sets(Standard_True)->Duplicated (0,Standard_False);