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
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 ReShape from BRepTools inherits TShared from MMgt
19 ---Purpose: Rebuilds a Shape by making pre-defined substitutions on some
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)
29 -- Then, these requests may be applied to any shape which may
30 -- contain one or more of these individual shapes
33 ShapeEnum from TopAbs,
35 DataMapOfShapeShape from TopTools
39 Create returns ReShape from BRepTools;
40 ---Purpose: Returns an empty Reshape
42 Clear (me: mutable) is virtual;
43 ---Purpose: Clears all substitutions requests
45 Remove (me: mutable; shape: Shape from TopoDS;
46 oriented: Boolean = Standard_False)
48 ---Purpose: Sets a request to Remove a Shape
49 -- If <oriented> is True, only for a shape with the SAME
50 -- orientation. Else, whatever the orientation
52 Replace (me: mutable; shape, newshape: Shape from TopoDS;
53 oriented: Boolean = Standard_False)
55 ---Purpose: Sets a request to Replace a Shape by a new one
56 -- If <oriented> is True, only if the orientation is the same
57 -- Else, whatever the orientation, and the new shape takes the
58 -- same orientation as <newshape> if the replaced one has the
59 -- same as <shape>, else it is reversed
61 IsRecorded (me; shape: Shape from TopoDS)
62 returns Boolean is virtual;
63 ---Purpose: Tells if a shape is recorded for Replace/Remove
65 Value (me; shape: Shape from TopoDS)
66 returns Shape from TopoDS is virtual;
67 ---Purpose: Returns the new value for an individual shape
68 -- If not recorded, returns the original shape itself
69 -- If to be Removed, returns a Null Shape
70 -- Else, returns the replacing item
72 Status (me: mutable; shape: Shape from TopoDS; newsh: out Shape from TopoDS; last : Boolean = Standard_False)
73 returns Integer is virtual;
74 ---Purpose: Returns a complete substitution status for a shape
75 -- 0 : not recorded, <newsh> = original <shape>
76 -- < 0: to be removed, <newsh> is NULL
77 -- > 0: to be replaced, <newsh> is a new item
78 -- If <last> is False, returns status and new shape recorded in
79 -- the map directly for the shape, if True and status > 0 then
80 -- recursively searches for the last status and new shape.
82 Apply (me: mutable; shape: Shape from TopoDS; until: ShapeEnum from TopAbs; buildmode: Integer)
83 returns Shape from TopoDS is virtual;
84 ---Purpose: Applies the substitutions requests to a shape
86 -- <until> gives the level of type until which requests are taken
87 -- into account. For subshapes of the type <until> no rebuild
88 -- and futher exploring are done.
89 -- ACTUALLY, NOT IMPLEMENTED BELOW TopAbs_FACE
91 -- <buildmode> says how to do on a SOLID,SHELL ... if one of its
92 -- sub-shapes has been changed:
93 -- 0: at least one Replace or Remove -> COMPOUND, else as such
94 -- 1: at least one Remove (Replace are ignored) -> COMPOUND
95 -- 2: Replace and Remove are both ignored
96 -- If Replace/Remove are ignored or absent, the result as same
97 -- type as the starting shape
99 Apply (me: mutable; shape: Shape from TopoDS; until: ShapeEnum from TopAbs = TopAbs_SHAPE)
100 returns Shape from TopoDS is virtual;
101 ---Purpose: Applies the substitutions requests to a shape.
103 -- <until> gives the level of type until which requests are taken
104 -- into account. For subshapes of the type <until> no rebuild
105 -- and futher exploring are done.
107 -- NOTE: each subshape can be replaced by shape of the same type
108 -- or by shape containing only shapes of that type (for
109 -- example, TopoDS_Edge can be replaced by TopoDS_Edge,
110 -- TopoDS_Wire or TopoDS_Compound containing TopoDS_Edges).
111 -- If incompatible shape type is encountered, it is ignored
112 -- and flag FAIL1 is set in Status.
114 ModeConsiderLocation(me: mutable)
115 returns Boolean is virtual;
117 ---Purpose:Returns (modifiable) the flag which defines whether Location of shape take into account
118 -- during replacing shapes.
120 ModeConsiderOrientation(me: mutable)
121 returns Boolean is virtual;
123 ---Purpose:Returns (modifiable) the flag which defines whether Orientation of shape take into account
124 -- during replacing shapes.
128 myNMap: DataMapOfShapeShape from TopTools is protected; -- normal case
129 myRMap: DataMapOfShapeShape from TopTools is protected; -- REVERSED
130 myStatus: Integer is protected; -- error status
131 myConsiderLocation : Boolean;
132 myConsiderOrientation : Boolean;