]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Debug.
authorouv <ouv@opencascade.com>
Fri, 4 Oct 2013 07:54:46 +0000 (07:54 +0000)
committerouv <ouv@opencascade.com>
Fri, 4 Oct 2013 07:54:46 +0000 (07:54 +0000)
1) Fixed crash on the creation of the second polyline.
2) Canceled creation of preview OCC view for Create/edit zone operation.
3) Temporary fix to avoid blinking of coincident zones in OCC view.

src/HYDROData/HYDROData_Polyline.cxx
src/HYDROData/HYDROData_Polyline.h
src/HYDROData/HYDROOperations_BSpline.cxx
src/HYDROData/HYDROOperations_BSpline.h

index ae0330ed8fcd1a4aa56b5a7d50bae1d7c36af22f..e133ee3e4724c8182ff728408aee34ea3d2a90af 100755 (executable)
@@ -13,6 +13,7 @@
 #include <TDataStd_ByteArray.hxx>
 #include <TDataStd_BooleanArray.hxx>
 #include <TDataStd_IntegerArray.hxx>
+#include <TDataStd_Real.hxx>
 #include <TDataStd_RealArray.hxx>
 #include <TDataStd_ExtStringArray.hxx>
 #include <TDataStd_UAttribute.hxx>
@@ -355,12 +356,25 @@ QPainterPath HYDROData_Polyline::painterPath() const
       int anIndex = i * aDim;
       aPoints << aSection.myCoords[ anIndex ] << aSection.myCoords[ anIndex + 1 ];
     }
-    HYDROOperations_BSpline aBSpline( aPoints, anIsSectionClosed );
+    HYDROOperations_BSpline aBSpline( aPoints, 0, anIsSectionClosed );
     aPath = aBSpline.ComputePath();
   }
   return aPath;
 }
 
+void HYDROData_Polyline::SetZValue( const double theZValue )
+{
+  TDataStd_Real::Set(myLab.FindChild(DataTag_ZValue), theZValue);
+}
+
+double HYDROData_Polyline::ZValue() const
+{
+  Handle(TDataStd_Real) aZValue;
+  if(myLab.FindChild(DataTag_ZValue).FindAttribute(TDataStd_Real::GetID(), aZValue))
+    return aZValue->Get();
+  return 0;
+}
+
 void HYDROData_Polyline::SetWire( const TopoDS_Wire& theWire )
 {
   TNaming_Builder aBuilder( myLab );
@@ -381,6 +395,8 @@ void HYDROData_Polyline::UpdateWire( const PolylineData& theSections )
 
   int aDim = getDimension();
 
+  double aZValue = ZValue();
+
   int aSectionCount = theSections.size();
   for( int aSectionId = 0; aSectionId < aSectionCount; aSectionId++ )
   {
@@ -405,8 +421,8 @@ void HYDROData_Polyline::UpdateWire( const PolylineData& theSections )
               break;
           }
 
-          gp_Pnt aPnt1( aSection.myCoords[ anId1 ], aSection.myCoords[ anId1 + 1 ], 0 );
-          gp_Pnt aPnt2( aSection.myCoords[ anId2 ], aSection.myCoords[ anId2 + 1 ], 0 );
+          gp_Pnt aPnt1( aSection.myCoords[ anId1 ], aSection.myCoords[ anId1 + 1 ], aZValue );
+          gp_Pnt aPnt2( aSection.myCoords[ anId2 ], aSection.myCoords[ anId2 + 1 ], aZValue );
 
           TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aPnt1, aPnt2 ).Edge();
           aMakeSectionWire.Add( anEdge );
@@ -423,7 +439,7 @@ void HYDROData_Polyline::UpdateWire( const PolylineData& theSections )
           aPoints << x << y;
         }
 
-        HYDROOperations_BSpline aBSpline( aPoints, anIsSectionClosed );
+        HYDROOperations_BSpline aBSpline( aPoints, aZValue, anIsSectionClosed );
         TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge();
         aMakeSectionWire.Add( anEdge );
       }
index 4f9e4008fb1d5eb923a82a09d774c4394a8293bb..b5ce157efc26ef3f4c4113b3ac79d5882ee3d196 100755 (executable)
@@ -48,7 +48,8 @@ protected:
     DataTag_SectionsClosed,
     DataTag_SectionsSize,
     DataTag_SectionsType,
-    DataTag_Wire
+    DataTag_Wire,
+    DataTag_ZValue
   };
 
 public:
@@ -110,6 +111,9 @@ public:
    */
   HYDRODATA_EXPORT QPainterPath painterPath() const;
 
+  HYDRODATA_EXPORT void SetZValue( const double theZValue );
+  HYDRODATA_EXPORT double ZValue() const;
+
   /**
    * Sets the wire contour of the object.
    */
index d2dd0176c0070656c80937bb9c7cb46560aeaca6..419788ef1ffdf492e837132003818034b98348ba 100644 (file)
@@ -7,6 +7,7 @@
 
 HYDROOperations_BSpline::HYDROOperations_BSpline(
   const QList<double>& thePoints,
+  const double theZValue,
   const bool theIsClosed)
 {
   // fill array for algorithm by the received coordinates
@@ -19,6 +20,7 @@ HYDROOperations_BSpline::HYDROOperations_BSpline(
     aListIter++;
     aPnt.SetY(*aListIter);
     aListIter++;
+    aPnt.SetZ(theZValue);
     aHCurvePoints->SetValue(ind, aPnt);
   }
   // compute BSpline
index 0021af19bbd77894aac0ce9349e581f2b365dce7..01df6026c8f478d6db1df986f3534d98a4657808 100644 (file)
@@ -20,8 +20,10 @@ public:
 
   //! Creates a spline by list of coordinates: pairs X and Y
   //! \param thePoints coordinates in format X1, Y1, X2, Y2, etc. must be even number of elements
+  //! \param theZValue constant value of the spline Z coordinate
   //! \param theIsClosed flag indicating that the result spline should be closed
   HYDROOperations_BSpline(const QList<double>& thePoints,
+                          const double theZValue,
                           const bool theIsClosed);
   
   //! Returns the BSpline curve passing through the points