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