Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:53

0001 // Created on: 2021-03-04
0002 // Created by: Maria KRYLOVA
0003 // Copyright (c) 2021 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 _Select3D_SensitiveSphere_HeaderFile
0017 #define _Select3D_SensitiveSphere_HeaderFile
0018 
0019 #include <Select3D_SensitiveEntity.hxx>
0020 
0021 //! A framework to define selection by a sensitive sphere.
0022 class Select3D_SensitiveSphere : public Select3D_SensitiveEntity
0023 {
0024   DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveSphere, Select3D_SensitiveEntity)
0025 public:
0026 
0027   //! Constructs a sensitive sphere object defined by the owner theOwnerId,
0028   //! the center of the sphere and it's radius.
0029   Standard_EXPORT Select3D_SensitiveSphere (const Handle(SelectMgr_EntityOwner)& theOwnerId,
0030                                             const gp_Pnt& theCenter,
0031                                             const Standard_Real theRadius);
0032 
0033   //! Returns the radius of the sphere
0034   Standard_Real Radius() const { return myRadius; }
0035 
0036 public:
0037 
0038   //! Checks whether the sphere overlaps current selecting volume
0039   Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
0040                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
0041 
0042   //! Returns the copy of this
0043   Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
0044 
0045   //! Returns bounding box of the sphere.
0046   //! If location transformation is set, it will be applied
0047   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
0048 
0049   //! Always returns Standard_False
0050   virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
0051 
0052   //! Returns the amount of points
0053   virtual Standard_Integer NbSubElements() const Standard_OVERRIDE { return 1; }
0054 
0055   //! Returns center of the sphere with transformation applied
0056   virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE { return myCenter; };
0057 
0058   //! Returns the position of detected point on the sphere.
0059   const gp_Pnt& LastDetectedPoint() const { return myLastDetectedPoint; }
0060 
0061   //! Invalidate the position of detected point on the sphere.
0062   void ResetLastDetectedPoint()
0063   {
0064     myLastDetectedPoint = gp_Pnt (RealLast(), RealLast(), RealLast());
0065   }
0066 
0067 protected:
0068   gp_Pnt        myCenter;
0069   gp_Pnt        myLastDetectedPoint;
0070   Standard_Real myRadius;
0071 };
0072 
0073 #endif // _Select3D_SensitiveSphere_HeaderFile