Warnings on vc14 were eliminated
[occt.git] / src / Select3D / Select3D_SensitivePoint.cxx
1 // Created on: 1995-03-10
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 #include <Select3D_SensitivePoint.hxx>
18
19 #include <TopLoc_Location.hxx>
20
21
22 IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitivePoint,Select3D_SensitiveEntity)
23
24 //==================================================
25 // Function: Creation
26 // Purpose :
27 //==================================================
28 Select3D_SensitivePoint::Select3D_SensitivePoint (const Handle(SelectBasics_EntityOwner)& theOwner,
29                                                   const gp_Pnt& thePoint)
30 : Select3D_SensitiveEntity (theOwner)
31 {
32   SetSensitivityFactor (12);
33   myPoint = thePoint;
34 }
35
36 //==================================================
37 // Function: Matches
38 // Purpose :
39 //==================================================
40 Standard_Boolean Select3D_SensitivePoint::Matches (SelectBasics_SelectingVolumeManager& theMgr,
41                                                    SelectBasics_PickResult& thePickResult)
42 {
43   Standard_Real aDepth      = RealLast();
44   Standard_Real aDistToCOG  = RealLast();
45   if (!theMgr.Overlaps (myPoint, aDepth))
46   {
47     thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
48     return Standard_False;
49   }
50
51   aDistToCOG = aDepth;
52   thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
53   return Standard_True;
54 }
55
56 //=======================================================================
57 //function : Point
58 //purpose  :
59 //=======================================================================
60 gp_Pnt Select3D_SensitivePoint::Point() const
61 {
62   return myPoint;
63 }
64
65 //=======================================================================
66 //function : GetConnected
67 //purpose  :
68 //=======================================================================
69 Handle(Select3D_SensitiveEntity) Select3D_SensitivePoint::GetConnected()
70 {
71   Handle(Select3D_SensitivePoint) aNewEntity = new Select3D_SensitivePoint (myOwnerId, myPoint);
72   return aNewEntity;
73 }
74
75 //=======================================================================
76 // function : CenterOfGeometry
77 // purpose  : Returns center of point. If location transformation
78 //            is set, it will be applied
79 //=======================================================================
80 gp_Pnt Select3D_SensitivePoint::CenterOfGeometry() const
81 {
82   return myPoint;
83 }
84
85 //=======================================================================
86 // function : BoundingBox
87 // purpose  : Returns bounding box of the point. If location
88 //            transformation is set, it will be applied
89 //=======================================================================
90 Select3D_BndBox3d Select3D_SensitivePoint::BoundingBox()
91 {
92   return Select3D_BndBox3d (SelectMgr_Vec3 (myPoint.X(), myPoint.Y(), myPoint.Z()),
93                             SelectMgr_Vec3 (myPoint.X(), myPoint.Y(), myPoint.Z()));
94 }
95
96 //=======================================================================
97 // function : NbSubElements
98 // purpose  : Returns the amount of sub-entities in sensitive
99 //=======================================================================
100 Standard_Integer Select3D_SensitivePoint::NbSubElements()
101 {
102   return 1;
103 }