b311480e |
1 | -- Created on: 1994-05-27 |
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 TransformStandard from IFSelect inherits Transformer |
18 | |
19 | ---Purpose : This class runs transformations made by Modifiers, as |
20 | -- the ModelCopier does when it produces files (the same set |
21 | -- of Modifiers can then be used, as to transform the starting |
22 | -- Model, as at file sending time). |
23 | -- |
24 | -- First, considering the resulting model, two options : |
25 | -- - modifications are made directly on the starting model |
26 | -- (OnTheSpot option), or |
27 | -- - data are copied by the standard service Copy, only the |
28 | -- remaining (not yet sent in a file) entities are copied |
29 | -- (StandardCopy option) |
30 | -- |
31 | -- If a Selection is set, it forces the list of Entities on which |
32 | -- the Modifiers are applied. Else, each Modifier is considered |
33 | -- its Selection. By default, it is for the whole Model |
34 | -- |
35 | -- Then, the Modifiers are sequentially applied |
36 | -- If at least one Modifier "May Change Graph", or if the option |
37 | -- StandardCopy is selected, the graph will be recomputed |
38 | -- (by the WorkSession, see method RunTransformer) |
39 | -- |
40 | -- Remark that a TransformStandard with option StandardCopy |
41 | -- and no Modifier at all has the effect of computing the |
42 | -- remaining data (those not yet sent in any output file). |
43 | -- Moreover, the Protocol is not changed |
44 | |
45 | uses AsciiString from TCollection, |
46 | CheckIterator, Graph, Protocol from Interface, InterfaceModel, |
47 | CopyTool, CopyControl, |
48 | Selection, Modifier, SequenceOfGeneralModifier |
49 | |
50 | |
51 | is |
52 | |
6e33d3ce |
53 | Create returns TransformStandard; |
7fd59977 |
54 | ---Purpose : Creates a TransformStandard, option StandardCopy, no Modifier |
55 | |
56 | -- Description -- |
57 | |
58 | SetCopyOption (me : mutable; option : Boolean); |
59 | ---Purpose : Sets the Copy option to a new value : |
60 | -- - True for StandardCopy - False for OnTheSpot |
61 | |
62 | CopyOption (me) returns Boolean; |
63 | ---Purpose : Returns the Copy option |
64 | |
65 | SetSelection (me : mutable; sel : Selection); |
66 | ---Purpose : Sets a Selection (or unsets if Null) |
67 | -- This Selection then defines the list of entities on which the |
68 | -- Modifiers will be applied |
69 | -- If it is set, it has priority on Selections of Modifiers |
70 | -- Else, for each Modifier its Selection is evaluated |
71 | -- By default, all the Model is taken |
72 | |
73 | Selection (me) returns Selection; |
74 | ---Purpose : Returns the Selection, Null by default |
75 | |
76 | NbModifiers (me) returns Integer; |
77 | ---Purpose : Returns the count of recorded Modifiers |
78 | |
6e33d3ce |
79 | Modifier (me; num : Integer) returns Modifier; |
7fd59977 |
80 | ---Purpose : Returns a Modifier given its rank in the list |
81 | |
82 | ModifierRank (me; modif : Modifier) returns Integer; |
83 | ---Purpose : Returns the rank of a Modifier in the list, 0 if unknown |
84 | |
6e33d3ce |
85 | AddModifier (me : mutable; modif : Modifier; atnum : Integer = 0) |
7fd59977 |
86 | returns Boolean; |
87 | ---Purpose : Adds a Modifier to the list : |
88 | -- - <atnum> = 0 (default) : at the end of the list |
89 | -- - <atnum> > 0 : at rank <atnum> |
90 | -- Returns True if done, False if <atnum> is out of range |
91 | |
92 | RemoveModifier (me : mutable; modif : Modifier) returns Boolean; |
93 | ---Purpose : Removes a Modifier from the list |
94 | -- Returns True if done, False if <modif> not in the list |
95 | |
96 | RemoveModifier (me : mutable; num : Integer) returns Boolean; |
97 | ---Purpose : Removes a Modifier from the list, given its rank |
98 | -- Returns True if done, False if <num> is out of range |
99 | |
100 | -- Action -- |
101 | |
102 | Perform (me : mutable; G : Graph; protocol : Protocol from Interface; |
103 | checks : in out CheckIterator; |
6e33d3ce |
104 | newmod : out InterfaceModel) returns Boolean; |
7fd59977 |
105 | ---Purpose : Performs the Standard Transformation, by calling Copy then |
106 | -- ApplyModifiers (which can return an error status) |
107 | |
108 | Copy (me; G : Graph; TC : in out CopyTool; |
6e33d3ce |
109 | newmod : out InterfaceModel); |
7fd59977 |
110 | ---Purpose : This the first operation. It calls StandardCopy or OnTheSpot |
111 | -- according the option |
112 | |
113 | StandardCopy (me; G : Graph; TC : in out CopyTool; |
6e33d3ce |
114 | newmod : out InterfaceModel); |
7fd59977 |
115 | ---Purpose : This is the standard action of Copy : its takes into account |
116 | -- only the remaining entities (noted by Graph Status positive) |
117 | -- and their proper dependances of course. Produces a new model. |
118 | |
119 | OnTheSpot (me; G : Graph; TC : in out CopyTool; |
6e33d3ce |
120 | newmod : out InterfaceModel); |
7fd59977 |
121 | ---Purpose : This is the OnTheSpot action : each entity is bound with ... |
122 | -- itself. The produced model is the same as the starting one. |
123 | |
124 | ApplyModifiers (me; G : Graph; protocol : Protocol from Interface; |
125 | TC : in out CopyTool; checks : in out CheckIterator; |
6e33d3ce |
126 | newmod : out InterfaceModel) returns Boolean; |
7fd59977 |
127 | ---Purpose : Applies the modifiers sequencially. |
128 | -- For each one, prepares required data (if a Selection is |
129 | -- associated as a filter). |
130 | -- For the option OnTheSpot, it determines if the graph may be |
131 | -- changed and updates <newmod> if required |
132 | -- If a Modifier causes an error (check "HasFailed"), |
133 | -- ApplyModifier stops : the following Modifiers are ignored |
134 | |
6e33d3ce |
135 | Updated (me; entfrom : Transient; entto : out Transient) |
7fd59977 |
136 | returns Boolean; |
137 | ---Purpose : This methods allows to know what happened to a starting |
138 | -- entity after the last Perform. It reads result from the map |
139 | -- which was filled by Perform. |
140 | |
141 | -- Others -- |
142 | |
143 | Label (me) returns AsciiString from TCollection; |
144 | ---Purpose : Returns a text which defines the way a Transformer works : |
145 | -- "On the spot edition" or "Standard Copy" followed by |
146 | -- "<nn> Modifiers" |
147 | |
148 | fields |
149 | |
150 | thecopy : Boolean; |
151 | thesel : Selection; |
152 | themodifs : SequenceOfGeneralModifier; |
153 | themap : CopyControl; |
154 | |
155 | end TransformStandard; |