Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1995-04-13
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_SensitiveBox_HeaderFile
0018 #define _Select3D_SensitiveBox_HeaderFile
0019 
0020 #include <Select3D_SensitiveEntity.hxx>
0021 
0022 //! A framework to define selection by a sensitive box.
0023 class Select3D_SensitiveBox : public Select3D_SensitiveEntity
0024 {
0025   DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveBox, Select3D_SensitiveEntity)
0026 public:
0027 
0028   //! Constructs a sensitive box object defined by the
0029   //! owner theOwnerId, and the box theBox.
0030   Standard_EXPORT Select3D_SensitiveBox (const Handle(SelectMgr_EntityOwner)& theOwnerId, const Bnd_Box& theBox);
0031 
0032   //! Constructs a sensitive box object defined by the
0033   //! owner theOwnerId, and the coordinates theXmin, theYMin, theZMin, theXMax, theYMax, theZMax.
0034   //! theXmin, theYMin and theZMin define the minimum point in
0035   //! the front lower left hand corner of the box,
0036   //! and theXMax, theYMax and theZMax define the maximum
0037   //! point in the back upper right hand corner of the box.
0038   Standard_EXPORT Select3D_SensitiveBox (const Handle(SelectMgr_EntityOwner)& theOwnerId,
0039                                          const Standard_Real theXMin,
0040                                          const Standard_Real theYMin,
0041                                          const Standard_Real theZMin,
0042                                          const Standard_Real theXMax,
0043                                          const Standard_Real theYMax,
0044                                          const Standard_Real theZMax);
0045 
0046   //! Returns the amount of sub-entities in sensitive
0047   Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
0048 
0049   Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
0050 
0051   //! Checks whether the box overlaps current selecting volume
0052   Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
0053                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
0054 
0055   Bnd_Box Box() const
0056   {
0057     Bnd_Box aBox;
0058     aBox.Update (myBox.CornerMin().x(), myBox.CornerMin().y(), myBox.CornerMin().z(),
0059                  myBox.CornerMax().x(), myBox.CornerMax().y(), myBox.CornerMax().z());
0060 
0061     return aBox;
0062   }
0063 
0064   //! Returns center of the box. If location
0065   //! transformation is set, it will be applied
0066   Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
0067 
0068   //! Returns coordinates of the box. If location
0069   //! transformation is set, it will be applied
0070   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
0071 
0072   //! Returns TRUE if BVH tree is in invalidated state
0073   virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
0074 
0075   //! Dumps the content of me into the stream
0076   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0077 
0078 private:
0079 
0080   Select3D_BndBox3d myBox;     //!< 3d coordinates of box corners
0081   gp_Pnt myCenter3d;           //!< 3d coordinate of box's center
0082 };
0083 
0084 DEFINE_STANDARD_HANDLE(Select3D_SensitiveBox, Select3D_SensitiveEntity)
0085 
0086 #endif // _Select3D_SensitiveBox_HeaderFile