Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:10

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 
0031 //! Provides a basic tool to implement features topological
0032 //! operations. The main goal of the algorithm is to perform
0033 //! the result of the operation according to the
0034 //! kept parts of the tool.
0035 //! Input data: a) DS;
0036 //! b) The kept parts of the tool;
0037 //! If the map of the kept parts of the tool
0038 //! is not filled boolean operation of the
0039 //! given type will be performed;
0040 //! c) Operation required.
0041 //! Steps: a) Fill myShapes, myRemoved maps;
0042 //! b) Rebuild edges and faces;
0043 //! c) Build images of the object;
0044 //! d) Build the result of the operation.
0045 //! Result: Result shape of the operation required.
0046 class BRepFeat_Builder  : public BOPAlgo_BOP
0047 {
0048 public:
0049 
0050   DEFINE_STANDARD_ALLOC
0051 
0052   
0053   Standard_EXPORT BRepFeat_Builder();
0054 Standard_EXPORT virtual ~BRepFeat_Builder();
0055   
0056   //! Clears internal fields and arguments.
0057   Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
0058   
0059   //! Initializes the object of local boolean operation.
0060   Standard_EXPORT void Init (const TopoDS_Shape& theShape);
0061   
0062   //! Initializes the arguments of local boolean operation.
0063   Standard_EXPORT void Init (const TopoDS_Shape& theShape, const TopoDS_Shape& theTool);
0064   
0065   //! Sets the operation of local boolean operation.
0066   //! If theFuse = 0 than the operation is CUT, otherwise FUSE.
0067   Standard_EXPORT void SetOperation (const Standard_Integer theFuse);
0068   
0069   //! Sets the operation of local boolean operation.
0070   //! If theFlag = TRUE it means that no selection of parts
0071   //! of the tool is needed, t.e. no second part. In that case
0072   //! if theFuse = 0 than operation is COMMON, otherwise CUT21.
0073   //! If theFlag = FALSE SetOperation(theFuse) function  is called.
0074   Standard_EXPORT void SetOperation (const Standard_Integer theFuse, const Standard_Boolean theFlag);
0075   
0076   //! Collects parts of the tool.
0077   Standard_EXPORT void PartsOfTool (TopTools_ListOfShape& theLT);
0078   
0079   //! Initializes parts of the tool for second step of algorithm.
0080   //! Collects shapes and all sub-shapes into myShapes map.
0081   Standard_EXPORT void KeepParts (const TopTools_ListOfShape& theIm);
0082   
0083   //! Adds shape theS and all its sub-shapes into myShapes map.
0084   Standard_EXPORT void KeepPart (const TopoDS_Shape& theS);
0085   
0086   //! Main function to build the result of the
0087   //! local operation required.
0088   Standard_EXPORT void PerformResult(const Message_ProgressRange& theRange = Message_ProgressRange());
0089   
0090   //! Rebuilds faces in accordance with the kept parts of the tool.
0091   Standard_EXPORT void RebuildFaces();
0092   
0093   //! Rebuilds edges in accordance with the kept parts of the tool.
0094   Standard_EXPORT void RebuildEdge (const TopoDS_Shape& theE, const TopoDS_Face& theF, const TopTools_MapOfShape& theME, TopTools_ListOfShape& aLEIm);
0095   
0096   //! Collects the images of the object, that contains in
0097   //! the images of the tool.
0098   Standard_EXPORT void CheckSolidImages();
0099   
0100   //! Collects the removed parts of the tool into myRemoved map.
0101   Standard_EXPORT void FillRemoved();
0102   
0103   //! Adds the shape S and its sub-shapes into myRemoved map.
0104   Standard_EXPORT void FillRemoved (const TopoDS_Shape& theS, TopTools_MapOfShape& theM);
0105 
0106 
0107 
0108 
0109 protected:
0110 
0111   //! Prepares builder of local operation.
0112   Standard_EXPORT virtual void Prepare() Standard_OVERRIDE;
0113   
0114   //! Function is redefined to avoid the usage of removed faces.
0115   Standard_EXPORT virtual void FillIn3DParts (TopTools_DataMapOfShapeShape& theDraftSolids,
0116                                               const Message_ProgressRange& theRange) Standard_OVERRIDE;
0117 
0118   //! Avoid the check for open solids and always use the splits
0119   //! of solids for building the result shape.
0120   virtual Standard_Boolean CheckArgsForOpenSolid() Standard_OVERRIDE
0121   {
0122     return Standard_False;
0123   }
0124 
0125 
0126   TopTools_MapOfShape myShapes;
0127   TopTools_MapOfShape myRemoved;
0128   Standard_Integer myFuse;
0129 
0130 
0131 private:
0132 
0133 
0134 
0135 
0136 
0137 };
0138 
0139 
0140 
0141 
0142 
0143 
0144 
0145 #endif // _BRepFeat_Builder_HeaderFile