0029938: Visualization - SelectMgr_ViewerSelector::PickedPoint() should return point...
[occt.git] / src / SelectBasics / SelectBasics_SensitiveEntity.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-01-23
2// Created by: Mister rmi
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 _SelectBasics_SensitiveEntity_HeaderFile
18#define _SelectBasics_SensitiveEntity_HeaderFile
19
91d96372 20#include <gp_GTrsf.hxx>
3bf9a45f 21#include <gp_Trsf.hxx>
0609d8ee 22#include <Standard_Transient.hxx>
42cf5bc1 23#include <SelectBasics_SelectingVolumeManager.hxx>
24#include <SelectBasics_PickResult.hxx>
42cf5bc1 25#include <Select3D_BndBox3d.hxx>
3bf9a45f 26
42cf5bc1 27class SelectBasics_EntityOwner;
28
42cf5bc1 29//! root class; the inheriting classes will be able to give
30//! sensitive Areas for the dynamic selection algorithms
0609d8ee 31class SelectBasics_SensitiveEntity : public Standard_Transient
42cf5bc1 32{
0609d8ee 33 DEFINE_STANDARD_RTTIEXT(SelectBasics_SensitiveEntity, Standard_Transient)
42cf5bc1 34public:
35
42cf5bc1 36 //! Sets owner of the entity
37 Standard_EXPORT virtual void Set (const Handle(SelectBasics_EntityOwner)& theOwnerId);
0609d8ee 38
42cf5bc1 39 //! Returns pointer to owner of the entity
0609d8ee 40 const Handle(SelectBasics_EntityOwner)& OwnerId() const { return myOwnerId; }
41
42cf5bc1 42 //! Checks whether the sensitive entity is overlapped by
43 //! current selecting volume
3bf9a45f 44 virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr, SelectBasics_PickResult& thePickResult) = 0;
0609d8ee 45
42cf5bc1 46 //! allows a better sensitivity for
47 //! a specific entity in selection algorithms
48 //! useful for small sized entities.
0609d8ee 49 Standard_Integer SensitivityFactor() const { return mySFactor; }
8a1170ad 50
51 //! Allows to manage sensitivity of a particular sensitive entity
f5b72419 52 void SetSensitivityFactor (const Standard_Integer theNewSens)
53 {
54 Standard_ASSERT_RAISE (theNewSens > 0, "Error! Selection sensitivity have positive value.");
55 mySFactor = theNewSens;
56 }
0609d8ee 57
42cf5bc1 58 //! Returns the number of sub-entities or elements in
59 //! sensitive entity. Is used to determine if entity is
60 //! complex and needs to pre-build BVH at the creation of
61 //! sensitive entity step or is light-weighted so the tree
62 //! can be build on demand with unnoticeable delay
3bf9a45f 63 virtual Standard_Integer NbSubElements() = 0;
0609d8ee 64
42cf5bc1 65 //! Returns bounding box of sensitive entity
3bf9a45f 66 virtual Select3D_BndBox3d BoundingBox() = 0;
0609d8ee 67
42cf5bc1 68 //! Builds BVH tree for sensitive if it is needed
3bf9a45f 69 virtual void BVH() = 0;
0609d8ee 70
42cf5bc1 71 //! Clears up all the resources and memory allocated
3bf9a45f 72 virtual void Clear() = 0;
42cf5bc1 73
3bf9a45f 74 //! Returns true if the shape corresponding to the entity has init location
75 virtual Standard_Boolean HasInitLocation() const = 0;
42cf5bc1 76
3bf9a45f 77 //! Returns inversed location transformation matrix if the shape corresponding
78 //! to this entity has init location set. Otherwise, returns identity matrix.
91d96372 79 virtual gp_GTrsf InvInitLocation() const = 0;
42cf5bc1 80
42cf5bc1 81protected:
82
3bf9a45f 83 Standard_EXPORT SelectBasics_SensitiveEntity (const Handle(SelectBasics_EntityOwner)& theOwnerId);
84
0609d8ee 85protected:
42cf5bc1 86
0609d8ee 87 Handle(SelectBasics_EntityOwner) myOwnerId;
3bf9a45f 88 Standard_Integer mySFactor;
42cf5bc1 89
0609d8ee 90};
42cf5bc1 91
0609d8ee 92DEFINE_STANDARD_HANDLE(SelectBasics_SensitiveEntity, Standard_Transient)
42cf5bc1 93
94#endif // _SelectBasics_SensitiveEntity_HeaderFile