f25a1db559a97f2e1d5793dec40d1530d32c46e6
[occt.git] / src / ShapeBuild / ShapeBuild_ReShape.cdl
1 -- Created on: 1998-06-03
2 -- Created by: data exchange team
3 -- Copyright (c) 1998-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
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.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 class ReShape from ShapeBuild inherits ReShape from BRepTools
18
19     ---Purpose: Rebuilds a Shape by making pre-defined substitutions on some
20     --          of its components
21     --
22     --          In a first phase, it records requests to replace or remove
23     --          some individual shapes
24     --          For each shape, the last given request is recorded
25     --          Requests may be applied "Oriented" (i.e. only to an item with
26     --          the SAME orientation) or not (the orientation of replacing
27     --          shape is respectful of that of the original one)
28     --           
29     --          Then, these requests may be applied to any shape which may
30     --          contain one or more of these individual shapes
31
32 uses 
33     ShapeEnum from TopAbs, 
34     Shape     from TopoDS,
35     Status from ShapeExtend
36
37 is
38
39     Create returns ReShape from ShapeBuild;
40         ---Purpose: Returns an empty Reshape
41
42     Apply (me: mutable; shape: Shape from TopoDS; until: ShapeEnum from TopAbs; buildmode: Integer)
43     returns Shape from TopoDS is redefined;
44         ---Purpose: Applies the substitutions requests to a shape
45         --         
46         --          <until> gives the level of type until which requests are taken
47         --          into account. For subshapes of the type <until> no rebuild 
48         --          and futher exploring are done.
49         --          ACTUALLY, NOT IMPLEMENTED BELOW  TopAbs_FACE
50         --           
51         --          <buildmode> says how to do on a SOLID,SHELL ... if one of its
52         --          sub-shapes has been changed:
53         --          0: at least one Replace or Remove -> COMPOUND, else as such
54         --          1: at least one Remove (Replace are ignored) -> COMPOUND
55         --          2: Replace and Remove are both ignored
56         --          If Replace/Remove are ignored or absent, the result as same
57         --          type as the starting shape
58
59     Apply (me: mutable; shape: Shape from TopoDS; until: ShapeEnum from TopAbs = TopAbs_SHAPE)
60     returns Shape from TopoDS is redefined;
61         ---Purpose: Applies the substitutions requests to a shape.
62         --         
63         --          <until> gives the level of type until which requests are taken
64         --          into account. For subshapes of the type <until> no rebuild 
65         --          and futher exploring are done.
66         --
67         --          NOTE: each subshape can be replaced by shape of the same type
68         --          or by shape containing only shapes of that type (for 
69         --          example, TopoDS_Edge can be replaced by TopoDS_Edge,
70         --          TopoDS_Wire or TopoDS_Compound containing TopoDS_Edges).
71         --          If incompatible shape type is encountered, it is ignored
72         --          and flag FAIL1 is set in Status.
73     
74     Status (me: mutable; shape: Shape from TopoDS; newsh: out Shape from TopoDS; last : Boolean = Standard_False)
75     returns Integer is redefined;
76         ---Purpose: Returns a complete substitution status for a shape
77         --          0  : not recorded,   <newsh> = original <shape>
78         --          < 0: to be removed,  <newsh> is NULL
79         --          > 0: to be replaced, <newsh> is a new item
80         --          If <last> is False, returns status and new shape recorded in
81         --          the map directly for the shape, if True and status > 0 then
82         --          recursively searches for the last status and new shape.
83
84     Status (me; status: Status from ShapeExtend) returns Boolean;
85         ---Purpose: Queries the status of last call to Apply(shape,enum)
86         --          OK   : no (sub)shapes replaced or removed
87         --          DONE1: source (starting) shape replaced
88         --          DONE2: source (starting) shape removed
89         --          DONE3: some subshapes replaced
90         --          DONE4: some subshapes removed
91         --          FAIL1: some replacements not done because of bad type of subshape
92
93 end ReShape;