Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-28 09:19:31

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