0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / Select3D / Select3D_SensitiveBox.hxx
1 // Created on: 1995-04-13
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Select3D_SensitiveBox_HeaderFile
18 #define _Select3D_SensitiveBox_HeaderFile
19
20 #include <Select3D_SensitiveEntity.hxx>
21
22 //! A framework to define selection by a sensitive box.
23 class Select3D_SensitiveBox : public Select3D_SensitiveEntity
24 {
25   DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveBox, Select3D_SensitiveEntity)
26 public:
27
28   //! Constructs a sensitive box object defined by the
29   //! owner theOwnerId, and the box theBox.
30   Standard_EXPORT Select3D_SensitiveBox (const Handle(SelectMgr_EntityOwner)& theOwnerId, const Bnd_Box& theBox);
31
32   //! Constructs a sensitive box object defined by the
33   //! owner theOwnerId, and the coordinates theXmin, theYMin, theZMin, theXMax, theYMax, theZMax.
34   //! theXmin, theYMin and theZMin define the minimum point in
35   //! the front lower left hand corner of the box,
36   //! and theXMax, theYMax and theZMax define the maximum
37   //! point in the back upper right hand corner of the box.
38   Standard_EXPORT Select3D_SensitiveBox (const Handle(SelectMgr_EntityOwner)& theOwnerId,
39                                          const Standard_Real theXMin,
40                                          const Standard_Real theYMin,
41                                          const Standard_Real theZMin,
42                                          const Standard_Real theXMax,
43                                          const Standard_Real theYMax,
44                                          const Standard_Real theZMax);
45
46   //! Returns the amount of sub-entities in sensitive
47   Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
48
49   Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
50
51   //! Checks whether the box overlaps current selecting volume
52   Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
53                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
54
55   Bnd_Box Box() const
56   {
57     Bnd_Box aBox;
58     aBox.Update (myBox.CornerMin().x(), myBox.CornerMin().y(), myBox.CornerMin().z(),
59                  myBox.CornerMax().x(), myBox.CornerMax().y(), myBox.CornerMax().z());
60
61     return aBox;
62   }
63
64   //! Returns center of the box. If location
65   //! transformation is set, it will be applied
66   Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
67
68   //! Returns coordinates of the box. If location
69   //! transformation is set, it will be applied
70   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
71
72   //! Returns TRUE if BVH tree is in invalidated state
73   virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
74
75   //! Dumps the content of me into the stream
76   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
77
78 private:
79
80   Select3D_BndBox3d myBox;     //!< 3d coordinates of box corners
81   gp_Pnt myCenter3d;           //!< 3d coordinate of box's center
82 };
83
84 DEFINE_STANDARD_HANDLE(Select3D_SensitiveBox, Select3D_SensitiveEntity)
85
86 #endif // _Select3D_SensitiveBox_HeaderFile