From: nds Date: Fri, 22 Apr 2016 07:05:44 +0000 (+0300) Subject: #1404 Random crash with Shaper: correction for coincidence constraint: correction... X-Git-Tag: V_2.3.0~143 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b8ee56da654b147ed1a537c744c35e9c60562936;p=modules%2Fshaper.git #1404 Random crash with Shaper: correction for coincidence constraint: correction for translation/rotation/mirror: array should not be null when compute happens --- diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index f62f34da1..c7180c56c 100755 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -39,6 +39,10 @@ #include +#include +#include +#include + //#define DEBUG_EMPTY_SHAPE // multi-rotation/translation operation @@ -55,6 +59,12 @@ PartSet_OperationPrs::PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop) : ViewerData_AISShape(TopoDS_Shape()), myWorkshop(theWorkshop), myUseAISWidth(false) { myShapeColor = Quantity_Color(1, 1, 1, Quantity_TOC_RGB); + + // first presentation for having correct Compute until presentation with shapes are set + gp_Pnt aPnt(0.0, 0.0, 0.0); + BRepBuilderAPI_MakeVertex aMaker(aPnt); + TopoDS_Vertex aVertex = aMaker.Vertex(); + myShapeToPrsMap.Bind(aVertex, NULL); } bool PartSet_OperationPrs::hasShapes() diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index 0e7319f8f..cb4ba444c 100755 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -74,8 +74,8 @@ bool PartSet_ResultSketchPrs::isValidShapeType(const TopAbs_ShapeEnum& theBaseTy } void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) + const Handle(Prs3d_Presentation)& thePresentation, + const Standard_Integer theMode) { thePresentation->Clear(); diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index fc47f51be..557099a7a 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -35,7 +35,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, AIS_AngleDimension); SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) : AIS_AngleDimension(gp_Pnt(0,0,0), gp_Pnt(1,0,0), gp_Pnt(0,1,0)), myConstraint(theConstraint), - mySketcherPlane(thePlane) + mySketcherPlane(thePlane), + myFirstPoint(gp_Pnt(0,0,0)), myCenterPoint(gp_Pnt(1,0,0)), mySecondPoint(gp_Pnt(0,1,0)), + myAngle(90), myValue("90"), myFlyOutPoint(0, 0.5, 0) { myAspect = new Prs3d_DimensionAspect(); myAspect->MakeArrows3d(false); diff --git a/src/SketcherPrs/SketcherPrs_Coincident.cpp b/src/SketcherPrs/SketcherPrs_Coincident.cpp index c3264e793..09d58072e 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.cpp +++ b/src/SketcherPrs/SketcherPrs_Coincident.cpp @@ -36,10 +36,10 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject); SketcherPrs_Coincident::SketcherPrs_Coincident(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) - : AIS_InteractiveObject(), myConstraint(theConstraint), mySketcherPlane(thePlane) +: AIS_InteractiveObject(), myConstraint(theConstraint), mySketcherPlane(thePlane), + myPoint(gp_Pnt(0.0, 0.0, 0.0)) { - -} +} bool SketcherPrs_Coincident::IsReadyToDisplay(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.cpp b/src/SketcherPrs/SketcherPrs_HVDirection.cpp index 23f68b7b1..b532887d1 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.cpp +++ b/src/SketcherPrs/SketcherPrs_HVDirection.cpp @@ -26,9 +26,7 @@ SketcherPrs_HVDirection::SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint bool isHorisontal) : SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsHorisontal(isHorisontal) { - myPntArray = new Graphic3d_ArrayOfPoints(1); - myPntArray->AddVertex(0., 0., 0.); -} +} bool SketcherPrs_HVDirection::IsReadyToDisplay(ModelAPI_Feature* theConstraint, const std::shared_ptr&/* thePlane*/) diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp index f17a22dd1..2dc2a3b3d 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp @@ -40,7 +40,13 @@ SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(ModelAPI_Feature* theCo const std::shared_ptr& thePlane) : AIS_LengthDimension(MyDefStart, MyDefEnd, MyDefPln), myConstraint(theConstraint), - mySketcherPlane(thePlane) + mySketcherPlane(thePlane), + myFirstPoint(MyDefStart), + mySecondPoint(MyDefEnd), + myPlane(MyDefPln), + myHasParameters(false), + myValue(""), + myDistance(1) { SetDimensionAspect(SketcherPrs_Tools::createDimensionAspect()); SetSelToleranceForText2d(SketcherPrs_Tools::getTextHeight()); diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.h b/src/SketcherPrs/SketcherPrs_LengthDimension.h index 75d5aa4c6..a4b161de1 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.h +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.h @@ -72,12 +72,12 @@ private: SketcherPrs_DimensionStyleListener* myStyleListener; /// container of values obtained from the constraint, which are necessary to fill the presentation - double myDistance; ///< the flyout distance gp_Pnt myFirstPoint; ///< the dimension first point for measured geometry gp_Pnt mySecondPoint; ///< the dimension first point for measured geometry gp_Pln myPlane; ///< the plane(plane of the sketch) for measured geometry bool myHasParameters; ///< true if the atrribute value has used parameters std::string myValue; ///< dimension value + double myDistance; ///< the flyout distance }; #endif \ No newline at end of file diff --git a/src/SketcherPrs/SketcherPrs_Middle.cpp b/src/SketcherPrs/SketcherPrs_Middle.cpp index 4d4a00e15..ceca64a9c 100755 --- a/src/SketcherPrs/SketcherPrs_Middle.cpp +++ b/src/SketcherPrs/SketcherPrs_Middle.cpp @@ -25,9 +25,7 @@ SketcherPrs_Middle::SketcherPrs_Middle(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) : SketcherPrs_SymbolPrs(theConstraint, thePlane) { - myPntArray = new Graphic3d_ArrayOfPoints(2); - myPntArray->AddVertex(0., 0., 0.); -} +} bool SketcherPrs_Middle::IsReadyToDisplay(ModelAPI_Feature* theConstraint, const std::shared_ptr&/* thePlane*/) diff --git a/src/SketcherPrs/SketcherPrs_Radius.cpp b/src/SketcherPrs/SketcherPrs_Radius.cpp index c842033ba..e31b3e1d4 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.cpp +++ b/src/SketcherPrs/SketcherPrs_Radius.cpp @@ -30,7 +30,12 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Radius, AIS_RadiusDimension); SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) -: AIS_RadiusDimension(MyDefCirc), myConstraint(theConstraint), mySketcherPlane(thePlane) +: AIS_RadiusDimension(MyDefCirc), myConstraint(theConstraint), mySketcherPlane(thePlane), + myCircle(MyDefCirc), + myAnchorPoint(gp_Pnt(0, 0, 2)), + myHasParameters(false), + myValue(""), + myRadius(1) { SetDimensionAspect(SketcherPrs_Tools::createDimensionAspect()); SetSelToleranceForText2d(SketcherPrs_Tools::getDefaultTextHeight()); diff --git a/src/SketcherPrs/SketcherPrs_Radius.h b/src/SketcherPrs/SketcherPrs_Radius.h index 3ba60e083..386fc01c1 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.h +++ b/src/SketcherPrs/SketcherPrs_Radius.h @@ -74,12 +74,11 @@ private: SketcherPrs_DimensionStyleListener* myStyleListener; /// container of values obtained from the constraint, which are necessary to fill the presentation - double myRadius; ///< the radius custom value gp_Circ myCircle; ///< the radius circle gp_Pnt myAnchorPoint; ///< an ancor for the radius value visualization - bool myHasParameters; ///< true if the atrribute value has used parameters std::string myValue; ///< dimension value + double myRadius; ///< the radius custom value }; #endif \ No newline at end of file diff --git a/src/SketcherPrs/SketcherPrs_Rigid.cpp b/src/SketcherPrs/SketcherPrs_Rigid.cpp index 5875d6c29..082ab5cfc 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.cpp +++ b/src/SketcherPrs/SketcherPrs_Rigid.cpp @@ -41,10 +41,7 @@ SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) : SketcherPrs_SymbolPrs(theConstraint, thePlane) { - // Set default points array - myPntArray = new Graphic3d_ArrayOfPoints(1); - myPntArray->AddVertex(0., 0., 0.); -} +} bool SketcherPrs_Rigid::IsReadyToDisplay(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 33c02b37c..73c43f717 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -252,6 +252,8 @@ SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, : AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane), myIsConflicting(false) { SetAutoHilight(Standard_False); + myPntArray = new Graphic3d_ArrayOfPoints(1); + myPntArray->AddVertex(0., 0., 0.); } SketcherPrs_SymbolPrs::~SketcherPrs_SymbolPrs()