b311480e |
1 | -- Created on: 1998-06-03 |
2 | -- Created by: data exchange team |
3 | -- Copyright (c) 1998-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | class ReShape from ShapeBuild inherits ReShape from BRepTools |
24 | |
25 | ---Purpose: Rebuilds a Shape by making pre-defined substitutions on some |
26 | -- of its components |
27 | -- |
28 | -- In a first phase, it records requests to replace or remove |
29 | -- some individual shapes |
30 | -- For each shape, the last given request is recorded |
31 | -- Requests may be applied "Oriented" (i.e. only to an item with |
32 | -- the SAME orientation) or not (the orientation of replacing |
33 | -- shape is respectful of that of the original one) |
34 | -- |
35 | -- Then, these requests may be applied to any shape which may |
36 | -- contain one or more of these individual shapes |
37 | |
38 | uses |
39 | ShapeEnum from TopAbs, |
40 | Shape from TopoDS, |
41 | Status from ShapeExtend |
42 | |
43 | is |
44 | |
45 | Create returns mutable ReShape from ShapeBuild; |
46 | ---Purpose: Returns an empty Reshape |
47 | |
48 | Apply (me: mutable; shape: Shape from TopoDS; until: ShapeEnum from TopAbs; buildmode: Integer) |
49 | returns Shape from TopoDS is redefined; |
50 | ---Purpose: Applies the substitutions requests to a shape |
51 | -- |
52 | -- <until> gives the level of type until which requests are taken |
53 | -- into account. For subshapes of the type <until> no rebuild |
54 | -- and futher exploring are done. |
55 | -- ACTUALLY, NOT IMPLEMENTED BELOW TopAbs_FACE |
56 | -- |
57 | -- <buildmode> says how to do on a SOLID,SHELL ... if one of its |
58 | -- sub-shapes has been changed: |
59 | -- 0: at least one Replace or Remove -> COMPOUND, else as such |
60 | -- 1: at least one Remove (Replace are ignored) -> COMPOUND |
61 | -- 2: Replace and Remove are both ignored |
62 | -- If Replace/Remove are ignored or absent, the result as same |
63 | -- type as the starting shape |
64 | |
65 | Apply (me: mutable; shape: Shape from TopoDS; until: ShapeEnum from TopAbs = TopAbs_SHAPE) |
66 | returns Shape from TopoDS is redefined; |
67 | ---Purpose: Applies the substitutions requests to a shape. |
68 | -- |
69 | -- <until> gives the level of type until which requests are taken |
70 | -- into account. For subshapes of the type <until> no rebuild |
71 | -- and futher exploring are done. |
72 | -- |
73 | -- NOTE: each subshape can be replaced by shape of the same type |
74 | -- or by shape containing only shapes of that type (for |
75 | -- example, TopoDS_Edge can be replaced by TopoDS_Edge, |
76 | -- TopoDS_Wire or TopoDS_Compound containing TopoDS_Edges). |
77 | -- If incompatible shape type is encountered, it is ignored |
78 | -- and flag FAIL1 is set in Status. |
79 | |
80 | Status (me: mutable; shape: Shape from TopoDS; newsh: out Shape from TopoDS; last : Boolean = Standard_False) |
81 | returns Integer is redefined; |
82 | ---Purpose: Returns a complete substitution status for a shape |
83 | -- 0 : not recorded, <newsh> = original <shape> |
84 | -- < 0: to be removed, <newsh> is NULL |
85 | -- > 0: to be replaced, <newsh> is a new item |
86 | -- If <last> is False, returns status and new shape recorded in |
87 | -- the map directly for the shape, if True and status > 0 then |
88 | -- recursively searches for the last status and new shape. |
89 | |
90 | Status (me; status: Status from ShapeExtend) returns Boolean; |
91 | ---Purpose: Queries the status of last call to Apply(shape,enum) |
92 | -- OK : no (sub)shapes replaced or removed |
93 | -- DONE1: source (starting) shape replaced |
94 | -- DONE2: source (starting) shape removed |
95 | -- DONE3: some subshapes replaced |
96 | -- DONE4: some subshapes removed |
97 | -- FAIL1: some replacements not done because of bad type of subshape |
98 | |
99 | end ReShape; |