Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-10-14
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRepAlgoAPI_BooleanOperation_HeaderFile
0018 #define _BRepAlgoAPI_BooleanOperation_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BOPAlgo_Operation.hxx>
0025 #include <BRepAlgoAPI_BuilderAlgo.hxx>
0026 class BOPAlgo_PaveFiller;
0027 class TopoDS_Shape;
0028 
0029 //! The root API class for performing Boolean Operations on arbitrary shapes.
0030 //!
0031 //! The arguments of the operation are divided in two groups - *Objects* and *Tools*.
0032 //! Each group can contain any number of shapes, but each shape should be valid
0033 //! in terms of *BRepCheck_Analyzer* and *BOPAlgo_ArgumentAnalyzer*.
0034 //! The algorithm builds the splits of the given arguments using the intersection
0035 //! results and combines the result of Boolean Operation of given type:
0036 //! - *FUSE* - union of two groups of objects;
0037 //! - *COMMON* - intersection of two groups of objects;
0038 //! - *CUT* - subtraction of one group from the other;
0039 //! - *SECTION* - section edges and vertices of all arguments;
0040 //!
0041 //! The rules for the arguments and type of the operation are the following:
0042 //! - For Boolean operation *FUSE* all arguments should have equal dimensions;
0043 //! - For Boolean operation *CUT* the minimal dimension of *Tools* should not be
0044 //!   less than the maximal dimension of *Objects*;
0045 //! - For Boolean operation *COMMON* the arguments can have any dimension.
0046 //! - For Boolean operation *SECTION* the arguments can be of any type.
0047 //!
0048 //! Additionally to the errors of the base class the algorithm returns
0049 //! the following Errors:<br>
0050 //! - *BOPAlgo_AlertBOPNotSet* - in case the type of Boolean Operation is not set.<br>
0051 class BRepAlgoAPI_BooleanOperation  : public BRepAlgoAPI_BuilderAlgo
0052 {
0053 public:
0054 
0055   DEFINE_STANDARD_ALLOC
0056 
0057 public: //! @name Constructors
0058 
0059   //! Empty constructor
0060   Standard_EXPORT BRepAlgoAPI_BooleanOperation();
0061 
0062   //! Constructor with precomputed intersections of arguments.
0063   Standard_EXPORT BRepAlgoAPI_BooleanOperation(const BOPAlgo_PaveFiller& thePF);
0064 
0065 
0066 public: //! @name Setting/getting arguments
0067 
0068   //! Returns the first argument involved in this Boolean operation.
0069   //! Obsolete
0070   const TopoDS_Shape& Shape1() const
0071   {
0072     return myArguments.First();
0073   }
0074 
0075   //! Returns the second argument involved in this Boolean operation.
0076   //! Obsolete
0077   const TopoDS_Shape& Shape2() const
0078   {
0079     return myTools.First();
0080   }
0081 
0082   //! Sets the Tool arguments
0083   void SetTools(const TopTools_ListOfShape& theLS)
0084   {
0085     myTools = theLS;
0086   }
0087 
0088   //! Returns the Tools arguments
0089   const TopTools_ListOfShape& Tools() const
0090   {
0091     return myTools;
0092   }
0093 
0094 
0095 public: //! @name Setting/Getting the type of Boolean operation
0096 
0097   //! Sets the type of Boolean operation
0098   void SetOperation(const BOPAlgo_Operation theBOP)
0099   {
0100     myOperation = theBOP;
0101   }
0102 
0103   //! Returns the type of Boolean Operation
0104   BOPAlgo_Operation Operation() const
0105   {
0106     return myOperation;
0107   }
0108 
0109 
0110 public: //! @name Performing the operation
0111 
0112   //! Performs the Boolean operation.
0113   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0114 
0115 
0116 protected: //! @name Constructors
0117 
0118   //! Constructor to perform Boolean operation on only two arguments.
0119   //! Obsolete
0120   Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& theS1,
0121                                                const TopoDS_Shape& theS2,
0122                                                const BOPAlgo_Operation theOperation);
0123 
0124   //! Constructor to perform Boolean operation on only two arguments
0125   //! with precomputed intersection results.
0126   //! Obsolete
0127   Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& theS1,
0128                                                const TopoDS_Shape& theS2,
0129                                                const BOPAlgo_PaveFiller& thePF,
0130                                                const BOPAlgo_Operation theOperation);
0131 
0132 
0133 protected: //! @name Fields
0134 
0135   TopTools_ListOfShape myTools;  //!< Tool arguments of operation
0136   BOPAlgo_Operation myOperation; //!< Type of Boolean Operation
0137 
0138 };
0139 
0140 #endif // _BRepAlgoAPI_BooleanOperation_HeaderFile