Salome HOME
4623f6b286469b3c7988aa1ba832cee01666bb23
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_SensitivePoint.h
1 // Copyright (C) 2014-2021  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef SketcherPrs_SensitivePoint_H
21 #define SketcherPrs_SensitivePoint_H
22
23 #include <SelectBasics_EntityOwner.hxx>
24 #include <Select3D_SensitiveEntity.hxx>
25 #include <Standard_DefineHandle.hxx>
26 #include <Standard_Version.hxx>
27
28
29 DEFINE_STANDARD_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity)
30
31 /**
32 * \ingroup GUI
33 * This sensitive point is done in order to optimize process of the sinzitive area update
34 * It referes on point array directly and this lets to avoid procedure of the point synchronisation
35 */
36 class SketcherPrs_SensitivePoint : public Select3D_SensitiveEntity
37 {
38 public:
39   //! Constructs a sensitive point object defined by the
40   //! \param OwnerId an Id of the Owner.
41   //! \param theId and Id of its point
42   Standard_EXPORT SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& OwnerId,
43                                              int theId);
44
45   /// Returns number of sub-elements
46 #if OCC_VERSION_HEX > 0x070400
47   Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
48 #else
49   Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
50 #endif
51   //! Update location of the point
52   Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
53
54   //! Checks whether the point overlaps current selecting volume
55   //! \param theMgr selection manager
56   //! \param thePickResult returns pick result
57   Standard_EXPORT virtual Standard_Boolean Matches(SelectBasics_SelectingVolumeManager& theMgr,
58                                      SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
59
60   //! Returns the point used at the time of construction.
61   Standard_EXPORT gp_Pnt Point() const;
62
63   //! Returns center of point. If location transformation
64   //! is set, it will be applied
65   Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
66
67   //! Returns bounding box of the point. If location
68   //! transformation is set, it will be applied
69   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
70
71   /// Clear sub-elements
72   Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
73
74   DEFINE_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity)
75
76 private:
77   int myId;
78 };
79
80
81 #endif