]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#1404 Random crash with Shaper: correction for coincidence constraint: correction...
authornds <nds@opencascade.com>
Fri, 22 Apr 2016 07:05:44 +0000 (10:05 +0300)
committernds <nds@opencascade.com>
Fri, 22 Apr 2016 07:05:44 +0000 (10:05 +0300)
12 files changed:
src/PartSet/PartSet_OperationPrs.cpp
src/PartSet/PartSet_ResultSketchPrs.cpp
src/SketcherPrs/SketcherPrs_Angle.cpp
src/SketcherPrs/SketcherPrs_Coincident.cpp
src/SketcherPrs/SketcherPrs_HVDirection.cpp
src/SketcherPrs/SketcherPrs_LengthDimension.cpp
src/SketcherPrs/SketcherPrs_LengthDimension.h
src/SketcherPrs/SketcherPrs_Middle.cpp
src/SketcherPrs/SketcherPrs_Radius.cpp
src/SketcherPrs/SketcherPrs_Radius.h
src/SketcherPrs/SketcherPrs_Rigid.cpp
src/SketcherPrs/SketcherPrs_SymbolPrs.cpp

index f62f34da165c548c1a17bd7bf7bfe86b367f34b7..c7180c56cab1c22dd0fa99a308a6806cd41e6fd4 100755 (executable)
 
 #include <QList>
 
+#include <gp_Pnt.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+
 //#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()
index 0e7319f8f25c14b411aaf0e64de9ef8dd4048730..cb4ba444c02b5cf37be0414a1141a1309493125e 100755 (executable)
@@ -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();
 
index fc47f51be12077ee56b922e871ca6f2f11642698..557099a7aa42655cb737396913a069e0232ded80 100644 (file)
@@ -35,7 +35,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, AIS_AngleDimension);
 SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint, 
                                      const std::shared_ptr<GeomAPI_Ax3>& 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);
index c3264e79377ad53fdfe7a3443ae4e3dfd446848b..09d58072ee0f0d77ff73e322a0aa6762e5140234 100644 (file)
@@ -36,10 +36,10 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject);
 
 SketcherPrs_Coincident::SketcherPrs_Coincident(ModelAPI_Feature* theConstraint, 
                                                const std::shared_ptr<GeomAPI_Ax3>& 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<GeomAPI_Ax3>& thePlane)
index 23f68b7b1768e1b1c3212f47f531aece5cc8363c..b532887d1052901106a2c5a6e376cd1e0f4eb868 100644 (file)
@@ -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<GeomAPI_Ax3>&/* thePlane*/)
index f17a22dd1ee5ef54f9e231a9469c695ad99ac1ff..2dc2a3b3daa6c65cb80baa1c1a6310779f11b12b 100644 (file)
@@ -40,7 +40,13 @@ SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(ModelAPI_Feature* theCo
                                                          const std::shared_ptr<GeomAPI_Ax3>& 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());
index 75d5aa4c6373cd6cf153123856709ed1c6a50255..a4b161de1fb232bbc4d5756209f4281ad12fb8fc 100644 (file)
@@ -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
index 4d4a00e15e7466b41045aa2e0937bd6d6fb5d280..ceca64a9c96505baa8a018d3844a59a9de239d08 100755 (executable)
@@ -25,9 +25,7 @@ SketcherPrs_Middle::SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
                                      const std::shared_ptr<GeomAPI_Ax3>& 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<GeomAPI_Ax3>&/* thePlane*/)
index c842033bae9927f7ecde064a84068ee6632197df..e31b3e1d497d0df476a6d4b5df21ed09562624fb 100644 (file)
@@ -30,7 +30,12 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Radius, AIS_RadiusDimension);
 
 SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint, 
                                        const std::shared_ptr<GeomAPI_Ax3>& 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());
index 3ba60e08306b7a630bfec9745e6036d812b8f978..386fc01c171fa4c81d5aca83d808668724901778 100644 (file)
@@ -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
index 5875d6c2954375b001ff07b238658178713c7f0f..082ab5cfc6bfde3476b3d6461ce1a7a623069b91 100644 (file)
@@ -41,10 +41,7 @@ SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
                                            const std::shared_ptr<GeomAPI_Ax3>& 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<GeomAPI_Ax3>& thePlane)
index 33c02b37cd78ead80a7fb65d33ef13e634a05db5..73c43f7175673078f933a06f276a38cbc4922859 100644 (file)
@@ -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()