Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:13:46

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 _BOPDS_CommonBlock_HeaderFile
0016 #define _BOPDS_CommonBlock_HeaderFile
0017 
0018 #include <Standard.hxx>
0019 #include <Standard_Type.hxx>
0020 
0021 #include <Standard_Handle.hxx>
0022 #include <NCollection_BaseAllocator.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <Standard_Transient.hxx>
0025 #include <NCollection_List.hxx>
0026 class BOPDS_PaveBlock;
0027 
0028 //! The class BOPDS_CommonBlock is to store the information
0029 //! about pave blocks that have geometrical coincidence
0030 //! (in terms of a tolerance) with:
0031 //! a) other pave block(s);
0032 //! b) face(s).
0033 //! First pave block in the common block (real pave block)
0034 //! is always a pave block with the minimal index of the original edge.
0035 class BOPDS_CommonBlock : public Standard_Transient
0036 {
0037 
0038 public:
0039   //! Empty constructor
0040   Standard_EXPORT BOPDS_CommonBlock();
0041 
0042   //! Constructor
0043   //! @param theAllocator the allocator to manage the memory
0044   Standard_EXPORT BOPDS_CommonBlock(const occ::handle<NCollection_BaseAllocator>& theAllocator);
0045 
0046   //! Modifier
0047   //! Adds the pave block <aPB> to the list of pave blocks
0048   //! of the common block
0049   Standard_EXPORT void AddPaveBlock(const occ::handle<BOPDS_PaveBlock>& aPB);
0050 
0051   //! Modifier
0052   //! Sets the list of pave blocks for the common block
0053   Standard_EXPORT void SetPaveBlocks(const NCollection_List<occ::handle<BOPDS_PaveBlock>>& aLPB);
0054 
0055   //! Modifier
0056   //! Adds the index of the face <aF>
0057   //! to the list of indices of faces
0058   //! of the common block
0059   Standard_EXPORT void AddFace(const int aF);
0060 
0061   //! Modifier
0062   //! Sets the list of indices of faces <aLF>
0063   //! of the common block
0064   Standard_EXPORT void SetFaces(const NCollection_List<int>& aLF);
0065 
0066   //! Modifier
0067   //! Appends the list of indices of faces <aLF>
0068   //! to the list of indices of faces
0069   //! of the common block (the input list is emptied)
0070   Standard_EXPORT void AppendFaces(NCollection_List<int>& aLF);
0071 
0072   //! Selector
0073   //! Returns the list of pave blocks
0074   //! of the common block
0075   Standard_EXPORT const NCollection_List<occ::handle<BOPDS_PaveBlock>>& PaveBlocks() const;
0076 
0077   //! Selector
0078   //! Returns the list of indices of faces
0079   //! of the common block
0080   Standard_EXPORT const NCollection_List<int>& Faces() const;
0081 
0082   //! Selector
0083   //! Returns the first pave block
0084   //! of the common block
0085   Standard_EXPORT const occ::handle<BOPDS_PaveBlock>& PaveBlock1() const;
0086 
0087   //! Selector
0088   //! Returns the pave block that belongs
0089   //! to the edge with index <theIx>
0090   Standard_EXPORT occ::handle<BOPDS_PaveBlock>& PaveBlockOnEdge(const int theIndex);
0091 
0092   //! Query
0093   //! Returns true if the common block contains
0094   //! a pave block that belongs
0095   //! to the face with index <theIx>
0096   Standard_EXPORT bool IsPaveBlockOnFace(const int theIndex) const;
0097 
0098   //! Query
0099   //! Returns true if the common block contains
0100   //! a pave block that belongs
0101   //! to the edge with index <theIx>
0102   Standard_EXPORT bool IsPaveBlockOnEdge(const int theIndex) const;
0103 
0104   //! Query
0105   //! Returns true if the common block contains
0106   //! a pave block that is equal to <thePB>
0107   Standard_EXPORT bool Contains(const occ::handle<BOPDS_PaveBlock>& thePB) const;
0108 
0109   //! Query
0110   //! Returns true if the common block contains
0111   //! the face with index equal to <theF>
0112   Standard_EXPORT bool Contains(const int theF) const;
0113 
0114   //! Modifier
0115   //! Assign the index <theEdge> as the edge index
0116   //! to all pave blocks of the common block
0117   Standard_EXPORT void SetEdge(const int theEdge);
0118 
0119   //! Selector
0120   //! Returns the index of the edge
0121   //! of all pave blocks of the common block
0122   Standard_EXPORT int Edge() const;
0123 
0124   Standard_EXPORT void Dump() const;
0125 
0126   //! Moves the pave blocks in the list to make the given
0127   //! pave block to be the first.
0128   //! It will be representative for the whole group.
0129   Standard_EXPORT void SetRealPaveBlock(const occ::handle<BOPDS_PaveBlock>& thePB);
0130 
0131   //! Sets the tolerance for the common block
0132   void SetTolerance(const double theTol) { myTolerance = theTol; }
0133 
0134   //! Return the tolerance of common block
0135   double Tolerance() const { return myTolerance; }
0136 
0137   DEFINE_STANDARD_RTTIEXT(BOPDS_CommonBlock, Standard_Transient)
0138 
0139 protected:
0140   NCollection_List<occ::handle<BOPDS_PaveBlock>> myPaveBlocks; //!< Pave blocks of the common block
0141   NCollection_List<int> myFaces;     //!< Faces on which the pave blocks are lying
0142   double                myTolerance; //!< Tolerance of the common block
0143 };
0144 
0145 #endif // _BOPDS_CommonBlock_HeaderFile