b311480e |
1 | -- Created on: 1997-03-17 |
2 | -- Created by: Yves FRICAUD |
3 | -- Copyright (c) 1997-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 | package TNaming |
18 | |
19 | ---Purpose: A topological attribute can be seen as a hook |
20 | -- into the topological structure. To this hook, |
21 | -- data can be attached and references defined. |
22 | -- It is used for keeping and access to |
23 | -- topological objects and their evolution. All |
24 | -- topological objects are stored in the one |
25 | -- user-protected TNaming_UsedShapes |
26 | -- attribute at the root label of the data |
27 | -- framework. This attribute contains map with all |
28 | -- topological shapes, used in this document. |
29 | -- To all other labels TNaming_NamedShape |
30 | -- attribute can be added. This attribute contains |
31 | -- references (hooks) to shapes from the |
32 | -- TNaming_UsedShapes attribute and evolution |
33 | -- of these shapes. TNaming_NamedShape |
34 | -- attribute contains a set of pairs of hooks: old |
35 | -- shape and new shape (see the figure below). |
36 | -- It allows not only get the topological shapes by |
37 | -- the labels, but also trace evolution of the |
38 | -- shapes and correctly resolve dependent |
39 | -- shapes by the changed one. |
40 | -- If shape is just-created, then the old shape for |
41 | -- accorded named shape is an empty shape. If |
42 | -- a shape is deleted, then the new shape in this named shape is empty. |
43 | -- Different algorithms may dispose sub-shapes |
44 | -- of the result shape at the individual label depending on necessity: |
45 | -- - If a sub-shape must have some extra attributes (material of |
46 | -- each face or color of each edge). In this case a specific sub-shape is |
47 | -- placed to the separate label (usually, sub-label of the result shape label) |
48 | -- with all attributes of this sub-shape. |
49 | -- - If topological naming is needed, a necessary and sufficient |
50 | -- (for selected sub-shapes identification) set of sub-shapes is |
51 | -- placed to the child labels of the result |
52 | -- shape label. As usual, as far as basic solids and closed shells are |
53 | -- concerned, all faces of the shape are disposed. Edges and vertices |
54 | -- sub-shapes can be identified as intersection of contiguous faces. |
55 | -- Modified/generated shapes may be placed to one named shape and |
56 | -- identified as this named shape and source named shape that also can be |
57 | -- identified with used algorithms. |
58 | -- TNaming_NamedShape may contain a few |
59 | -- pairs of hooks with the same evolution. In this |
60 | -- case topology shape, which belongs to the |
61 | -- named shape, is a compound of new shapes. |
62 | -- The data model contains both the topology |
63 | -- and the hooks, and functions handle both |
64 | -- topological entities and hooks. Consider the |
65 | -- case of a box function, which creates a solid |
66 | -- with six faces and six hooks. Each hook is |
67 | -- attached to a face. If you want, you can also |
68 | -- have this function create hooks for edges and |
69 | -- vertices as well as for faces. For the sake of |
70 | -- simplicity though, let's limit the example. |
71 | -- Not all functions can define explicit hooks for |
72 | -- all topological entities they create, but all |
73 | -- topological entities can be turned into hooks |
74 | -- when necessary. This is where topological naming is necessary. |
75 | |
76 | |
77 | ---Category: GUID |
78 | -- c4ef4200-568f-11d1-8940-080009dc3333 TNaming_NamedShape |
79 | -- c4ef4201-568f-11d1-8940-080009dc3333 TNaming_UsedShapes |
80 | |
81 | |
82 | uses Standard, |
83 | TCollection, |
84 | TColStd, |
85 | TopLoc, |
86 | TopTools, |
87 | TopoDS, |
88 | TDF, |
89 | TopAbs, |
90 | gp |
91 | |
92 | |
93 | is |
94 | ---Category: classes to copy shapes |
95 | -- ====================== |
96 | |
97 | class CopyShape; |
98 | |
99 | class TranslateTool; |
7fd59977 |
100 | |
101 | private class Translator; |
ff8178ef |
102 | |
7fd59977 |
103 | |
104 | ---Category: classes to store shapes and their evolution in the framework |
105 | -- ============================================================ |
106 | |
107 | enumeration Evolution is |
108 | PRIMITIVE, |
109 | GENERATED, |
110 | MODIFY, |
111 | DELETE, |
112 | REPLACE, |
113 | SELECTED |
114 | end Evolution; |
115 | ---Purpose: Defines the type of evolution in old shape - new shape pairs. |
116 | -- The definitions - in the form of the terms of |
117 | -- the enumeration - are needed by the |
118 | -- TNaming_NamedShape attribute and |
119 | -- indicate what entities this attribute records as follows: |
120 | -- - PRIMITIVE |
121 | -- - New entities; in each pair, old shape is a |
122 | -- null shape and new shape is a created |
123 | -- entity. |
124 | -- - GENERATED |
125 | -- - Entities created from other entities; in |
126 | -- each pair, old shape is the generator and |
127 | -- new shape is the created entity. |
128 | -- - MODIFY |
129 | -- - Split or merged entities, in each pair, old |
130 | -- shape is the entity before the operation |
131 | -- and new shape is the new entity after the |
132 | -- operation. |
133 | -- - DELETE |
134 | -- - Deletion of entities; in each pair, old |
135 | -- shape is a deleted entity and new shape is null. |
136 | -- - SELECTED |
137 | -- - Named topological entities; in each pair, |
138 | -- the new shape is a named entity and the |
139 | -- old shape is not used. |
140 | -- |
141 | -- For a split which generates multiple faces, the |
142 | -- attribute will contain many pairs with the same |
143 | -- old shape; for a merge, it will contain many |
144 | -- pairs with the same new shape. |
145 | -- Finally, an example of delete would be a face |
146 | -- removed by a Boolean operation. |
147 | |
148 | class NamedShape; |
ff8178ef |
149 | |
7fd59977 |
150 | |
151 | private class UsedShapes; |
ff8178ef |
152 | |
7fd59977 |
153 | |
154 | |
155 | |
156 | class Builder; |
7fd59977 |
157 | |
158 | class Tool; |
7fd59977 |
159 | |
160 | class Iterator; |
7fd59977 |
161 | |
162 | class NewShapeIterator; |
7fd59977 |
163 | |
164 | class OldShapeIterator; |
7fd59977 |
165 | |
166 | class SameShapeIterator; |
ff8178ef |
167 | |
7fd59977 |
168 | |
169 | |
df8d3970 |
170 | imported NamedShapeHasher; |
7fd59977 |
171 | |
df8d3970 |
172 | imported MapOfNamedShape; |
173 | |
174 | imported MapIteratorOfMapOfNamedShape; |
175 | |
176 | imported ListOfNamedShape; |
7fd59977 |
177 | |
df8d3970 |
178 | imported ListIteratorOfListOfNamedShape; |
7fd59977 |
179 | |
180 | |
ff8178ef |
181 | ---Category: classes to store selected shape (involve naming algorithm) |
182 | -- ========================================================== |
7fd59977 |
183 | |
184 | |
185 | enumeration NameType is |
186 | ---Purpose: to store naming characteristcs |
187 | UNKNOWN, |
188 | IDENTITY, |
189 | MODIFUNTIL, |
190 | GENERATION, |
191 | INTERSECTION, |
192 | UNION, |
193 | SUBSTRACTION, |
194 | CONSTSHAPE, |
195 | FILTERBYNEIGHBOURGS, |
196 | ORIENTATION, |
1ec8a59e |
197 | WIREIN, |
198 | SHELLIN |
7fd59977 |
199 | end NameType; |
200 | |
201 | class Name; |
7fd59977 |
202 | |
203 | class Naming; |
7fd59977 |
204 | |
205 | class Selector; |
7fd59977 |
206 | |
207 | |
208 | |
209 | ---Category: Private classes for TNaming |
210 | -- =========================== |
211 | |
212 | private class DeltaOnRemoval; |
213 | |
214 | private class DeltaOnModification; |
215 | |
216 | |
217 | pointer PtrAttribute to NamedShape from TNaming; |
218 | |
219 | imported Node; |
220 | |
221 | pointer PtrNode to Node from TNaming; |
222 | |
223 | private class RefShape; |
224 | |
225 | pointer PtrRefShape to RefShape from TNaming; |
226 | |
df8d3970 |
227 | imported DataMapOfShapePtrRefShape; |
228 | |
229 | imported DataMapIteratorOfDataMapOfShapePtrRefShape; |
7fd59977 |
230 | |
231 | |
232 | pointer PtrDataMapOfShapePtrRefShape to DataMapOfShapePtrRefShape from TNaming; |
233 | |
234 | |
235 | ---Category: private classes for ANaming |
236 | -- =========================== |
237 | |
238 | |
239 | private class Scope; |
240 | |
241 | private class Identifier; |
242 | |
243 | private class Localizer; |
244 | |
245 | private class ShapesSet; |
246 | |
247 | private class IteratorOnShapesSet; |
248 | |
df8d3970 |
249 | imported DataMapOfShapeShapesSet; |
250 | |
251 | imported DataMapIteratorOfDataMapOfShapeShapesSet; |
252 | |
253 | imported ListOfMapOfShape; |
7fd59977 |
254 | |
df8d3970 |
255 | imported ListIteratorOfListOfMapOfShape; |
256 | imported ListOfIndexedDataMapOfShapeListOfShape; |
257 | imported ListIteratorOfListOfIndexedDataMapOfShapeListOfShape; |
7fd59977 |
258 | |
259 | |
260 | private class NamingTool; |
261 | |
262 | |
263 | ---Category: package methods for NamedShape |
264 | -- ============================== |
265 | |
266 | Substitute (labelsource : Label from TDF; |
267 | labelcible : Label from TDF; |
268 | mapOldNew : in out DataMapOfShapeShape from TopTools); |
269 | ---Purpose: Subtituter les shapes sur les structures de source |
270 | -- vers cible |
271 | |
272 | |
273 | Update (label : Label from TDF; |
274 | mapOldNew : in out DataMapOfShapeShape from TopTools); |
275 | ---Purpose: Mise a jour des shapes du label et de ses fils en |
276 | -- tenant compte des substitutions decrite par |
277 | -- mapOldNew. |
278 | -- |
279 | -- Warning: le remplacement du shape est fait dans tous |
280 | -- les attributs qui le contiennent meme si ceux |
281 | -- ci ne sont pas associees a des sous-labels de <Label>. |
282 | |
283 | Displace (label : Label from TDF; |
284 | aLocation : Location from TopLoc; |
285 | WithOld : Boolean from Standard = Standard_True); |
286 | ---Purpose: Application de la Location sur les shapes du label |
287 | -- et de ses sous labels. |
288 | |
289 | ChangeShapes (label : Label from TDF; |
290 | M : in out DataMapOfShapeShape from TopTools); |
291 | ---Purpose: Remplace les shapes du label et des sous-labels |
292 | -- par des copies. |
293 | |
294 | Transform (label : Label from TDF; |
295 | aTransformation : Trsf from gp); |
296 | ---Purpose: Application de la transformation sur les shapes du |
297 | -- label et de ses sous labels. |
298 | -- Warning: le remplacement du shape est fait dans tous |
299 | -- les attributs qui le contiennent meme si ceux |
300 | -- ci ne sont pas associees a des sous-labels de <Label>. |
301 | |
302 | |
303 | Replicate (NS : NamedShape from TNaming; |
304 | T : Trsf from gp; |
305 | L : Label from TDF); |
306 | ---Purpose: Replicates the named shape with the transformation <T> |
307 | -- on the label <L> (and sub-labels if necessary) |
308 | -- (TNaming_GENERATED is set) |
309 | |
310 | Replicate (SH : Shape from TopoDS; |
311 | T : Trsf from gp; |
312 | L : Label from TDF); |
313 | ---Purpose: Replicates the shape with the transformation <T> |
314 | -- on the label <L> (and sub-labels if necessary) |
315 | -- (TNaming_GENERATED is set) |
316 | |
317 | |
318 | MakeShape(MS : MapOfShape from TopTools) |
319 | returns Shape from TopoDS; |
320 | ---Purpose: Builds shape from map content |
321 | |
322 | FindUniqueContext(S : Shape from TopoDS; Context : Shape from TopoDS) |
323 | returns Shape from TopoDS; |
324 | ---Purpose: Find unique context of shape <S> |
325 | |
326 | FindUniqueContextSet(S : Shape from TopoDS; Context : Shape from TopoDS; |
327 | Arr : in out HArray1OfShape from TopTools) |
328 | returns Shape from TopoDS; |
329 | ---Purpose: Find unique context of shape <S>,which is pure concatenation |
330 | -- of atomic shapes (Compound). The result is concatenation of |
331 | -- single contexts |
332 | |
333 | SubstituteSShape(accesslabel : Label from TDF; |
334 | From : Shape from TopoDS; |
335 | To : in out Shape from TopoDS) |
336 | returns Boolean from Standard; |
337 | ---Purpose: Subtitutes shape in source structure |
1ec8a59e |
338 | |
339 | |
340 | OuterWire(theFace: Face from TopoDS; theWire: out Wire from TopoDS) |
341 | returns Boolean from Standard; |
342 | --- Purpose: Returns True if outer wire is found and the found wire in <theWire>. |
7fd59977 |
343 | |
1ec8a59e |
344 | OuterShell(theSolid: Solid from TopoDS; theShell: out Shell from TopoDS) |
345 | returns Boolean from Standard; |
346 | --- Purpose: Returns True if outer Shell is found and the found shell in <theShell>. |
347 | |
348 | |
7fd59977 |
349 | |
350 | ---Purpose: Print of TNaming enumeration |
351 | -- ============================= |
352 | |
353 | IDList(anIDList : in out IDList from TDF); |
354 | ---Purpose: Appends to <anIDList> the list of the attributes |
355 | -- IDs of this package. CAUTION: <anIDList> is NOT |
356 | -- cleared before use. |
357 | |
358 | |
359 | Print (EVOL : Evolution from TNaming; S : in out OStream) |
360 | ---Purpose: Prints the evolution <EVOL> as a String on the |
361 | -- Stream <S> and returns <S>. |
362 | ---C++: return & |
363 | returns OStream; |
364 | |
365 | Print (NAME : NameType from TNaming; S : in out OStream) |
366 | ---Purpose: Prints the name of name type <NAME> as a String on |
367 | -- the Stream <S> and returns <S>. |
368 | ---C++: return & |
369 | returns OStream; |
370 | |
371 | Print (ACCESS : Label from TDF; S : in out OStream) |
372 | ---Purpose: Prints the content of UsedShapes private attribute as a String Table on |
373 | -- the Stream <S> and returns <S>. |
374 | ---C++: return & |
375 | returns OStream; |
376 | |
377 | |
378 | end TNaming; |
379 | |