Salome HOME
#1119 Confirmation box for deleting parts
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_SensitivePoint.cpp
index 0785b8415071c9d5f21933a76dc3129f6b2dbbf1..417a6a0c8b1ab21a68d2fda0b59b17695c5619c1 100644 (file)
@@ -10,6 +10,8 @@
 #include <Graphic3d_ArrayOfPoints.hxx>
 #include "SketcherPrs_SymbolPrs.h"
 
+#define DEBUG_SENSITIVE_TO_BE_CORRECTED
+
 IMPLEMENT_STANDARD_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity);
 IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity);
 
@@ -17,7 +19,7 @@ SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(const Handle(SelectBasics
                                                        int theId)
 :Select3D_SensitiveEntity(anOwner), myId(theId)
 {
-  SetSensitivityFactor(12.);
+  SetSensitivityFactor(12);
 }
 
 Standard_Boolean SketcherPrs_SensitivePoint::Matches (SelectBasics_SelectingVolumeManager& theMgr,
@@ -54,11 +56,27 @@ Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected()
 
 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()
 {
+#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()));