Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-26 09:47:22

0001 // Created on: 1995-03-27
0002 // Created by: Robert COUBLANC
0003 // Copyright (c) 1995-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 _Select3D_SensitiveFace_HeaderFile
0018 #define _Select3D_SensitiveFace_HeaderFile
0019 
0020 #include <Select3D_TypeOfSensitivity.hxx>
0021 #include <Select3D_SensitiveSet.hxx>
0022 #include <gp_Pnt.hxx>
0023 #include <NCollection_Array1.hxx>
0024 #include <NCollection_HArray1.hxx>
0025 #include <SelectBasics_SelectingVolumeManager.hxx>
0026 
0027 //! Sensitive Entity to make a face selectable.
0028 //! In some cases this class can raise Standard_ConstructionError and
0029 //! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
0030 class Select3D_SensitiveFace : public Select3D_SensitiveEntity
0031 {
0032   DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveFace, Select3D_SensitiveEntity)
0033 public:
0034   //! Constructs a sensitive face object defined by the
0035   //! owner theOwnerId, the array of points thePoints, and
0036   //! the sensitivity type theType.
0037   //! The array of points is the outer polygon of the geometric face.
0038   Standard_EXPORT Select3D_SensitiveFace(const occ::handle<SelectMgr_EntityOwner>& theOwnerId,
0039                                          const NCollection_Array1<gp_Pnt>&         thePoints,
0040                                          const Select3D_TypeOfSensitivity          theType);
0041 
0042   //! Constructs a sensitive face object defined by the
0043   //! owner theOwnerId, the array of points thePoints, and
0044   //! the sensitivity type theType.
0045   //! The array of points is the outer polygon of the geometric face.
0046   Standard_EXPORT Select3D_SensitiveFace(const occ::handle<SelectMgr_EntityOwner>&       theOwnerId,
0047                                          const occ::handle<NCollection_HArray1<gp_Pnt>>& thePoints,
0048                                          const Select3D_TypeOfSensitivity                theType);
0049 
0050   //! Returns 3d coordinates of vertices of the face.
0051   //! @return handle to array of 3D vertex coordinates
0052   [[nodiscard]] Standard_EXPORT occ::handle<NCollection_HArray1<gp_Pnt>> GetPoints() const;
0053 
0054   //! Initializes the given array theHArrayOfPnt by 3d
0055   //! coordinates of vertices of the face
0056   //! @deprecated Use GetPoints() returning handle by value instead.
0057   Standard_DEPRECATED("Use GetPoints() returning handle by value instead")
0058   Standard_EXPORT void GetPoints(occ::handle<NCollection_HArray1<gp_Pnt>>& theHArrayOfPnt);
0059 
0060   //! Checks whether the face overlaps current selecting volume
0061   Standard_EXPORT bool Matches(SelectBasics_SelectingVolumeManager& theMgr,
0062                                SelectBasics_PickResult&             thePickResult) override;
0063 
0064   Standard_EXPORT occ::handle<Select3D_SensitiveEntity> GetConnected() override;
0065 
0066   //! Returns bounding box of the face. If location transformation
0067   //! is set, it will be applied
0068   Standard_EXPORT Select3D_BndBox3d BoundingBox() override;
0069 
0070   //! Returns center of the face. If location transformation
0071   //! is set, it will be applied
0072   Standard_EXPORT gp_Pnt CenterOfGeometry() const override;
0073 
0074   //! Builds BVH tree for the face
0075   Standard_EXPORT void BVH() override;
0076 
0077   //! Returns TRUE if BVH tree is in invalidated state
0078   bool ToBuildBVH() const override { return myFacePoints->ToBuildBVH(); }
0079 
0080   //! Returns the amount of sub-entities (points or planar convex polygons)
0081   Standard_EXPORT int NbSubElements() const override;
0082 
0083   //! Dumps the content of me into the stream
0084   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0085 
0086 private:
0087   Select3D_TypeOfSensitivity mySensType; //!< Type of sensitivity: interior or boundary
0088   // clang-format off
0089   occ::handle<Select3D_SensitiveSet> myFacePoints;     //!< Wrapper for overlap detection created depending on sensitivity type
0090   // clang-format on
0091 };
0092 
0093 #endif // _Select3D_SensitiveFace_HeaderFile