Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 2012-12-17
0002 // Created by: Eugeny MALTCHIKOV
0003 // Copyright (c) 2012-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 _BRepAlgoAPI_Check_HeaderFile
0017 #define _BRepAlgoAPI_Check_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <BOPAlgo_ListOfCheckResult.hxx>
0024 #include <BOPAlgo_Operation.hxx>
0025 #include <BOPAlgo_Options.hxx>
0026 #include <TopoDS_Shape.hxx>
0027 #include <Message_ProgressRange.hxx>
0028 
0029 
0030 //! The class Check provides a diagnostic tool for checking the validity
0031 //! of the single shape or couple of shapes.
0032 //! The shapes are checked on:
0033 //! - Topological validity;
0034 //! - Small edges;
0035 //! - Self-interference;
0036 //! - Validity for Boolean operation of certain type (for couple of shapes only).
0037 //!
0038 //! The class provides two ways of checking shape(-s)
0039 //! 1. Constructors
0040 //! BRepAlgoAPI_Check aCh(theS);
0041 //! Standard_Boolean isValid = aCh.IsValid();
0042 //! 2. Methods SetData and Perform
0043 //! BRepAlgoAPI_Check aCh;
0044 //! aCh.SetData(theS1, theS2, BOPAlgo_FUSE, Standard_False);
0045 //! aCh.Perform();
0046 //! Standard_Boolean isValid = aCh.IsValid();
0047 //!
0048 class BRepAlgoAPI_Check : public BOPAlgo_Options
0049 {
0050 public:
0051 
0052   DEFINE_STANDARD_ALLOC
0053 
0054 
0055 public: //! @name Constructors
0056 
0057   //! Empty constructor.
0058   Standard_EXPORT BRepAlgoAPI_Check();
0059   Standard_EXPORT virtual ~BRepAlgoAPI_Check();
0060 
0061   //! Constructor for checking single shape.
0062   //!
0063   //! @param theS [in] - the shape to check;
0064   //! @param bTestSE [in] - flag which specifies whether to check the shape
0065   //!                       on small edges or not; by default it is set to TRUE;
0066   //! @param bTestSI [in] - flag which specifies whether to check the shape
0067   //!                       on self-interference or not; by default it is set to TRUE;
0068   //! @param theRange [in] - parameter to use progress indicator
0069   Standard_EXPORT BRepAlgoAPI_Check(const TopoDS_Shape& theS,
0070                                     const Standard_Boolean bTestSE = Standard_True,
0071                                     const Standard_Boolean bTestSI = Standard_True,
0072                                     const Message_ProgressRange& theRange = Message_ProgressRange());
0073 
0074   //! Constructor for checking the couple of shapes.
0075   //! Additionally to the validity checks of each given shape,
0076   //! the types of the given shapes will be checked on validity
0077   //! for Boolean operation of given type.
0078   //!
0079   //! @param theS1 [in] - the first shape to check;
0080   //! @param theS2 [in] - the second shape to check;
0081   //! @param theOp [in] - the type of Boolean Operation for which the validity
0082   //!                     of given shapes should be checked.
0083   //! @param bTestSE [in] - flag which specifies whether to check the shape
0084   //!                       on small edges or not; by default it is set to TRUE;
0085   //! @param bTestSI [in] - flag which specifies whether to check the shape
0086   //!                       on self-interference or not; by default it is set to TRUE;
0087   //! @param theRange [in] - parameter to use progress indicator
0088   Standard_EXPORT BRepAlgoAPI_Check(const TopoDS_Shape& theS1,
0089                                     const TopoDS_Shape& theS2,
0090                                     const BOPAlgo_Operation theOp = BOPAlgo_UNKNOWN,
0091                                     const Standard_Boolean bTestSE = Standard_True,
0092                                     const Standard_Boolean bTestSI = Standard_True,
0093                                     const Message_ProgressRange& theRange = Message_ProgressRange());
0094 
0095 
0096 public: //! @name Initializing the algorithm
0097 
0098   //! Initializes the algorithm with single shape.
0099   //!
0100   //! @param theS [in] - the shape to check;
0101   //! @param bTestSE [in] - flag which specifies whether to check the shape
0102   //!                       on small edges or not; by default it is set to TRUE;
0103   //! @param bTestSI [in] - flag which specifies whether to check the shape
0104   //!                       on self-interference or not; by default it is set to TRUE;
0105   void SetData(const TopoDS_Shape& theS,
0106                const Standard_Boolean bTestSE = Standard_True,
0107                const Standard_Boolean bTestSI = Standard_True)
0108   {
0109     myS1 = theS;
0110     myS2 = TopoDS_Shape();
0111     myTestSE = bTestSE;
0112     myTestSI = bTestSI;
0113     myFaultyShapes.Clear();
0114   }
0115 
0116   //! Initializes the algorithm with couple of shapes.
0117   //! Additionally to the validity checks of each given shape,
0118   //! the types of the given shapes will be checked on validity
0119   //! for Boolean operation of given type.
0120   //!
0121   //! @param theS1 [in] - the first shape to check;
0122   //! @param theS2 [in] - the second shape to check;
0123   //! @param theOp [in] - the type of Boolean Operation for which the validity
0124   //!                     of given shapes should be checked.
0125   //! @param bTestSE [in] - flag which specifies whether to check the shape
0126   //!                       on small edges or not; by default it is set to TRUE;
0127   //! @param bTestSI [in] - flag which specifies whether to check the shape
0128   //!                       on self-interference or not; by default it is set to TRUE;
0129   void SetData(const TopoDS_Shape& theS1,
0130                const TopoDS_Shape& theS2,
0131                const BOPAlgo_Operation theOp = BOPAlgo_UNKNOWN,
0132                const Standard_Boolean bTestSE = Standard_True,
0133                const Standard_Boolean bTestSI = Standard_True)
0134   {
0135     myS1 = theS1;
0136     myS2 = theS2;
0137     myOperation = theOp;
0138     myTestSE = bTestSE;
0139     myTestSI = bTestSI;
0140     myFaultyShapes.Clear();
0141   }
0142 
0143 
0144 public: //! @name Performing the operation
0145 
0146   //! Performs the check.
0147   Standard_EXPORT void Perform(const Message_ProgressRange& theRange = Message_ProgressRange());
0148 
0149 
0150 public: //! @name Getting the results.
0151 
0152   //! Shows whether shape(s) valid or not.
0153   Standard_Boolean IsValid()
0154   {
0155     return myFaultyShapes.IsEmpty();
0156   }
0157 
0158   //! Returns faulty shapes.
0159   const BOPAlgo_ListOfCheckResult& Result()
0160   {
0161     return myFaultyShapes;
0162   }
0163 
0164 
0165 protected: //! @name Fields
0166 
0167   // Inputs
0168   TopoDS_Shape myS1;                        //!< The first shape
0169   TopoDS_Shape myS2;                        //!< The second shape
0170   Standard_Boolean myTestSE;                //!< Flag defining whether to look for small edges in the given shapes or not
0171   Standard_Boolean myTestSI;                //!< Flag defining whether to check the input edges on self-interference or not
0172   BOPAlgo_Operation myOperation;            //!< Type of Boolean operation for which the validity of input shapes should be checked
0173 
0174   // Results
0175   BOPAlgo_ListOfCheckResult myFaultyShapes; //!< Found faulty shapes
0176 
0177 };
0178 
0179 #endif // _BRepAlgoAPI_Check_HeaderFile