Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:21:19

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _BOPAlgo_BOP_HeaderFile
0016 #define _BOPAlgo_BOP_HeaderFile
0017 
0018 #include <Standard.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020 #include <Standard_Handle.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 #include <TopoDS_Shape.hxx>
0024 #include <BOPAlgo_ToolsProvider.hxx>
0025 #include <NCollection_BaseAllocator.hxx>
0026 #include <TopAbs_ShapeEnum.hxx>
0027 class BOPAlgo_PaveFiller;
0028 
0029 //!
0030 //! The class represents the Building part of the Boolean Operations
0031 //! algorithm.
0032 //! The arguments of the algorithms are divided in two groups - *Objects*
0033 //! and *Tools*.
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 //!
0040 //! The rules for the arguments and type of the operation are the following:
0041 //! - For Boolean operation *FUSE* all arguments should have equal dimensions;
0042 //! - For Boolean operation *CUT* the minimal dimension of *Tools* should not be
0043 //!   less than the maximal dimension of *Objects*;
0044 //! - For Boolean operation *COMMON* the arguments can have any dimension.
0045 //!
0046 //! The class is a General Fuse based algorithm. Thus, all options
0047 //! of the General Fuse algorithm such as Fuzzy mode, safe processing mode,
0048 //! parallel processing mode, gluing mode and history support are also
0049 //! available in this algorithm.
0050 //!
0051 //! Additionally to the Warnings of the parent class the algorithm returns
0052 //! the following warnings:
0053 //! - *BOPAlgo_AlertEmptyShape* - in case some of the input shapes are empty shapes.
0054 //!
0055 //! Additionally to Errors of the parent class the algorithm returns
0056 //! the following Error statuses:
0057 //! - *BOPAlgo_AlertBOPIsNotSet* - in case the type of Boolean operation is not set;
0058 //! - *BOPAlgo_AlertBOPNotAllowed* - in case the operation of given type is not allowed on
0059 //!                     given inputs;
0060 //! - *BOPAlgo_AlertSolidBuilderFailed* - in case the BuilderSolid algorithm failed to
0061 //!                          produce the Fused solid.
0062 //!
0063 class BOPAlgo_BOP : public BOPAlgo_ToolsProvider
0064 {
0065 public:
0066   DEFINE_STANDARD_ALLOC
0067 
0068   //! Empty constructor
0069   Standard_EXPORT BOPAlgo_BOP();
0070   Standard_EXPORT ~BOPAlgo_BOP() override;
0071 
0072   Standard_EXPORT BOPAlgo_BOP(const occ::handle<NCollection_BaseAllocator>& theAllocator);
0073 
0074   //! Clears internal fields and arguments
0075   Standard_EXPORT void Clear() override;
0076 
0077   Standard_EXPORT void SetOperation(const BOPAlgo_Operation theOperation);
0078 
0079   Standard_EXPORT BOPAlgo_Operation Operation() const;
0080 
0081   Standard_EXPORT void Perform(
0082     const Message_ProgressRange& theRange = Message_ProgressRange()) override;
0083 
0084 protected:
0085   Standard_EXPORT void CheckData() override;
0086 
0087   //! Performs calculations using prepared Filler
0088   //! object <thePF>
0089   Standard_EXPORT void PerformInternal1(const BOPAlgo_PaveFiller&    thePF,
0090                                         const Message_ProgressRange& theRange) override;
0091 
0092   Standard_EXPORT void BuildResult(const TopAbs_ShapeEnum theType) override;
0093 
0094   Standard_EXPORT void BuildShape(const Message_ProgressRange& theRange);
0095 
0096   Standard_EXPORT void BuildRC(const Message_ProgressRange& theRange);
0097 
0098   Standard_EXPORT void BuildSolid(const Message_ProgressRange& theRange);
0099 
0100   //! Treatment of the cases with empty shapes.
0101   //! It returns TRUE if there is nothing to do, i.e.
0102   //! all shapes in one of the groups are empty shapes.
0103   Standard_EXPORT bool TreatEmptyShape();
0104 
0105   //! Checks if the arguments of Boolean Operation on solids
0106   //! contain any open solids, for which the building of the splits
0107   //! has failed. In case of positive check, run different procedure
0108   //! for building the result shape.
0109   Standard_EXPORT virtual bool CheckArgsForOpenSolid();
0110 
0111 protected:
0112   //! Extend list of operations to be supported by the Progress Indicator
0113   enum BOPAlgo_PIOperation
0114   {
0115     PIOperation_BuildShape = BOPAlgo_ToolsProvider::PIOperation_Last,
0116     PIOperation_Last
0117   };
0118 
0119   //! Fill PI steps
0120   Standard_EXPORT void fillPIConstants(const double     theWhole,
0121                                        BOPAlgo_PISteps& theSteps) const override;
0122 
0123 protected:
0124   BOPAlgo_Operation myOperation;
0125   int               myDims[2];
0126   TopoDS_Shape      myRC;
0127 };
0128 
0129 #endif // _BOPAlgo_BOP_HeaderFile