]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL14356:
authorenk <enk@opencascade.com>
Mon, 15 Jan 2007 14:41:59 +0000 (14:41 +0000)
committerenk <enk@opencascade.com>
Mon, 15 Jan 2007 14:41:59 +0000 (14:41 +0000)
Application hangs up after trying to create StreamLines.

src/PIPELINE/VISU_StreamLinesPL.cxx

index cea287a7ccb1ffecd183aa1f970fe6ff4ee6a9af..697e99d014b407fbe6d298109f1c20c632b65d6e 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <vtkCell.h>
 #include <vtkPointSet.h>
+#include <vtkDataSet.h>
 #include <vtkStreamLine.h>
 
 #ifdef _DEBUG_
@@ -82,7 +83,7 @@ void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
              aPipeLine->GetUsedPoints(),
              aPipeLine->GetDirection());
   }
-  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
+  Superclass::ShallowCopy(thePipeLine);
 }
 
 
@@ -230,7 +231,11 @@ VISU_StreamLinesPL
 ::GetVelocityCoeff(vtkPointSet* theDataSet)
 {
   vtkFloatingPointType* aScalarRange = theDataSet->GetScalarRange();
-  return (fabs(aScalarRange[1]) + fabs(aScalarRange[0]))/2.0;
+  vtkFloatingPointType aVelocity = (fabs(aScalarRange[1]) + fabs(aScalarRange[0]))/2.0;
+  if (aVelocity < EPS)
+    return EPS;
+
+  return aVelocity;
 }
 
 
@@ -494,7 +499,7 @@ void
 VISU_StreamLinesPL
 ::Init()
 {
-  VISU_PrsMergerPL::Init();
+  Superclass::Init();
   vtkPointSet* aDataSet = myExtractor->GetOutput();
   vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet);
   vtkFloatingPointType aPropagationTime = GetBasePropagationTime(aDataSet);
@@ -509,9 +514,16 @@ VISU_StreamLinesPL
   GetInput2()->Update();
   VISU::CellDataToPoint(myStream,myCellDataToPointData,GetInput2(),myFieldTransform);
   vtkFloatingPointType *aBounds = GetInput2()->GetBounds();
+
+  myStream->Update();
+  // check: Is streamlines exists? If no points in stream lines, return input2
+  if(myStream->GetOutput()->GetNumberOfPoints() == 0)
+    myGeomFilter->SetInput(GetInput2());
+  else
+    myGeomFilter->SetInput(myStream->GetOutput());
+  
   myGeomFilter->SetExtent(aBounds);
   myGeomFilter->ExtentClippingOn();
-  myGeomFilter->SetInput(myStream->GetOutput());
   return myGeomFilter->GetOutput();
 }
 
@@ -519,12 +531,12 @@ void
 VISU_StreamLinesPL
 ::Update()
 {
-  VISU_PrsMergerPL::Update();
+  Superclass::Update();
 }
 
 void
 VISU_StreamLinesPL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  VISU_ScalarMapPL::SetMapScale(theMapScale);
+  Superclass::SetMapScale(theMapScale);
 }