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_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity);
16 IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity);
18 SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(
19 const Handle(SelectBasics_EntityOwner)& anOwner, int theId)
20 :Select3D_SensitiveEntity(anOwner), myId(theId)
22 SetSensitivityFactor(12);
25 Standard_Boolean SketcherPrs_SensitivePoint::Matches(SelectBasics_SelectingVolumeManager& theMgr,
26 SelectBasics_PickResult& thePickResult)
28 Standard_Real aDepth = RealLast();
29 Standard_Real aDistToCOG = RealLast();
30 gp_Pnt aPnt = Point();
31 if (!theMgr.Overlaps (aPnt, aDepth))
33 thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
34 return Standard_False;
38 thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
42 gp_Pnt SketcherPrs_SensitivePoint::Point() const
44 const Handle(SelectMgr_EntityOwner)& anOwner =
45 Handle(SelectMgr_EntityOwner)::DownCast(OwnerId());
46 const Handle(SketcherPrs_SymbolPrs)& aSymbPrs =
47 Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable());
48 return aSymbPrs->pointsArray()->Vertice(myId);
51 Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected()
53 Handle(SketcherPrs_SensitivePoint) aNewEntity = new SketcherPrs_SensitivePoint (myOwnerId, myId);
57 gp_Pnt SketcherPrs_SensitivePoint::CenterOfGeometry() const
59 #ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED
60 const Handle(SelectMgr_EntityOwner)& anOwner =
61 Handle(SelectMgr_EntityOwner)::DownCast(OwnerId());
62 const Handle(SketcherPrs_SymbolPrs)& aSymbPrs =
63 Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable());
64 if (aSymbPrs->pointsArray()->VertexNumber() < myId)
70 Select3D_BndBox3d SketcherPrs_SensitivePoint::BoundingBox()
72 #ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED
73 const Handle(SelectMgr_EntityOwner)& anOwner =
74 Handle(SelectMgr_EntityOwner)::DownCast(OwnerId());
75 const Handle(SketcherPrs_SymbolPrs)& aSymbPrs =
76 Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable());
77 if (aSymbPrs->pointsArray()->VertexNumber() < myId)
78 return Select3D_BndBox3d();
80 gp_Pnt aPnt = Point();
81 return Select3D_BndBox3d (SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()),
82 SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()));
85 Standard_Integer SketcherPrs_SensitivePoint::NbSubElements()
90 void SketcherPrs_SensitivePoint::Clear()