]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Multi-rotation/translation deselect listo of objects. There is still a crash by desel...
authornds <natalia.donis@opencascade.com>
Tue, 14 Jul 2015 12:50:26 +0000 (15:50 +0300)
committernds <natalia.donis@opencascade.com>
Tue, 14 Jul 2015 12:53:15 +0000 (15:53 +0300)
The crash correction. Scenario: create sketch, a line, create a rotation on the line. Edit rotation, activate selector control, click in the viewer to deselect current value. Result is crash.

src/SketcherPrs/SketcherPrs_SensitivePoint.cpp
src/SketcherPrs/SketcherPrs_SymbolPrs.cpp
src/SketcherPrs/SketcherPrs_Transformation.cpp

index 0785b8415071c9d5f21933a76dc3129f6b2dbbf1..acd74cb158bdf90deabdb73b721ac7532978bdbd 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);
 
@@ -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()));
index 30535729acfe1eb998e6806f9829d3260c2e728a..893b33fbf4c52af19adaec2b58b0a7eee71db342 100644 (file)
@@ -343,7 +343,6 @@ void SketcherPrs_SymbolPrs::Compute(const Handle(PrsMgr_PresentationManager3d)&
   }
 
   if (!updatePoints(20)) {
-    mySPoints.Clear();
     return;
   }
 
index 280d14e34b3dc1201a70ac1bb5c3a236beb40ffa..43a57aa9f0636b7d630d248a805a96e9a4443d7b 100644 (file)
@@ -43,7 +43,13 @@ bool SketcherPrs_Transformation::updatePoints(double theStep) const
 
   int aNbB = anAttrB->size();
   if (aNbB == 0)
+  {
+#ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED
+  //if (!myPntArray.IsNull())
+    //  mySPoints.Clear();
+#endif
     return false;
+  }
 
   SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
   myPntArray = new Graphic3d_ArrayOfPoints(aNbB);