Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-06 08:31:56

0001 // Created on: 2012-06-01
0002 // Created by: Eugeny MALTCHIKOV
0003 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _BRepFeat_Builder_HeaderFile
0017 #define _BRepFeat_Builder_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 
0022 #include <BOPAlgo_BOP.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <TopTools_DataMapOfShapeShape.hxx>
0025 #include <TopTools_ListOfShape.hxx>
0026 #include <TopTools_MapOfShape.hxx>
0027 class TopoDS_Shape;
0028 class TopoDS_Face;
0029 
0030 //! Provides a basic tool to implement features topological
0031 //! operations. The main goal of the algorithm is to perform
0032 //! the result of the operation according to the
0033 //! kept parts of the tool.
0034 //! Input data: a) DS;
0035 //! b) The kept parts of the tool;
0036 //! If the map of the kept parts of the tool
0037 //! is not filled boolean operation of the
0038 //! given type will be performed;
0039 //! c) Operation required.
0040 //! Steps: a) Fill myShapes, myRemoved maps;
0041 //! b) Rebuild edges and faces;
0042 //! c) Build images of the object;
0043 //! d) Build the result of the operation.
0044 //! Result: Result shape of the operation required.
0045 class BRepFeat_Builder : public BOPAlgo_BOP
0046 {
0047 public:
0048   DEFINE_STANDARD_ALLOC
0049 
0050   Standard_EXPORT BRepFeat_Builder();
0051   Standard_EXPORT virtual ~BRepFeat_Builder();
0052 
0053   //! Clears internal fields and arguments.
0054   Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
0055 
0056   //! Initializes the object of local boolean operation.
0057   Standard_EXPORT void Init(const TopoDS_Shape& theShape);
0058 
0059   //! Initializes the arguments of local boolean operation.
0060   Standard_EXPORT void Init(const TopoDS_Shape& theShape, const TopoDS_Shape& theTool);
0061 
0062   //! Sets the operation of local boolean operation.
0063   //! If theFuse = 0 than the operation is CUT, otherwise FUSE.
0064   Standard_EXPORT void SetOperation(const Standard_Integer theFuse);
0065 
0066   //! Sets the operation of local boolean operation.
0067   //! If theFlag = TRUE it means that no selection of parts
0068   //! of the tool is needed, t.e. no second part. In that case
0069   //! if theFuse = 0 than operation is COMMON, otherwise CUT21.
0070   //! If theFlag = FALSE SetOperation(theFuse) function  is called.
0071   Standard_EXPORT void SetOperation(const Standard_Integer theFuse, const Standard_Boolean theFlag);
0072 
0073   //! Collects parts of the tool.
0074   Standard_EXPORT void PartsOfTool(TopTools_ListOfShape& theLT);
0075 
0076   //! Initializes parts of the tool for second step of algorithm.
0077   //! Collects shapes and all sub-shapes into myShapes map.
0078   Standard_EXPORT void KeepParts(const TopTools_ListOfShape& theIm);
0079 
0080   //! Adds shape theS and all its sub-shapes into myShapes map.
0081   Standard_EXPORT void KeepPart(const TopoDS_Shape& theS);
0082 
0083   //! Main function to build the result of the
0084   //! local operation required.
0085   Standard_EXPORT void PerformResult(
0086     const Message_ProgressRange& theRange = Message_ProgressRange());
0087 
0088   //! Rebuilds faces in accordance with the kept parts of the tool.
0089   Standard_EXPORT void RebuildFaces();
0090 
0091   //! Rebuilds edges in accordance with the kept parts of the tool.
0092   Standard_EXPORT void RebuildEdge(const TopoDS_Shape&        theE,
0093                                    const TopoDS_Face&         theF,
0094                                    const TopTools_MapOfShape& theME,
0095                                    TopTools_ListOfShape&      aLEIm);
0096 
0097   //! Collects the images of the object, that contains in
0098   //! the images of the tool.
0099   Standard_EXPORT void CheckSolidImages();
0100 
0101   //! Collects the removed parts of the tool into myRemoved map.
0102   Standard_EXPORT void FillRemoved();
0103 
0104   //! Adds the shape S and its sub-shapes into myRemoved map.
0105   Standard_EXPORT void FillRemoved(const TopoDS_Shape& theS, TopTools_MapOfShape& theM);
0106 
0107 protected:
0108   //! Prepares builder of local operation.
0109   Standard_EXPORT virtual void Prepare() Standard_OVERRIDE;
0110 
0111   //! Function is redefined to avoid the usage of removed faces.
0112   Standard_EXPORT virtual void FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids,
0113                                              const Message_ProgressRange&  theRange)
0114     Standard_OVERRIDE;
0115 
0116   //! Avoid the check for open solids and always use the splits
0117   //! of solids for building the result shape.
0118   virtual Standard_Boolean CheckArgsForOpenSolid() Standard_OVERRIDE { return Standard_False; }
0119 
0120   TopTools_MapOfShape myShapes;
0121   TopTools_MapOfShape myRemoved;
0122   Standard_Integer    myFuse;
0123 
0124 private:
0125 };
0126 
0127 #endif // _BRepFeat_Builder_HeaderFile