1 -- Created on: 1994-05-27
2 -- Created by: Christian CAILLET
3 -- Copyright (c) 1994-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class TransformStandard from IFSelect inherits Transformer
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).
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)
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
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)
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
45 uses AsciiString from TCollection,
46 CheckIterator, Graph, Protocol from Interface, InterfaceModel,
47 CopyTool, CopyControl,
48 Selection, Modifier, SequenceOfGeneralModifier
53 Create returns TransformStandard;
54 ---Purpose : Creates a TransformStandard, option StandardCopy, no Modifier
58 SetCopyOption (me : mutable; option : Boolean);
59 ---Purpose : Sets the Copy option to a new value :
60 -- - True for StandardCopy - False for OnTheSpot
62 CopyOption (me) returns Boolean;
63 ---Purpose : Returns the Copy option
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
73 Selection (me) returns Selection;
74 ---Purpose : Returns the Selection, Null by default
76 NbModifiers (me) returns Integer;
77 ---Purpose : Returns the count of recorded Modifiers
79 Modifier (me; num : Integer) returns Modifier;
80 ---Purpose : Returns a Modifier given its rank in the list
82 ModifierRank (me; modif : Modifier) returns Integer;
83 ---Purpose : Returns the rank of a Modifier in the list, 0 if unknown
85 AddModifier (me : mutable; modif : Modifier; atnum : Integer = 0)
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
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
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
102 Perform (me : mutable; G : Graph; protocol : Protocol from Interface;
103 checks : in out CheckIterator;
104 newmod : out InterfaceModel) returns Boolean;
105 ---Purpose : Performs the Standard Transformation, by calling Copy then
106 -- ApplyModifiers (which can return an error status)
108 Copy (me; G : Graph; TC : in out CopyTool;
109 newmod : out InterfaceModel);
110 ---Purpose : This the first operation. It calls StandardCopy or OnTheSpot
111 -- according the option
113 StandardCopy (me; G : Graph; TC : in out CopyTool;
114 newmod : out InterfaceModel);
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.
119 OnTheSpot (me; G : Graph; TC : in out CopyTool;
120 newmod : out InterfaceModel);
121 ---Purpose : This is the OnTheSpot action : each entity is bound with ...
122 -- itself. The produced model is the same as the starting one.
124 ApplyModifiers (me; G : Graph; protocol : Protocol from Interface;
125 TC : in out CopyTool; checks : in out CheckIterator;
126 newmod : out InterfaceModel) returns Boolean;
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
135 Updated (me; entfrom : Transient; entto : out Transient)
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.
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
152 themodifs : SequenceOfGeneralModifier;
153 themap : CopyControl;
155 end TransformStandard;