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