Salome HOME
IMP 0017328: min and max scalar map of results given at gauss points. A fix for the...
[modules/visu.git] / src / PIPELINE / VISU_IsoSurfacesPL.cxx
index 13941e70f5a34d124376e95192439fc55da96441..25abb517505a28ff7e1a674122215c8cb4d34300 100644 (file)
@@ -1,6 +1,6 @@
-//  VISU OBJECT : interactive object for VISU entities implementation
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
 //  This library is free software; you can redistribute it and/or
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  VISU OBJECT : interactive object for VISU entities implementation
 // File:    VISU_PipeLine.cxx
 // Author:  Alexey PETROV
 // Module : VISU
-
-
+//
 #include "VISU_IsoSurfacesPL.hxx"
+#include "VISU_LookupTable.hxx"
+
 #include "VISU_PipeLineUtils.hxx"
+#include "VISU_LabelPointsFilter.hxx"
 
 #include <vtkContourFilter.h>
 
+
+
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_IsoSurfacesPL);
 
+
+//----------------------------------------------------------------------------
 VISU_IsoSurfacesPL
 ::VISU_IsoSurfacesPL()
 {
+  SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
+
+  SetElnoDisassembleState( true );
+
   myContourFilter = vtkContourFilter::New();
+
   myCellDataToPointData = vtkCellDataToPointData::New();
-  myIsShrinkable = false;
 }
 
+
+//----------------------------------------------------------------------------
 VISU_IsoSurfacesPL
 ::~VISU_IsoSurfacesPL()
 {
-  myContourFilter->UnRegisterAllOutputs();
   myContourFilter->Delete();
+  myContourFilter = NULL;
 
-  myCellDataToPointData->UnRegisterAllOutputs();
   myCellDataToPointData->Delete();
+  myCellDataToPointData = NULL;
 }
 
+
+//----------------------------------------------------------------------------
+unsigned long int 
+VISU_IsoSurfacesPL
+::GetMTime()
+{
+  unsigned long int aTime = Superclass::GetMTime();
+
+  aTime = std::max(aTime, myCellDataToPointData->GetMTime());
+  aTime = std::max(aTime, myContourFilter->GetMTime());
+
+  return aTime;
+}
+
+
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
 {
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
   if(VISU_IsoSurfacesPL *aPipeLine = dynamic_cast<VISU_IsoSurfacesPL*>(thePipeLine)){
     SetNbParts(aPipeLine->GetNbParts());
     vtkFloatingPointType aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()};
     SetRange(aRange);
   }
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
+
+//----------------------------------------------------------------------------
 int
 VISU_IsoSurfacesPL
 ::GetNbParts() 
 {
   return myContourFilter->GetNumberOfContours();
 }
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU_IsoSurfacesPL
+::GetValue(int i) 
+{
+  return myContourFilter->GetValue(i);
+}
+
+
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
 ::SetNbParts(int theNb) 
 {
   myContourFilter->SetNumberOfContours(theNb);
-  Modified();
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
-::SetScaling(int theScaling
+::SetScalarRange( vtkFloatingPointType theRange[2] 
 {
-  VISU_ScalarMapPL::SetScaling(theScaling);
+  Superclass::SetScalarRange( theRange );
   SetRange(myRange);
 }
+
+
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
 ::SetRange(vtkFloatingPointType theRange[2])
 {
+  if(VISU::CheckIsSameRange(myRange, theRange))
+    return;
+
   if(theRange[0] <= theRange[1]){
-    myRange[0] = theRange[0];  myRange[1] = theRange[1];
-    vtkFloatingPointType aRange[2] = {myRange[0], myRange[1]};
+    myRange[0] = theRange[0];  
+    myRange[1] = theRange[1];
+    vtkFloatingPointType aRange[2] = {theRange[0], theRange[1]};
     if(GetScaling() == VTK_SCALE_LOG10)
-      VISU_LookupTable::ComputeLogRange(theRange,aRange);
-    myContourFilter->GenerateValues(GetNbParts(),aRange);
-    Modified();
+      VISU_LookupTable::ComputeLogRange(theRange, aRange);
+    myContourFilter->GenerateValues(GetNbParts(), aRange);
   }
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_IsoSurfacesPL
 ::GetMin() 
@@ -106,6 +158,8 @@ VISU_IsoSurfacesPL
   return myRange[0];
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_IsoSurfacesPL
 ::GetMax() 
@@ -115,43 +169,74 @@ VISU_IsoSurfacesPL
 
 
 void
+//----------------------------------------------------------------------------
 VISU_IsoSurfacesPL
 ::Init()
 {
-  VISU_ScalarMapPL::Init();
+  Superclass::Init();
 
   SetNbParts(10);
+
   vtkFloatingPointType aScalarRange[2];
   GetSourceRange(aScalarRange);
   SetRange(aScalarRange);
 }
 
-VISU_ScalarMapPL::THook* 
+//----------------------------------------------------------------------------
+void
+VISU_IsoSurfacesPL
+::Build()
+{
+  Superclass::Build();
+
+  VISU::CellDataToPoint(myContourFilter,
+                       myCellDataToPointData,
+                       GetMergedInput());
+
+}
+
+
+//----------------------------------------------------------------------------
+
+vtkDataSet* 
 VISU_IsoSurfacesPL
-::DoHook()
+::InsertCustomPL()
 {
-  VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,GetInput2(),myFieldTransform);
   return myContourFilter->GetOutput();
 }
 
 
-void
+//----------------------------------------------------------------------------
+unsigned long int
 VISU_IsoSurfacesPL
-::Update()
+::GetMemorySize()
 {
-  VISU_ScalarMapPL::Update();
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  if(vtkDataSet* aDataSet = myContourFilter->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+  
+  if(myCellDataToPointData->GetInput())
+    if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  return aSize;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  VISU_ScalarMapPL::SetMapScale(theMapScale);
+  Superclass::SetMapScale(theMapScale);
 
   vtkFloatingPointType aRange[2] = {GetMax() - theMapScale*(GetMax()-GetMin()), GetMax()};
   vtkFloatingPointType aNewRange[2] = {aRange[0], aRange[1]};
   if(GetScaling() == VTK_SCALE_LOG10)
     VISU_LookupTable::ComputeLogRange(aRange,aNewRange);
-  myContourFilter->GenerateValues(GetNbParts(),aNewRange);
-  Modified();
+  myContourFilter->GenerateValues(GetNbParts(), aNewRange);
 }
+
+
+//----------------------------------------------------------------------------