Back to home page

EIC code displayed by LXR

 
 

    


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

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.<br>
0032 //! The arguments of the algorithms are divided in two groups - *Objects*
0033 //! and *Tools*.<br>
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:<br>
0036 //! - *FUSE* - union of two groups of objects;<br>
0037 //! - *COMMON* - intersection of two groups of objects;<br>
0038 //! - *CUT* - subtraction of one group from the other.<br>
0039 //!
0040 //! The rules for the arguments and type of the operation are the following:<br>
0041 //! - For Boolean operation *FUSE* all arguments should have equal dimensions;<br>
0042 //! - For Boolean operation *CUT* the minimal dimension of *Tools* should not be
0043 //!   less than the maximal dimension of *Objects*;<br>
0044 //! - For Boolean operation *COMMON* the arguments can have any dimension.<br>
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.<br>
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 
0067   DEFINE_STANDARD_ALLOC
0068 
0069   
0070   //! Empty constructor
0071   Standard_EXPORT BOPAlgo_BOP();
0072   Standard_EXPORT virtual ~BOPAlgo_BOP();
0073   
0074   Standard_EXPORT BOPAlgo_BOP(const Handle(NCollection_BaseAllocator)& theAllocator);
0075   
0076   //! Clears internal fields and arguments
0077   Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
0078   
0079   Standard_EXPORT void SetOperation (const BOPAlgo_Operation theOperation);
0080   
0081   Standard_EXPORT BOPAlgo_Operation Operation() const;
0082   
0083   Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0084 
0085 protected:
0086   
0087   Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
0088   
0089   //! Performs calculations using prepared Filler
0090   //! object <thePF>
0091   Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF,
0092                                                  const Message_ProgressRange& theRange) Standard_OVERRIDE;
0093 
0094   Standard_EXPORT virtual void BuildResult (const TopAbs_ShapeEnum theType) Standard_OVERRIDE;
0095   
0096   Standard_EXPORT void BuildShape(const Message_ProgressRange& theRange);
0097   
0098   Standard_EXPORT void BuildRC(const Message_ProgressRange& theRange);
0099   
0100   Standard_EXPORT void BuildSolid(const Message_ProgressRange& theRange);
0101   
0102   //! Treatment of the cases with empty shapes.<br>
0103   //! It returns TRUE if there is nothing to do, i.e.
0104   //! all shapes in one of the groups are empty shapes.
0105   Standard_EXPORT Standard_Boolean TreatEmptyShape();
0106 
0107   //! Checks if the arguments of Boolean Operation on solids
0108   //! contain any open solids, for which the building of the splits
0109   //! has failed. In case of positive check, run different procedure
0110   //! for building the result shape.
0111   Standard_EXPORT virtual Standard_Boolean CheckArgsForOpenSolid();
0112 
0113 protected:
0114 
0115   //! Extend list of operations to be supported by the Progress Indicator
0116   enum BOPAlgo_PIOperation
0117   {
0118     PIOperation_BuildShape = BOPAlgo_ToolsProvider::PIOperation_Last,
0119     PIOperation_Last
0120   };
0121 
0122   //! Fill PI steps
0123   Standard_EXPORT virtual void fillPIConstants(const Standard_Real theWhole, BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE;
0124 
0125 protected:
0126 
0127   BOPAlgo_Operation myOperation;
0128   Standard_Integer  myDims[2];
0129   TopoDS_Shape      myRC;
0130 };
0131 
0132 #endif // _BOPAlgo_BOP_HeaderFile