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 | #include <IGESSelect_DispPerDrawing.ixx> |
15 | #include <IFSelect_Selection.hxx> |
16 | #include <IGESData_IGESModel.hxx> |
17 | #include <IFSelect_PacketList.hxx> |
18 | #include <Interface_Macros.hxx> |
19 | |
20 | |
21 | |
b311480e |
22 | IGESSelect_DispPerDrawing::IGESSelect_DispPerDrawing () |
7fd59977 |
23 | { thesorter = new IGESSelect_ViewSorter; } |
24 | |
25 | TCollection_AsciiString IGESSelect_DispPerDrawing::Label () const |
26 | { |
27 | return TCollection_AsciiString("One File per Drawing"); |
28 | } |
29 | |
30 | |
31 | void IGESSelect_DispPerDrawing::Packets |
32 | (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const |
33 | { |
34 | if (FinalSelection().IsNull()) return; |
35 | Interface_EntityIterator list = FinalSelection()->UniqueResult(G); |
36 | thesorter->SetModel (GetCasted(IGESData_IGESModel,G.Model())); |
37 | thesorter->Clear(); |
38 | thesorter->AddList (list.Content()); |
39 | thesorter->SortDrawings(G); |
40 | Handle(IFSelect_PacketList) sets = thesorter->Sets(Standard_True); |
41 | |
42 | packs.SetLoad(); |
43 | Standard_Integer nb = sets->NbPackets(); |
44 | for (Standard_Integer i = 1; i <= nb; i ++) { |
45 | packs.AddPart(); |
46 | packs.GetFromIter (sets->Entities(i)); |
47 | } |
48 | } |
49 | |
50 | |
51 | Standard_Boolean IGESSelect_DispPerDrawing::CanHaveRemainder () const |
52 | { return Standard_True; } |
53 | |
54 | Interface_EntityIterator IGESSelect_DispPerDrawing::Remainder |
55 | (const Interface_Graph& G) const |
56 | { |
57 | if (thesorter->NbEntities() == 0) { |
58 | Interface_EntityIterator list; |
59 | if (FinalSelection().IsNull()) return list; |
60 | list = FinalSelection()->UniqueResult(G); |
61 | thesorter->Clear(); |
62 | thesorter->AddList (list.Content()); |
63 | thesorter->SortDrawings(G); |
64 | } |
65 | return thesorter->Sets(Standard_True)->Duplicated (0,Standard_False); |
66 | } |