Open CASCADE Technology 7.8.2.dev
ShapeBuild_ReShape Class Reference

Rebuilds a Shape by making pre-defined substitutions on some of its components. More...

#include <ShapeBuild_ReShape.hxx>

Inheritance diagram for ShapeBuild_ReShape:

Public Member Functions

 ShapeBuild_ReShape ()
 Returns an empty Reshape.
 
virtual TopoDS_Shape Apply (const TopoDS_Shape &shape, const TopAbs_ShapeEnum until, const Standard_Integer buildmode)
 Applies the substitutions requests to a shape.
 
virtual TopoDS_Shape Apply (const TopoDS_Shape &shape, const TopAbs_ShapeEnum until=TopAbs_SHAPE) override
 Applies the substitutions requests to a shape.
 
virtual Standard_Integer Status (const TopoDS_Shape &shape, TopoDS_Shape &newsh, const Standard_Boolean last=Standard_False) override
 Returns a complete substitution status for a shape 0 : not recorded, <newsh> = original <shape> < 0: to be removed, <newsh> is NULL.
 
virtual Standard_Boolean Status (const ShapeExtend_Status status) const
 Queries the status of last call to Apply(shape,enum) OK : no (sub)shapes replaced or removed DONE1: source (starting) shape replaced DONE2: source (starting) shape removed DONE3: some subshapes replaced DONE4: some subshapes removed FAIL1: some replacements not done because of bad type of subshape.
 
- Public Member Functions inherited from BRepTools_ReShape
 BRepTools_ReShape ()
 Returns an empty Reshape.
 
virtual void Clear ()
 Clears all substitutions requests.
 
virtual void Remove (const TopoDS_Shape &shape)
 Sets a request to Remove a Shape whatever the orientation.
 
virtual void Replace (const TopoDS_Shape &shape, const TopoDS_Shape &newshape)
 Sets a request to Replace a Shape by a new one.
 
template<typename TCollection >
void Merge (const TCollection &theParts, const TopoDS_Shape &theProduct)
 Merges the parts to the single product. The first part is replaced by the product. The other parts are removed. The history of the merged shapes is presented by equal ways.
 
virtual Standard_Boolean IsRecorded (const TopoDS_Shape &shape) const
 Tells if a shape is recorded for Replace/Remove.
 
virtual TopoDS_Shape Value (const TopoDS_Shape &shape) const
 Returns the new value for an individual shape If not recorded, returns the original shape itself If to be Removed, returns a Null Shape Else, returns the replacing item.
 
virtual Standard_BooleanModeConsiderLocation ()
 Returns (modifiable) the flag which defines whether Location of shape take into account during replacing shapes.
 
TopoDS_Vertex CopyVertex (const TopoDS_Vertex &theV, const Standard_Real theTol=-1.0)
 Returns modified copy of vertex if original one is not recorded or returns modified original vertex otherwise.
 
TopoDS_Vertex CopyVertex (const TopoDS_Vertex &theV, const gp_Pnt &theNewPos, const Standard_Real aTol)
 Returns modified copy of vertex if original one is not recorded or returns modified original vertex otherwise.
 
Standard_Boolean IsNewShape (const TopoDS_Shape &theShape) const
 Checks if shape has been recorded by reshaper as a value.
 
Handle< BRepTools_HistoryHistory () const
 Returns the history of the substituted shapes.
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
Standard_Integer GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object.
 
Standard_Integer DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const char * get_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 
- Protected Types inherited from BRepTools_ReShape
enum  TReplacementKind { TReplacementKind_Remove = 1 , TReplacementKind_Modify = 2 , TReplacementKind_Merge_Main = 4 , TReplacementKind_Merge_Ordinary = 8 }
 The kinds of the replacements. More...
 
- Protected Member Functions inherited from BRepTools_ReShape
virtual void replace (const TopoDS_Shape &shape, const TopoDS_Shape &newshape, const TReplacementKind theKind)
 Replaces the first shape by the second one after the following reorientation.
 
- Protected Attributes inherited from BRepTools_ReShape
TopTools_MapOfShape myNewShapes
 
Standard_Integer myStatus
 

Detailed Description

Rebuilds a Shape by making pre-defined substitutions on some of its components.

In a first phase, it records requests to replace or remove some individual shapes For each shape, the last given request is recorded Requests may be applied "Oriented" (i.e. only to an item with the SAME orientation) or not (the orientation of replacing shape is respectful of that of the original one)

Then, these requests may be applied to any shape which may contain one or more of these individual shapes

Constructor & Destructor Documentation

◆ ShapeBuild_ReShape()

ShapeBuild_ReShape::ShapeBuild_ReShape ( )

Returns an empty Reshape.

Member Function Documentation

◆ Apply() [1/2]

virtual TopoDS_Shape ShapeBuild_ReShape::Apply ( const TopoDS_Shape & shape,
const TopAbs_ShapeEnum until,
const Standard_Integer buildmode )
virtual

Applies the substitutions requests to a shape.

<until> gives the level of type until which requests are taken into account. For subshapes of the type <until> no rebuild and further exploring are done. ACTUALLY, NOT IMPLEMENTED BELOW TopAbs_FACE

<buildmode> says how to do on a SOLID,SHELL ... if one of its sub-shapes has been changed: 0: at least one Replace or Remove -> COMPOUND, else as such 1: at least one Remove (Replace are ignored) -> COMPOUND 2: Replace and Remove are both ignored If Replace/Remove are ignored or absent, the result as same type as the starting shape

◆ Apply() [2/2]

virtual TopoDS_Shape ShapeBuild_ReShape::Apply ( const TopoDS_Shape & shape,
const TopAbs_ShapeEnum until = TopAbs_SHAPE )
overridevirtual

Applies the substitutions requests to a shape.

<until> gives the level of type until which requests are taken into account. For subshapes of the type <until> no rebuild and further exploring are done.

NOTE: each subshape can be replaced by shape of the same type or by shape containing only shapes of that type (for example, TopoDS_Edge can be replaced by TopoDS_Edge, TopoDS_Wire or TopoDS_Compound containing TopoDS_Edges). If incompatible shape type is encountered, it is ignored and flag FAIL1 is set in Status.

Reimplemented from BRepTools_ReShape.

◆ Status() [1/2]

virtual Standard_Boolean ShapeBuild_ReShape::Status ( const ShapeExtend_Status status) const
virtual

Queries the status of last call to Apply(shape,enum) OK : no (sub)shapes replaced or removed DONE1: source (starting) shape replaced DONE2: source (starting) shape removed DONE3: some subshapes replaced DONE4: some subshapes removed FAIL1: some replacements not done because of bad type of subshape.

◆ Status() [2/2]

virtual Standard_Integer ShapeBuild_ReShape::Status ( const TopoDS_Shape & shape,
TopoDS_Shape & newsh,
const Standard_Boolean last = Standard_False )
overridevirtual

Returns a complete substitution status for a shape 0 : not recorded, <newsh> = original <shape> < 0: to be removed, <newsh> is NULL.

‍0: to be replaced, <newsh> is a new item If <last> is False, returns status and new shape recorded in the map directly for the shape, if True and status > 0 then recursively searches for the last status and new shape.

Reimplemented from BRepTools_ReShape.


The documentation for this class was generated from the following file: