0027180: Visualization - improve selection logic of MeshVS_Mesh
[occt.git] / src / MeshVS / MeshVS_SensitiveQuad.hxx
CommitLineData
114b7bf1 1// Created on: 2016-03-02
2// Created by: Varvara POSKONINA
3// Copyright (c) 2016 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _MeshVS_SensitiveQuad_HeaderFile
17#define _MeshVS_SensitiveQuad_HeaderFile
18
19#include <Select3D_SensitiveEntity.hxx>
20#include <SelectMgr_EntityOwner.hxx>
21
22#include <TColgp_Array1OfPnt.hxx>
23
24//! This class contains description of planar quadrangle and defines methods
25//! for its detection by OCCT BVH selection mechanism
26class MeshVS_SensitiveQuad : public Select3D_SensitiveEntity
27{
28public:
29
30 //! Creates a new instance and initializes quadrangle vertices with the given points
31 Standard_EXPORT MeshVS_SensitiveQuad (const Handle(SelectMgr_EntityOwner)& theOwner, const TColgp_Array1OfPnt& theQuadVerts);
32
33 //! Creates a new instance and initializes quadrangle vertices with the given points
34 Standard_EXPORT MeshVS_SensitiveQuad (const Handle(SelectMgr_EntityOwner)& theOwner,
35 const gp_Pnt& thePnt1,
36 const gp_Pnt& thePnt2,
37 const gp_Pnt& thePnt3,
38 const gp_Pnt& thePnt4);
39
40 //! Returns the amount of sub-entities in sensitive
41 Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE
42 {
43 return 1;
44 };
45
46 //! Returns a copy of this sensitive quadrangle
47 Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
48
49 //! Checks whether the box overlaps current selecting volume
50 Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
51 SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
52
53 //! Returns center of the box
54 Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
55
56 //! Returns coordinates of the box
57 Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
58
59 DEFINE_STANDARD_RTTIEXT (MeshVS_SensitiveQuad, Select3D_SensitiveEntity)
60
61private:
62
63 gp_Pnt myVertices[4]; //!< 3d coordinates of quad's corners
64};
65
66DEFINE_STANDARD_HANDLE (MeshVS_SensitiveQuad, Select3D_SensitiveEntity)
67
68#endif // _MeshVS_SensitiveQuad_HeaderFile