1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketcherPrs_SensitivePoint.cpp
4 // Created: 24 March 2015
5 // Author: Vitaly SMETANNIKOV
8 #include "SketcherPrs_SensitivePoint.h"
10 #include <Graphic3d_ArrayOfPoints.hxx>
11 #include "SketcherPrs_SymbolPrs.h"
13 #define DEBUG_SENSITIVE_TO_BE_CORRECTED
15 IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity);
17 SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(
18 const Handle(SelectBasics_EntityOwner)& anOwner, int theId)
19 :Select3D_SensitiveEntity(anOwner), myId(theId)
21 SetSensitivityFactor(12);
24 Standard_Boolean SketcherPrs_SensitivePoint::Matches(SelectBasics_SelectingVolumeManager& theMgr,
25 SelectBasics_PickResult& thePickResult)
27 Standard_Real aDepth = RealLast();
28 Standard_Real aDistToCOG = RealLast();
29 gp_Pnt aPnt = Point();
30 if (!theMgr.Overlaps (aPnt, aDepth))
32 thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
33 return Standard_False;
37 thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
41 gp_Pnt SketcherPrs_SensitivePoint::Point() const
43 const Handle(SelectMgr_EntityOwner)& anOwner =
44 Handle(SelectMgr_EntityOwner)::DownCast(OwnerId());
45 const Handle(SketcherPrs_SymbolPrs)& aSymbPrs =
46 Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable());
47 return aSymbPrs->pointsArray()->Vertice(myId);
50 Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected()
52 Handle(SketcherPrs_SensitivePoint) aNewEntity = new SketcherPrs_SensitivePoint (myOwnerId, myId);
56 gp_Pnt SketcherPrs_SensitivePoint::CenterOfGeometry() const
58 #ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED
59 const Handle(SelectMgr_EntityOwner)& anOwner =
60 Handle(SelectMgr_EntityOwner)::DownCast(OwnerId());
61 const Handle(SketcherPrs_SymbolPrs)& aSymbPrs =
62 Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable());
63 if (aSymbPrs->pointsArray()->VertexNumber() < myId)
69 Select3D_BndBox3d SketcherPrs_SensitivePoint::BoundingBox()
71 #ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED
72 const Handle(SelectMgr_EntityOwner)& anOwner =
73 Handle(SelectMgr_EntityOwner)::DownCast(OwnerId());
74 const Handle(SketcherPrs_SymbolPrs)& aSymbPrs =
75 Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable());
76 if (aSymbPrs->pointsArray()->VertexNumber() < myId)
77 return Select3D_BndBox3d();
79 gp_Pnt aPnt = Point();
80 return Select3D_BndBox3d (SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()),
81 SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()));
84 Standard_Integer SketcherPrs_SensitivePoint::NbSubElements()
89 void SketcherPrs_SensitivePoint::Clear()