b311480e |
1 | // Created on: 1995-03-10 |
2 | // Created by: Mister rmi |
3 | // Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
f751596e |
17 | #include <Select3D_SensitivePoint.hxx> |
7fd59977 |
18 | |
92efcf78 |
19 | IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitivePoint,Select3D_SensitiveEntity) |
20 | |
7fd59977 |
21 | //================================================== |
f751596e |
22 | // Function: Creation |
7fd59977 |
23 | // Purpose : |
24 | //================================================== |
0ef04197 |
25 | Select3D_SensitivePoint::Select3D_SensitivePoint (const Handle(SelectMgr_EntityOwner)& theOwner, |
f751596e |
26 | const gp_Pnt& thePoint) |
27 | : Select3D_SensitiveEntity (theOwner) |
7fd59977 |
28 | { |
3bf9a45f |
29 | SetSensitivityFactor (12); |
f751596e |
30 | myPoint = thePoint; |
7fd59977 |
31 | } |
32 | |
7fd59977 |
33 | //================================================== |
ac04d101 |
34 | // Function: Matches |
7fd59977 |
35 | // Purpose : |
36 | //================================================== |
f751596e |
37 | Standard_Boolean Select3D_SensitivePoint::Matches (SelectBasics_SelectingVolumeManager& theMgr, |
38 | SelectBasics_PickResult& thePickResult) |
7fd59977 |
39 | { |
17017555 |
40 | if (!theMgr.Overlaps (myPoint, thePickResult)) |
2157d6ac |
41 | { |
2157d6ac |
42 | return Standard_False; |
43 | } |
4269bd1b |
44 | |
17017555 |
45 | thePickResult.SetDistToGeomCenter (thePickResult.Depth()); |
2157d6ac |
46 | return Standard_True; |
7fd59977 |
47 | } |
48 | |
7fd59977 |
49 | //======================================================================= |
f751596e |
50 | //function : GetConnected |
aec37c15 |
51 | //purpose : |
7fd59977 |
52 | //======================================================================= |
f751596e |
53 | Handle(Select3D_SensitiveEntity) Select3D_SensitivePoint::GetConnected() |
54 | { |
55 | Handle(Select3D_SensitivePoint) aNewEntity = new Select3D_SensitivePoint (myOwnerId, myPoint); |
56 | return aNewEntity; |
57 | } |
7fd59977 |
58 | |
59 | //======================================================================= |
f751596e |
60 | // function : CenterOfGeometry |
61 | // purpose : Returns center of point. If location transformation |
62 | // is set, it will be applied |
7fd59977 |
63 | //======================================================================= |
f751596e |
64 | gp_Pnt Select3D_SensitivePoint::CenterOfGeometry() const |
7fd59977 |
65 | { |
f751596e |
66 | return myPoint; |
7fd59977 |
67 | } |
68 | |
7fd59977 |
69 | //======================================================================= |
f751596e |
70 | // function : BoundingBox |
71 | // purpose : Returns bounding box of the point. If location |
72 | // transformation is set, it will be applied |
7fd59977 |
73 | //======================================================================= |
f751596e |
74 | Select3D_BndBox3d Select3D_SensitivePoint::BoundingBox() |
7fd59977 |
75 | { |
f751596e |
76 | return Select3D_BndBox3d (SelectMgr_Vec3 (myPoint.X(), myPoint.Y(), myPoint.Z()), |
77 | SelectMgr_Vec3 (myPoint.X(), myPoint.Y(), myPoint.Z())); |
7fd59977 |
78 | } |
79 | |
80 | //======================================================================= |
f751596e |
81 | // function : NbSubElements |
82 | // purpose : Returns the amount of sub-entities in sensitive |
7fd59977 |
83 | //======================================================================= |
fe758dbe |
84 | Standard_Integer Select3D_SensitivePoint::NbSubElements() const |
7fd59977 |
85 | { |
f751596e |
86 | return 1; |
7fd59977 |
87 | } |
bc73b006 |
88 | |
89 | //======================================================================= |
90 | //function : DumpJson |
91 | //purpose : |
92 | //======================================================================= |
93 | void Select3D_SensitivePoint::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const |
94 | { |
95 | OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) |
96 | OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity) |
97 | } |