0024788: Foundation Classes - remove Dico_Dictionary
[occt.git] / src / IGESSelect / IGESSelect_DispPerDrawing.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
42cf5bc1 14
15#include <IFGraph_SubPartsIterator.hxx>
16#include <IFSelect_PacketList.hxx>
7fd59977 17#include <IFSelect_Selection.hxx>
18#include <IGESData_IGESModel.hxx>
42cf5bc1 19#include <IGESSelect_DispPerDrawing.hxx>
20#include <IGESSelect_ViewSorter.hxx>
21#include <Interface_EntityIterator.hxx>
22#include <Interface_Graph.hxx>
7fd59977 23#include <Interface_Macros.hxx>
42cf5bc1 24#include <Standard_Type.hxx>
25#include <TCollection_AsciiString.hxx>
7fd59977 26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_DispPerDrawing,IFSelect_Dispatch)
28
b311480e 29IGESSelect_DispPerDrawing::IGESSelect_DispPerDrawing ()
7fd59977 30 { thesorter = new IGESSelect_ViewSorter; }
31
32 TCollection_AsciiString IGESSelect_DispPerDrawing::Label () const
33{
34 return TCollection_AsciiString("One File per Drawing");
35}
36
37
38 void IGESSelect_DispPerDrawing::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->SortDrawings(G);
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_DispPerDrawing::CanHaveRemainder () const
59 { return Standard_True; }
60
61 Interface_EntityIterator IGESSelect_DispPerDrawing::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->AddList (list.Content());
70 thesorter->SortDrawings(G);
71 }
72 return thesorter->Sets(Standard_True)->Duplicated (0,Standard_False);
73}