X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketcherPrs%2FSketcherPrs_SensitivePoint.cpp;h=acd74cb158bdf90deabdb73b721ac7532978bdbd;hb=a5746a7f8fd8bcd555fb16f98e312c86ca1210da;hp=f9a49e9d1dc5aab6e79ac398026d097672cf7e66;hpb=98713097930edb46d37ffb835d685ec2ef9439dc;p=modules%2Fshaper.git diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp index f9a49e9d1..acd74cb15 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp @@ -7,18 +7,17 @@ #include "SketcherPrs_SensitivePoint.h" -#include -#include -#include -#include +#include +#include "SketcherPrs_SymbolPrs.h" + +#define DEBUG_SENSITIVE_TO_BE_CORRECTED IMPLEMENT_STANDARD_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& anOwner, - const Handle(Graphic3d_ArrayOfPoints)& thePntArray, - int theId) -:Select3D_SensitiveEntity(anOwner), myId(theId), myPntArray(thePntArray) + int theId) +:Select3D_SensitiveEntity(anOwner), myId(theId) { SetSensitivityFactor(12.); } @@ -28,7 +27,7 @@ Standard_Boolean SketcherPrs_SensitivePoint::Matches (SelectBasics_SelectingVolu { Standard_Real aDepth = RealLast(); Standard_Real aDistToCOG = RealLast(); - gp_Pnt aPnt = myPntArray->Vertice(myId); + gp_Pnt aPnt = Point(); if (!theMgr.Overlaps (aPnt, aDepth)) { thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG); @@ -42,23 +41,43 @@ Standard_Boolean SketcherPrs_SensitivePoint::Matches (SelectBasics_SelectingVolu gp_Pnt SketcherPrs_SensitivePoint::Point() const { - return myPntArray->Vertice(myId); + const Handle(SelectMgr_EntityOwner)& anOwner = + Handle(SelectMgr_EntityOwner)::DownCast(OwnerId()); + const Handle(SketcherPrs_SymbolPrs)& aSymbPrs = + Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); + return aSymbPrs->pointsArray()->Vertice(myId); } Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected() { - Handle(SketcherPrs_SensitivePoint) aNewEntity = new SketcherPrs_SensitivePoint (myOwnerId, myPntArray, myId); + Handle(SketcherPrs_SensitivePoint) aNewEntity = new SketcherPrs_SensitivePoint (myOwnerId, myId); return aNewEntity; } gp_Pnt SketcherPrs_SensitivePoint::CenterOfGeometry() const { +#ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED + const Handle(SelectMgr_EntityOwner)& anOwner = + Handle(SelectMgr_EntityOwner)::DownCast(OwnerId()); + const Handle(SketcherPrs_SymbolPrs)& aSymbPrs = + Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); + if (aSymbPrs->pointsArray()->VertexNumber() < myId) + return gp_Pnt(); +#endif return Point(); } Select3D_BndBox3d SketcherPrs_SensitivePoint::BoundingBox() { - gp_Pnt aPnt = myPntArray->Vertice(myId); +#ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED + const Handle(SelectMgr_EntityOwner)& anOwner = + Handle(SelectMgr_EntityOwner)::DownCast(OwnerId()); + const Handle(SketcherPrs_SymbolPrs)& aSymbPrs = + Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); + if (aSymbPrs->pointsArray()->VertexNumber() < myId) + return Select3D_BndBox3d(); +#endif + gp_Pnt aPnt = Point(); return Select3D_BndBox3d (SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()), SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z())); } @@ -67,3 +86,8 @@ Standard_Integer SketcherPrs_SensitivePoint::NbSubElements() { return 1; } + +void SketcherPrs_SensitivePoint::Clear() +{ + return; +}