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 #ifndef _ShapeBuild_ReShape_HeaderFile
18 #define _ShapeBuild_ReShape_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <BRepTools_ReShape.hxx>
24 #include <TopAbs_ShapeEnum.hxx>
25 #include <Standard_Integer.hxx>
26 #include <ShapeExtend_Status.hxx>
29 // resolve name collisions with X11 headers
34 class ShapeBuild_ReShape;
35 DEFINE_STANDARD_HANDLE(ShapeBuild_ReShape, BRepTools_ReShape)
37 //! Rebuilds a Shape by making pre-defined substitutions on some
40 //! In a first phase, it records requests to replace or remove
41 //! some individual shapes
42 //! For each shape, the last given request is recorded
43 //! Requests may be applied "Oriented" (i.e. only to an item with
44 //! the SAME orientation) or not (the orientation of replacing
45 //! shape is respectful of that of the original one)
47 //! Then, these requests may be applied to any shape which may
48 //! contain one or more of these individual shapes
49 class ShapeBuild_ReShape : public BRepTools_ReShape
55 //! Returns an empty Reshape
56 Standard_EXPORT ShapeBuild_ReShape();
58 //! Applies the substitutions requests to a shape
60 //! <until> gives the level of type until which requests are taken
61 //! into account. For subshapes of the type <until> no rebuild
62 //! and further exploring are done.
63 //! ACTUALLY, NOT IMPLEMENTED BELOW TopAbs_FACE
65 //! <buildmode> says how to do on a SOLID,SHELL ... if one of its
66 //! sub-shapes has been changed:
67 //! 0: at least one Replace or Remove -> COMPOUND, else as such
68 //! 1: at least one Remove (Replace are ignored) -> COMPOUND
69 //! 2: Replace and Remove are both ignored
70 //! If Replace/Remove are ignored or absent, the result as same
71 //! type as the starting shape
72 Standard_EXPORT virtual TopoDS_Shape Apply (const TopoDS_Shape& shape, const TopAbs_ShapeEnum until, const Standard_Integer buildmode);
74 //! Applies the substitutions requests to a shape.
76 //! <until> gives the level of type until which requests are taken
77 //! into account. For subshapes of the type <until> no rebuild
78 //! and further exploring are done.
80 //! NOTE: each subshape can be replaced by shape of the same type
81 //! or by shape containing only shapes of that type (for
82 //! example, TopoDS_Edge can be replaced by TopoDS_Edge,
83 //! TopoDS_Wire or TopoDS_Compound containing TopoDS_Edges).
84 //! If incompatible shape type is encountered, it is ignored
85 //! and flag FAIL1 is set in Status.
86 Standard_EXPORT virtual TopoDS_Shape Apply (const TopoDS_Shape& shape, const TopAbs_ShapeEnum until = TopAbs_SHAPE) Standard_OVERRIDE;
88 //! Returns a complete substitution status for a shape
89 //! 0 : not recorded, <newsh> = original <shape>
90 //! < 0: to be removed, <newsh> is NULL
91 //! > 0: to be replaced, <newsh> is a new item
92 //! If <last> is False, returns status and new shape recorded in
93 //! the map directly for the shape, if True and status > 0 then
94 //! recursively searches for the last status and new shape.
95 Standard_EXPORT virtual Standard_Integer Status (const TopoDS_Shape& shape, TopoDS_Shape& newsh, const Standard_Boolean last = Standard_False) Standard_OVERRIDE;
97 //! Queries the status of last call to Apply(shape,enum)
98 //! OK : no (sub)shapes replaced or removed
99 //! DONE1: source (starting) shape replaced
100 //! DONE2: source (starting) shape removed
101 //! DONE3: some subshapes replaced
102 //! DONE4: some subshapes removed
103 //! FAIL1: some replacements not done because of bad type of subshape
104 Standard_EXPORT virtual Standard_Boolean Status (const ShapeExtend_Status status) const;
109 DEFINE_STANDARD_RTTIEXT(ShapeBuild_ReShape,BRepTools_ReShape)
129 #endif // _ShapeBuild_ReShape_HeaderFile