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