b311480e |
1 | -- Created on: 1994-06-08 |
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 ContextModif from IFSelect |
18 | |
19 | ---Purpose : This class gathers various informations used by Model Modifiers |
20 | -- apart from the target model itself, and the CopyTool which |
21 | -- must be passed directly. |
22 | -- |
23 | -- These informations report to original data : model, entities, |
24 | -- and the selection list if there is one : it allows to query |
25 | -- about such or such starting entity, or result entity, or |
26 | -- iterate on selection list ... |
27 | -- Also data useful for file output are available (because some |
28 | -- Modifiers concern models produced for file output). |
29 | -- |
30 | -- Furthermore, in return, ContextModif can record Checks, either |
31 | -- one for all, or one for each Entity. It supports trace too. |
32 | |
33 | uses Transient, CString, AsciiString from TCollection, |
34 | Graph, InterfaceModel, CopyTool, CopyControl, EntityIterator, |
35 | Protocol from Interface, Check, CheckIterator, GeneralModifier |
36 | |
37 | raises NoSuchObject |
38 | |
39 | is |
40 | |
41 | Create (graph : Graph; TC : CopyTool; filename : CString = "") |
42 | returns ContextModif; |
43 | ---Purpose : Prepares a ContextModif with these informations : |
44 | -- - the graph established from original model (target passed |
45 | -- directly to Modifier) |
46 | -- - the CopyTool which detains the CopyControl, which maps |
47 | -- starting (in original) and result (in target) entities |
48 | -- - an optional file name (for file output) |
49 | -- |
50 | -- Such a ContextModif is considered to be applied on all |
51 | -- transferred entities (no filter active) |
52 | |
53 | Create (graph : Graph; filename : CString = "") |
54 | returns ContextModif; |
55 | ---Purpose : Prepares a ContextModif with these informations : |
56 | -- - the graph established from original model (target passed |
57 | -- directly to Modifier) |
58 | -- - an optional file name (for file output) |
59 | -- Here, no CopyControl, hence all entities are considered equal |
60 | -- as starting and result |
61 | -- |
62 | -- Such a ContextModif is considered to be applied on all |
63 | -- transferred entities (no filter active) |
64 | |
65 | Select (me : in out; list : in out EntityIterator) is static; |
66 | ---Purpose : This method requires ContextModif to be applied with a filter. |
67 | -- If a ModelModifier is defined with a Selection criterium, |
68 | -- the result of this Selection is used as a filter : |
69 | -- - if none of its items has been transferred, the modification |
70 | -- does not apply at all |
71 | -- - else, the Modifier can query for what entities were selected |
72 | -- and what are their results |
73 | -- - if this method is not called before working, the Modifier |
74 | -- has to work on the whole Model |
75 | |
76 | OriginalGraph (me) returns Graph is static; |
77 | ---Purpose : Returns the original Graph (compared to OriginalModel, it |
78 | -- gives more query capabilitites) |
79 | ---C++ : return const & |
80 | |
81 | OriginalModel (me) returns InterfaceModel is static; |
82 | ---Purpose : Returns the original model |
83 | |
84 | SetProtocol (me : in out; proto : Protocol from Interface); |
85 | ---Purpose : Allows to transmit a Protocol as part of a ContextModif |
86 | |
87 | Protocol (me) returns Protocol from Interface; |
88 | ---Purpose : Returns the Protocol (Null if not set) |
89 | |
90 | HasFileName (me) returns Boolean is static; |
91 | ---Purpose : Returns True if a non empty file name has been defined |
92 | |
93 | FileName (me) returns CString is static; |
94 | ---Purpose : Returns File Name (can be empty) |
95 | |
96 | Control (me) returns CopyControl is static; |
97 | ---Purpose : Returns the map for a direct use, if required |
98 | |
99 | IsForNone (me) returns Boolean is static; |
100 | ---Purpose : Returns True if Select has determined that a Modifier may not |
101 | -- be run (filter defined and empty) |
102 | |
103 | IsForAll (me) returns Boolean is static; |
104 | ---Purpose : Returns True if no filter is defined : a Modifier has to work |
105 | -- on all entities of the resulting (target) model |
106 | |
107 | IsTransferred (me; ent : Transient) returns Boolean is static; |
108 | ---Purpose : Returns True if a starting item has been transferred |
109 | |
110 | IsSelected (me; ent : Transient) returns Boolean is static; |
111 | ---Purpose : Returns True if a starting item has been transferred and selected |
112 | |
113 | Search (me; ent : Transient; res : out any Transient) |
114 | returns Boolean is static; |
115 | ---Purpose : Returns True if a starting entity has been transferred, and |
116 | -- the result is in <res>. Returns False else |
117 | -- (direct call to the map) |
118 | |
119 | SelectedOriginal (me) returns EntityIterator is static; |
120 | ---Purpose : Returns the list of original selected items. |
121 | -- See also the iteration |
122 | |
123 | SelectedResult (me) returns EntityIterator is static; |
124 | ---Purpose : Returns the list of resulting counterparts of selected items. |
125 | -- See also the iteration |
126 | |
127 | SelectedCount (me) returns Integer is static; |
128 | ---Purpose : Returns the count of selected and transferred items |
129 | |
130 | |
131 | Start (me : in out) is static; |
132 | ---Purpose : Starts an iteration on selected items. It takes into account |
133 | -- IsForAll/IsForNone, by really iterating on all selected items. |
134 | |
135 | More (me) returns Boolean is static; |
136 | ---Purpose : Returns True until the iteration has finished |
137 | |
138 | Next (me : in out) is static; |
139 | ---Purpose : Advances the iteration |
140 | |
141 | ValueOriginal (me) returns Transient raises NoSuchObject is static; |
142 | ---Purpose : Returns the current selected item in the original model |
143 | |
144 | ValueResult (me) returns any Transient raises NoSuchObject is static; |
145 | ---Purpose : Returns the result counterpart of current selected item |
146 | -- (in the target model) |
147 | |
148 | |
149 | TraceModifier (me : in out; modif : GeneralModifier) is static; |
150 | ---Purpose : Traces the application of a Modifier. Works with default trace |
151 | -- File and Level. Fills the trace if default trace level is at |
152 | -- least 1. Traces the Modifier (its Label) and its Selection if |
153 | -- there is one (its Label). |
154 | -- To be called after Select (because status IsForAll is printed) |
155 | -- Worths to trace a global modification. See also Trace below |
156 | |
157 | Trace (me : in out; mess : CString = "") is static; |
158 | ---Purpose : Traces the modification of the current entity (see above, |
159 | -- ValueOriginal and ValueResult) for default trace level >= 2. |
160 | -- To be called on each indivudual entity really modified |
161 | -- <mess> is an optionnal additional message |
162 | |
163 | AddCheck (me : in out; check : Check) is static; |
164 | ---Purpose : Adds a Check to the CheckList. If it is empty, nothing is done |
165 | -- If it concerns an Entity from the Original Model (by SetEntity) |
166 | -- to which another Check is attached, it is merged to it. |
167 | -- Else, it is added or merged as to GlobalCheck. |
168 | |
169 | AddWarning (me : in out; start : Transient; mess : CString; orig : CString = ""); |
170 | ---Purpose : Adds a Warning Message for an Entity from the original Model |
171 | -- If <start> is not an Entity from the original model (e.g. the |
172 | -- model itself) this message is added to Global Check. |
173 | |
174 | AddFail (me : in out; start : Transient; mess : CString; orig : CString = ""); |
175 | ---Purpose : Adds a Fail Message for an Entity from the original Model |
176 | -- If <start> is not an Entity from the original model (e.g. the |
177 | -- model itself) this message is added to Global Check. |
178 | |
179 | CCheck (me : in out; num : Integer = 0) returns Check; |
180 | ---Purpose : Returns a Check given an Entity number (in the original Model) |
181 | -- by default a Global Check. Creates it the first time. |
182 | -- It can then be acknowledged on the spot, in condition that the |
183 | -- caller works by reference ("Interface_Check& check = ...") |
184 | |
185 | CCheck (me : in out; start : Transient) returns Check; |
186 | ---Purpose : Returns a Check attached to an Entity from the original Model |
187 | -- It can then be acknowledged on the spot, in condition that the |
188 | -- caller works by reference ("Interface_Check& check = ...") |
189 | |
190 | CheckList (me) returns CheckIterator is static; |
191 | ---Purpose : Returns the complete CheckList |
192 | |
193 | fields |
194 | |
195 | thegraf : Graph; |
196 | theprot : Protocol from Interface; |
197 | themap : CopyControl; |
198 | thefile : AsciiString; |
199 | thelist : AsciiString; |
200 | thechek : CheckIterator; |
201 | thesel : Boolean; |
202 | thecurr : Integer; |
203 | thecurt : Integer; |
204 | |
205 | end ContextModif; |