0031501: Foundation Classes, Message_Printer - remove theToPutEndl argument -- prepar...
[occt.git] / src / IGESSelect / IGESSelect_ViewSorter.hxx
1 // Created on: 1994-05-31
2 // Created by: Christian CAILLET
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _IGESSelect_ViewSorter_HeaderFile
18 #define _IGESSelect_ViewSorter_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <TColStd_IndexedMapOfTransient.hxx>
24 #include <TColStd_SequenceOfInteger.hxx>
25 #include <Standard_Transient.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <TColStd_HSequenceOfTransient.hxx>
28 #include <Standard_Integer.hxx>
29 class IGESData_IGESModel;
30 class Standard_Transient;
31 class IGESData_IGESEntity;
32 class Interface_InterfaceModel;
33 class Interface_Graph;
34 class IFSelect_PacketList;
35
36
37 class IGESSelect_ViewSorter;
38 DEFINE_STANDARD_HANDLE(IGESSelect_ViewSorter, Standard_Transient)
39
40 //! Sorts IGES Entities on the views and drawings.
41 //! In a first step, it splits a set of entities according the
42 //! different views they are attached to.
43 //! Then, packets according single views (+ drawing frames), or
44 //! according drawings (which refer to the views) can be determined
45 //!
46 //! It is a TShared, hence it can be a workomg field of a non-
47 //! mutable object (a Dispatch for instance)
48 class IGESSelect_ViewSorter : public Standard_Transient
49 {
50
51 public:
52
53   
54   //! Creates a ViewSorter, empty. SetModel remains to be called
55   Standard_EXPORT IGESSelect_ViewSorter();
56   
57   //! Sets the Model (for PacketList)
58   Standard_EXPORT void SetModel (const Handle(IGESData_IGESModel)& model);
59   
60   //! Clears recorded data
61   Standard_EXPORT void Clear();
62   
63   //! Adds an item according its type : AddEntity,AddList,AddModel
64   Standard_EXPORT Standard_Boolean Add (const Handle(Standard_Transient)& ent);
65   
66   //! Adds an IGES entity. Records the view it is attached to.
67   //! Records directly <ent> if it is a ViewKindEntity or a Drawing
68   //! Returns True if added, False if already in the map
69   Standard_EXPORT Standard_Boolean AddEntity (const Handle(IGESData_IGESEntity)& igesent);
70   
71   //! Adds a list of entities by adding each of the items
72   Standard_EXPORT void AddList (const Handle(TColStd_HSequenceOfTransient)& list);
73   
74   //! Adds all the entities contained in a Model
75   Standard_EXPORT void AddModel (const Handle(Interface_InterfaceModel)& model);
76   
77   //! Returns the count of already recorded
78   Standard_EXPORT Standard_Integer NbEntities() const;
79   
80   //! Prepares the result to keep only sets attached to Single Views
81   //! If <alsoframes> is given True, it keeps also the Drawings as
82   //! specific sets, in order to get their frames.
83   //! Entities attached to no single view are put in Remaining List.
84   //!
85   //! Result can then be read by the methods NbSets,SetItem,SetList,
86   //! RemainingList(final = True)
87   Standard_EXPORT void SortSingleViews (const Standard_Boolean alsoframes);
88   
89   //! Prepares the result to the sets attached to Drawings :
90   //! All the single views referenced by a Drawing become bound to
91   //! the set for this Drawing
92   //!
93   //! Entities or Views which correspond to no Drawing are put into
94   //! the Remaining List.
95   //!
96   //! Result can then be read by the methods NbSets,SetItem,SetList,
97   //! RemainingList(final = True)
98   Standard_EXPORT void SortDrawings (const Interface_Graph& G);
99   
100   //! Returns the count of sets recorded, one per distinct item.
101   //! The Remaining List is not counted.
102   //! If <final> is False, the sets are attached to distinct views
103   //! determined by the method Add.
104   //! If <final> is True, they are the sets determined by the last
105   //! call to, either SortSingleViews, or SortDrawings.
106   //!
107   //! Warning : Drawings directly recorded are also counted as sets, because
108   //! of their Frame (which is made of Annotations)
109   Standard_EXPORT Standard_Integer NbSets (const Standard_Boolean final) const;
110   
111   //! Returns the Item which is attached to a set of entities
112   //! For <final> and definition of sets, see method NbSets.
113   //! This item can be a kind of View or a Drawing
114   Standard_EXPORT Handle(IGESData_IGESEntity) SetItem (const Standard_Integer num, const Standard_Boolean final) const;
115   
116   //! Returns the complete content of the determined Sets, which
117   //! include Duplicated and Remaining (duplication 0) lists
118   //! For <final> and definition of sets, see method NbSets.
119   Standard_EXPORT Handle(IFSelect_PacketList) Sets (const Standard_Boolean final) const;
120
121
122
123
124   DEFINE_STANDARD_RTTIEXT(IGESSelect_ViewSorter,Standard_Transient)
125
126 protected:
127
128
129
130
131 private:
132
133
134   Handle(IGESData_IGESModel) themodel;
135   TColStd_IndexedMapOfTransient themap;
136   TColStd_IndexedMapOfTransient theitems;
137   TColStd_IndexedMapOfTransient thefinals;
138   TColStd_SequenceOfInteger theinditem;
139   TColStd_SequenceOfInteger theindfin;
140
141
142 };
143
144
145
146
147
148
149
150 #endif // _IGESSelect_ViewSorter_HeaderFile