7fd59977 |
1 | -- File: IGESSelect_ViewSorter.cdl |
2 | -- Created: Tue May 31 14:56:09 1994 |
3 | -- Author: Christian CAILLET |
4 | -- <cky@bravox> |
5 | ---Copyright: Matra Datavision 1994 |
6 | |
7 | |
8 | class ViewSorter from IGESSelect inherits TShared |
9 | |
10 | ---Purpose : Sorts IGES Entities on the views and drawings. |
11 | -- In a first step, it splits a set of entities according the |
12 | -- different views they are attached to. |
13 | -- Then, packets according single views (+ drawing frames), or |
14 | -- according drawings (which refer to the views) can be determined |
15 | -- |
16 | -- It is a TShared, hence it can be a workomg field of a non- |
17 | -- mutable object (a Dispatch for instance) |
18 | |
19 | uses Transient, HSequenceOfTransient, |
20 | IndexedMapOfTransient, SequenceOfInteger, |
21 | EntityIterator, InterfaceModel, Graph, |
22 | PacketList, IGESEntity, IGESModel |
23 | |
24 | is |
25 | |
26 | Create returns mutable ViewSorter; |
27 | ---Purpose : Creates a ViewSorter, empty. SetModel remains to be called |
28 | |
29 | SetModel (me : mutable; model : IGESModel); |
30 | ---Purpose : Sets the Model (for PacketList) |
31 | |
32 | Clear (me : mutable); |
33 | ---Purpose : Clears recorded data |
34 | |
35 | Add (me : mutable; ent : any Transient) returns Boolean; |
36 | ---Purpose : Adds an item according its type : AddEntity,AddList,AddModel |
37 | |
38 | AddEntity (me : mutable; igesent : any IGESEntity) returns Boolean; |
39 | ---Purpose : Adds an IGES entity. Records the view it is attached to. |
40 | -- Records directly <ent> if it is a ViewKindEntity or a Drawing |
41 | -- Returns True if added, False if already in the map |
42 | |
43 | AddList (me : mutable; list : HSequenceOfTransient); |
44 | ---Purpose : Adds a list of entities by adding each of the items |
45 | |
46 | AddModel (me : mutable; model : InterfaceModel); |
47 | ---Purpose : Adds all the entities contained in a Model |
48 | |
49 | NbEntities (me) returns Integer; |
50 | ---Purpose : Returns the count of already recorded |
51 | |
52 | -- Preparations -- |
53 | |
54 | SortSingleViews (me : mutable; alsoframes : Boolean); |
55 | ---Purpose : Prepares the result to keep only sets attached to Single Views |
56 | -- If <alsoframes> is given True, it keeps also the Drawings as |
57 | -- specific sets, in order to get their frames. |
58 | -- Entities attached to no single view are put in Remaining List. |
59 | -- |
60 | -- Result can then be read by the methods NbSets,SetItem,SetList, |
61 | -- RemainingList(final = True) |
62 | |
63 | SortDrawings (me : mutable; G : Graph); |
64 | ---Purpose : Prepares the result to the sets attached to Drawings : |
65 | -- All the single views referenced by a Drawing become bound to |
66 | -- the set for this Drawing |
67 | -- |
68 | -- Entities or Views which correspond to no Drawing are put into |
69 | -- the Remaining List. |
70 | -- |
71 | -- Result can then be read by the methods NbSets,SetItem,SetList, |
72 | -- RemainingList(final = True) |
73 | |
74 | -- Queries -- |
75 | |
76 | NbSets (me; final : Boolean) returns Integer; |
77 | ---Purpose : Returns the count of sets recorded, one per distinct item. |
78 | -- The Remaining List is not counted. |
79 | -- If <final> is False, the sets are attached to distinct views |
80 | -- determined by the method Add. |
81 | -- If <final> is True, they are the sets determined by the last |
82 | -- call to, either SortSingleViews, or SortDrawings. |
83 | -- |
84 | -- Warning : Drawings directly recorded are also counted as sets, because |
85 | -- of their Frame (which is made of Annotations) |
86 | |
87 | SetItem (me; num : Integer; final : Boolean) returns any IGESEntity; |
88 | ---Purpose : Returns the Item which is attached to a set of entities |
89 | -- For <final> and definition of sets, see method NbSets. |
90 | -- This item can be a kind of View or a Drawing |
91 | |
92 | Sets (me; final : Boolean) returns PacketList; |
93 | ---Purpose : Returns the complete content of the determined Sets, which |
94 | -- include Duplicated and Remaining (duplication 0) lists |
95 | -- For <final> and definition of sets, see method NbSets. |
96 | |
97 | fields |
98 | |
99 | themodel : IGESModel; |
100 | themap : IndexedMapOfTransient; |
101 | theitems : IndexedMapOfTransient; |
102 | thefinals : IndexedMapOfTransient; |
103 | theinditem : SequenceOfInteger; |
104 | theindfin : SequenceOfInteger; |
105 | |
106 | end ViewSorter; |