]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To implement more accurate Mapper's coping
authorapo <apo@opencascade.com>
Mon, 4 Dec 2006 17:01:39 +0000 (17:01 +0000)
committerapo <apo@opencascade.com>
Mon, 4 Dec 2006 17:01:39 +0000 (17:01 +0000)
27 files changed:
src/OBJECT/VISU_Actor.cxx
src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutLinesPL.hxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.hxx
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_DeformedShapePL.hxx
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_GaussPointsPL.hxx
src/PIPELINE/VISU_IsoSurfacesPL.cxx
src/PIPELINE/VISU_IsoSurfacesPL.hxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_PipeLine.hxx
src/PIPELINE/VISU_PipeLineUtils.cxx
src/PIPELINE/VISU_PipeLineUtils.hxx
src/PIPELINE/VISU_Plot3DPL.cxx
src/PIPELINE/VISU_Plot3DPL.hxx
src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx
src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_ScalarMapPL.hxx
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_StreamLinesPL.hxx
src/PIPELINE/VISU_VectorsPL.cxx
src/PIPELINE/VISU_VectorsPL.hxx

index b7e5202e9e66738b46320ff765e84cae15288310..c03cb0de9ceda34233b745299945c9de7f3621c4 100644 (file)
@@ -32,6 +32,8 @@
 #include "VTKViewer_GeometryFilter.h"
 #include "VTKViewer_PassThroughFilter.h"
  
+#include "VISU_PipeLineUtils.hxx"
+
 #include <stdexcept>
 #include <sstream>
 
@@ -131,12 +133,7 @@ VISU_Actor
 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
 {
   myPipeLine->ShallowCopy(thePipeLine);
-
-  vtkDataSet* aDatsSet = myMapper->GetInput();
-  GetMapper()->ShallowCopy(thePipeLine->GetMapper());
-
-  // To restore mapper input from pipeline
-  myMapper->SetInput(aDatsSet);
+  VISU::CopyMapper(GetMapper(), thePipeLine->GetMapper());
 }
 
 //----------------------------------------------------------------------------
index cefa247febfac3070f418bceaa3b46308723170b..2a278253dd1008dfc0d4116bfab891e1c283dac5 100644 (file)
@@ -43,7 +43,7 @@ VISU_CutLinesPL
 
 void
 VISU_CutLinesPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine)
 {
   if(VISU_CutLinesPL *aPipeLine = dynamic_cast<VISU_CutLinesPL*>(thePipeLine)){
     SetOrientation(aPipeLine->GetPlaneOrientation(1),
@@ -54,14 +54,14 @@ VISU_CutLinesPL
     else
       SetPosition(aPipeLine->GetPosition());
   }
-  VISU_CutPlanesPL::ShallowCopy(thePipeLine);
+  Superclass::DoShallowCopy(thePipeLine);
 }
 
 void
 VISU_CutLinesPL
 ::Init()
 {
-  VISU_CutPlanesPL::Init();
+  Superclass::Init();
 
   myBasePlane[0] = XY;
   myBasePlane[1] = YZ;
index a151f616a2edb3a29ea74168df974a6a2daf55f8..b72654c03cac2531179c9750edd389f68b79c028 100644 (file)
@@ -33,9 +33,6 @@ class vtkAppendPolyData;
 
 class VISU_CutLinesPL : public VISU_CutPlanesPL
 {
-protected:
-  VISU_CutLinesPL();
-  VISU_CutLinesPL(const VISU_CutLinesPL&);
 public:
   vtkTypeMacro(VISU_CutLinesPL,VISU_CutPlanesPL);
 
@@ -43,10 +40,6 @@ public:
   VISU_CutLinesPL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   virtual
   void
   SetPosition(vtkFloatingPointType thePosition);
@@ -125,6 +118,13 @@ public:
   }
 
 protected:
+  VISU_CutLinesPL();
+  VISU_CutLinesPL(const VISU_CutLinesPL&);
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
+
   vtkFloatingPointType myDirLn[3];
   vtkFloatingPointType myRealDirLn[3];
   vtkFloatingPointType myBoundPrjLn[3];
index 745206d857df358f7e943fb9ef7f3a847c08401a..a96b049a45d5b822e24e6bae2f7544d1c242e24d 100644 (file)
@@ -64,7 +64,7 @@ VISU_CutPlanesPL
 
 void
 VISU_CutPlanesPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine)
 {
   if(VISU_CutPlanesPL *aPipeLine = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine)){
     SetOrientation(aPipeLine->GetPlaneOrientation(),
@@ -74,7 +74,7 @@ VISU_CutPlanesPL
     for (int i = 0, iend = GetNbParts(); i < iend; i++)
       if(!aPipeLine->IsPartDefault(i))         SetPartPosition(i, aPipeLine->GetPartPosition(i));
   }
-  Superclass::ShallowCopy(thePipeLine);
+  Superclass::DoShallowCopy(thePipeLine);
 }
 
 void
index 5d0da26f56b96fde84d4848bd0e1e1826d60a6d0..79a59ad14dc17e783fb97b39bdb87b2262e4bb58 100644 (file)
@@ -45,10 +45,6 @@ public:
   virtual
   ~VISU_CutPlanesPL();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   enum PlaneOrientation {XY, YZ, ZX};
 
   virtual 
@@ -188,6 +184,10 @@ protected:
   THook* 
   DoHook();
 
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
+
   void
   SetPartPosition(int theNum = 0);
 
index 8a8cc06db51acf93985cc98f277111bfe7271ca9..d3d431a3265c08182c10bf8d8af25510a0ca5a71 100644 (file)
@@ -52,12 +52,12 @@ VISU_DeformedShapePL
 
 void
 VISU_DeformedShapePL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine)
 {
   if(VISU_DeformedShapePL *aPipeLine = dynamic_cast<VISU_DeformedShapePL*>(thePipeLine)){
     SetScale(aPipeLine->GetScale());
   }
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
+  Superclass::DoShallowCopy(thePipeLine);
 }
 
 vtkFloatingPointType
@@ -104,7 +104,7 @@ void
 VISU_DeformedShapePL
 ::Init()
 {
-  VISU_ScalarMapPL::Init();
+  Superclass::Init();
   vtkFloatingPointType aScalarRange[2];
   GetSourceRange(aScalarRange);
 
@@ -132,7 +132,7 @@ void
 VISU_DeformedShapePL
 ::Update()
 {
-  VISU_ScalarMapPL::Update();
+  Superclass::Update();
 }
 
 //----------------------------------------------------------------------------
@@ -141,7 +141,7 @@ VISU_DeformedShapePL
 ::GetMemorySize()
 {
   unsigned long int aSize = 0;
-  if(vtkDataSet* aDataSet = myWarpVector->GetInput())
+  if(myWarpVector->GetInput())
     if(vtkDataSet* aDataSet = myWarpVector->GetOutput())
       aSize += aDataSet->GetActualMemorySize() * 1024;
   
@@ -160,7 +160,7 @@ void
 VISU_DeformedShapePL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  VISU_ScalarMapPL::SetMapScale(theMapScale);
+  Superclass::SetMapScale(theMapScale);
 
   myWarpVector->SetScaleFactor(myScaleFactor*theMapScale);
   Modified();
index 4049c668e0613a0e19403c5eb79c5e43798d8de2..e842588b675ffd0b977408f1512552c98da4c950 100644 (file)
@@ -35,13 +35,6 @@ class vtkWarpVector;
 
 class VISU_DeformedShapePL : public VISU_ScalarMapPL
 {
-protected:
-  VISU_DeformedShapePL();
-  VISU_DeformedShapePL(const VISU_DeformedShapePL&);
-
-  virtual
-  ~VISU_DeformedShapePL();
-
 public:
   vtkTypeMacro(VISU_DeformedShapePL,VISU_ScalarMapPL);
 
@@ -49,10 +42,6 @@ public:
   VISU_DeformedShapePL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   virtual
   void
   SetScale(vtkFloatingPointType theScale);
@@ -84,10 +73,20 @@ public:
   GetScaleFactor(vtkDataSet* theDataSet);
 
 protected:
+  VISU_DeformedShapePL();
+  VISU_DeformedShapePL(const VISU_DeformedShapePL&);
+
+  virtual
+  ~VISU_DeformedShapePL();
+
   virtual
   THook* 
   DoHook();
 
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
+
   vtkFloatingPointType myScaleFactor;
   vtkWarpVector *myWarpVector;
   vtkCellDataToPointData* myCellDataToPointData;
index 65c7ab7e0b6ef6333fef543442970d6b028b1d9d..f3edad74d503bb22b10545030a33f88fb11c5f90 100644 (file)
@@ -138,14 +138,9 @@ CopyGlyph( vtkGlyph3D* source, vtkGlyph3D* dest )
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine)
 {
   if(VISU_GaussPointsPL *aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
-    // To restore mapper input from pipeline
-    vtkPolyData* aDatsSet = myPSMapper->GetInput();
-    myPSMapper->ShallowCopy(aPipeLine->GetPSMapper());
-    myPSMapper->SetInput(aDatsSet);
-
     SetPrimitiveType(aPipeLine->GetPrimitiveType());
     SetBicolor(aPipeLine->GetBicolor());
     SetClamp(aPipeLine->GetClamp());
@@ -163,7 +158,18 @@ VISU_GaussPointsPL
     mySphereSource->SetRadius( aPipeLine->mySphereSource->GetRadius() );
     CopyGlyph( aPipeLine->myGlyph, this->myGlyph );
   }
-  Superclass::ShallowCopy(thePipeLine);
+  Superclass::DoShallowCopy(thePipeLine);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::DoCopyMapper(VISU_PipeLine *thePipeLine)
+{
+  if(VISU_GaussPointsPL* aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
+    VISU::CopyPointSpriteDataMapper(GetPSMapper(), aPipeLine->GetPSMapper());
+  }
 }
 
 
index 7f5f1ca772c603e10670506f442aa9e84b0034c4..da77134ce72d76adcedb340b8f6531d8b107e238 100644 (file)
@@ -54,12 +54,6 @@ class SALOME_Transform;
  */
 class VISU_GaussPointsPL : public VISU_ScalarMapPL
 {
-protected:
-  VISU_GaussPointsPL();
-
-  virtual
-  ~VISU_GaussPointsPL();
-
 public:
   vtkTypeMacro(VISU_GaussPointsPL,VISU_ScalarMapPL);
 
@@ -70,10 +64,6 @@ public:
   unsigned long int 
   GetMTime();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   //! Get the native mapper.
   virtual
   TMapper* 
@@ -268,14 +258,40 @@ public:
               const char* theAlphaTexture );
 
 public:
-  virtual void  SetIsDeformed( bool theIsDeformed );
-  virtual bool  GetIsDeformed() const;
+  virtual 
+  void
+  SetIsDeformed( bool theIsDeformed );
+
+  virtual
+  bool
+  GetIsDeformed() const;
+
+  virtual
+  void
+  SetScale( vtkFloatingPointType theScale );
 
-  virtual void  SetScale( vtkFloatingPointType theScale );
-  virtual vtkFloatingPointType GetScale();
-  virtual void  SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
+  virtual
+  vtkFloatingPointType 
+  GetScale();
+
+  virtual
+  void
+  SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
 
 protected:
+  VISU_GaussPointsPL();
+
+  virtual
+  ~VISU_GaussPointsPL();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
+
+  virtual
+  void
+  DoCopyMapper(VISU_PipeLine *thePipeLine);
+
   bool myIsDeformed;
   vtkFloatingPointType myScaleFactor;
   vtkWarpVector *myWarpVector;
@@ -286,7 +302,6 @@ protected:
   vtkSphereSource* mySphereSource;
   int myResolution;
 
-protected:
   VISU_OpenGLPointSpriteMapper* myPSMapper;
   VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
 
index aa932005fa2c10c130b6558688667488619f501a..43894fbed1b0c012623bc7c5f5d637c607c73ffe 100644 (file)
@@ -53,14 +53,14 @@ VISU_IsoSurfacesPL
 
 void
 VISU_IsoSurfacesPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine)
 {
   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);
+  Superclass::DoShallowCopy(thePipeLine);
 }
 
 int
@@ -82,7 +82,7 @@ void
 VISU_IsoSurfacesPL
 ::SetScaling(int theScaling) 
 {
-  VISU_ScalarMapPL::SetScaling(theScaling);
+  Superclass::SetScaling(theScaling);
   SetRange(myRange);
 }
 void
@@ -118,7 +118,7 @@ void
 VISU_IsoSurfacesPL
 ::Init()
 {
-  VISU_ScalarMapPL::Init();
+  Superclass::Init();
 
   SetNbParts(10);
   vtkFloatingPointType aScalarRange[2];
@@ -139,7 +139,7 @@ void
 VISU_IsoSurfacesPL
 ::Update()
 {
-  VISU_ScalarMapPL::Update();
+  Superclass::Update();
 }
 
 //----------------------------------------------------------------------------
@@ -166,7 +166,7 @@ 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]};
index 1ecc5ed0487bbb36b380599aaeecfe61be2bc05f..2422746d2d2c1f3e0a381fff1f4f624b93698b85 100644 (file)
@@ -34,13 +34,6 @@ class vtkCellDataToPointData;
 
 class VISU_IsoSurfacesPL : public VISU_ScalarMapPL
 {
-protected:
-  VISU_IsoSurfacesPL();
-  VISU_IsoSurfacesPL(const VISU_IsoSurfacesPL&);
-
-  virtual
-  ~VISU_IsoSurfacesPL();
-
 public:
   vtkTypeMacro(VISU_IsoSurfacesPL,VISU_ScalarMapPL);
 
@@ -48,10 +41,6 @@ public:
   VISU_IsoSurfacesPL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   virtual
   int
   GetNbParts();
@@ -99,6 +88,16 @@ public:
   SetMapScale(vtkFloatingPointType theMapScale = 1.0);
 
 protected:
+  VISU_IsoSurfacesPL();
+  VISU_IsoSurfacesPL(const VISU_IsoSurfacesPL&);
+
+  virtual
+  ~VISU_IsoSurfacesPL();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
+
   int myNbParts;
   vtkFloatingPointType myRange[2];
   vtkCellDataToPointData* myCellDataToPointData;
index 680a21ab3055d56c51dc51cb6d91b454dc8cc14c..af69393439725112743f22d35198b38613653475 100755 (executable)
@@ -205,7 +205,7 @@ bool InitializeARB()
 };
 
 static bool IsARBInitialized = InitializeARB();
-static float Tolerance = 1.0 / VTK_LARGE_FLOAT;
+static vtkFloatingPointType Tolerance = 1.0 / VTK_LARGE_FLOAT;
 
 //-----------------------------------------------------------------------------
 // Construct empty object.
@@ -252,31 +252,7 @@ VISU_OpenGLPointSpriteMapper::~VISU_OpenGLPointSpriteMapper()
   if( this->TempMapper )
     this->TempMapper->Delete();
 }
-//-----------------------------------------------------------------------------
-void VISU_OpenGLPointSpriteMapper::ShallowCopy( vtkAbstractMapper* mapper )
-{
-  VISU_OpenGLPointSpriteMapper* m = VISU_OpenGLPointSpriteMapper::SafeDownCast(mapper);
-  if( m != NULL )
-  {
-    this->SetPrimitiveType( m->GetPrimitiveType() );
-
-    this->SetPointSpriteMode( m->GetPointSpriteMode() );
-
-    this->SetPointSpriteClamp( m->GetPointSpriteClamp() );
-    this->SetPointSpriteSize( m->GetPointSpriteSize() );
-    this->SetPointSpriteMinSize( m->GetPointSpriteMinSize() );
-    this->SetPointSpriteMaxSize( m->GetPointSpriteMaxSize() );
-    this->SetPointSpriteMagnification( m->GetPointSpriteMagnification() );
 
-    this->SetImageData( m->GetImageData() );
-    this->SetPointSpriteAlphaThreshold( m->GetPointSpriteAlphaThreshold() );
-  }
-
-  this->TempMapper->ShallowCopy( m );
-  this->TempMapper->SetInput( this->GetInput() );
-  Superclass::ShallowCopy( this->TempMapper );
-
-}
 //-----------------------------------------------------------------------------
 char* readFromFile( std::string fileName )
 {
@@ -554,6 +530,13 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
        act->GetProperty()->GetMTime() > this->BuildTime ||
        ren->GetRenderWindow() != this->LastWindow)
   {
+    /* To contol when the mapper is recalculated
+    cout<<"VISU_OpenGLPointSpriteMapper::RenderPiece - "
+       <<(this->GetMTime() > this->BuildTime)<<"; "
+       <<(input->GetMTime() > this->BuildTime)<<"; "
+       <<(act->GetProperty()->GetMTime() > this->BuildTime)<<"; "
+       <<endl;
+    */
     // sets this->Colors as side effect
     this->MapScalars( act->GetProperty()->GetOpacity() );
 
index 7af9a27a3f821950455809abe2b1088729a46617..6f99d0b007c11353c49fea542094023eddacdcef 100755 (executable)
@@ -90,8 +90,6 @@ public:
   static VISU_OpenGLPointSpriteMapper *New();
   vtkTypeRevisionMacro(VISU_OpenGLPointSpriteMapper,MAPPER_SUPERCLASS);
 
-  void ShallowCopy(vtkAbstractMapper*);
-
   //! Set the initial point size to be used.
   /*!
    * This value forms the base upon which the distance attenuation acts.
index 91c453a78e8f170f7e187bc339479ca7e25fc395..bc6944a67a416c634112bef38d28a5ec569b758b 100644 (file)
@@ -98,7 +98,7 @@ void
 VISU_PipeLine
 ::DebugOn()
 {
-  myExtractGeometry->DebugOn();
+  //myExtractGeometry->DebugOn();
   Superclass::DebugOn();
 }
 
@@ -108,7 +108,7 @@ void
 VISU_PipeLine
 ::DebugOff()
 {
-  myExtractGeometry->DebugOff();
+  //myExtractGeometry->DebugOff();
   Superclass::DebugOff();
 }
 
@@ -118,23 +118,32 @@ VISU_PipeLine
 ::ShallowCopy(VISU_PipeLine *thePipeLine)
 {
   SetImplicitFunction(thePipeLine->GetImplicitFunction());
+  DoShallowCopy(thePipeLine);
+}
 
-  // To restore mapper input from pipeline
-  vtkDataSet* aDatsSet = myMapper->GetInput();
-  GetMapper()->ShallowCopy(thePipeLine->GetMapper());
-  myMapper->SetInput(aDatsSet);
-
+//----------------------------------------------------------------------------
+void 
+VISU_PipeLine
+::DoShallowCopy(VISU_PipeLine *thePipeLine)
+{
+  DoCopyMapper(thePipeLine);
   Build();
 }
 
+//----------------------------------------------------------------------------
+void 
+VISU_PipeLine
+::DoCopyMapper(VISU_PipeLine *thePipeLine)
+{
+  VISU::CopyMapper(GetMapper(), thePipeLine->GetMapper());
+}
+
 //----------------------------------------------------------------------------
 void
 VISU_PipeLine
 ::SameAs(VISU_PipeLine *thePipeLine)
 {
-  ShallowCopy(thePipeLine);
-  SetImplicitFunction(vtkImplicitBoolean::New());
-  GetImplicitFunction()->Delete();
+  DoShallowCopy(thePipeLine);
 }
 
 //----------------------------------------------------------------------------
index 95bf380edb705383b3f37c5ab67647ed2024307d..251637ffecec6f96c5b12ced98c122f668658ab7 100644 (file)
@@ -227,6 +227,14 @@ protected:
   virtual
   ~VISU_PipeLine();
 
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
+
+  virtual
+  void
+  DoCopyMapper(VISU_PipeLine *thePipeLine);
+
   virtual 
   TInput* 
   GetInput2() const;
index 9becc0c296e03b6e6db8df000be4565af9fcece9..3e67f0d5af1af49b5cd69ba971c97e51a30606c0 100644 (file)
 
 #include "VISU_PipeLineUtils.hxx"
 
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+
+#include <vtkDataSetMapper.h>
+#include <vtkPolyDataMapper.h>
+
 void
 VISU::Mul(const vtkFloatingPointType A[3], 
          vtkFloatingPointType b, 
@@ -42,3 +47,69 @@ VISU::Sub(const vtkFloatingPointType A[3],
   for(int i = 0; i < 3; i++)  C[i] = A[i] - B[i];
 }
 
+namespace VISU
+{
+  bool
+  CheckIsSameRange(vtkFloatingPointType* theTarget,
+                  vtkFloatingPointType* theSource)
+  {
+    static vtkFloatingPointType TOL = 10.0 / VTK_LARGE_FLOAT;
+    return std::abs(theTarget[0] - theSource[0]) + std::abs(theTarget[1] - theSource[1])  < TOL;
+}
+  
+  void
+  CopyMapper(vtkMapper* theTarget, 
+            vtkMapper* theSource)
+  {
+    // To customize vtkMapper::ShallowCopy ...
+    theTarget->SetLookupTable(theSource->GetLookupTable());
+    theTarget->SetScalarVisibility(theSource->GetScalarVisibility());
+    if(!CheckIsSameRange(theTarget->GetScalarRange(), theSource->GetScalarRange()))
+      theTarget->SetScalarRange(theSource->GetScalarRange());
+    theTarget->SetColorMode(theSource->GetColorMode());
+    theTarget->SetScalarMode(theSource->GetScalarMode());
+    theTarget->SetImmediateModeRendering(theSource->GetImmediateModeRendering());
+    theTarget->SetUseLookupTableScalarRange(theSource->GetUseLookupTableScalarRange());
+    if(theSource->GetArrayAccessMode() == VTK_GET_ARRAY_BY_ID)
+      theTarget->ColorByArrayComponent(theSource->GetArrayId(), theSource->GetArrayComponent());
+    else
+      theTarget->ColorByArrayComponent(theSource->GetArrayName(), theSource->GetArrayComponent());
+    
+    // To customize vtkAbstractMapper3D::ShallowCopy ...
+    theTarget->SetClippingPlanes(theSource->GetClippingPlanes());
+  }
+
+  void
+  CopyPolyDataMapper(vtkPolyDataMapper* theTarget, 
+                    vtkPolyDataMapper* theSource)
+  {
+    // To customize vtkPolyDataMapper::ShallowCopy ...
+    //aTargetMapper->SetInput(aMapper->GetInput());
+    theTarget->SetGhostLevel(theSource->GetGhostLevel());
+    theTarget->SetNumberOfPieces(theSource->GetNumberOfPieces());
+    theTarget->SetNumberOfSubPieces(theSource->GetNumberOfSubPieces());
+
+    CopyMapper(theTarget, theSource);
+  }
+
+  void
+  CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget, 
+                           VISU_OpenGLPointSpriteMapper* theSource)
+  {
+    // To customize VISU_OpenGLPointSpriteMapper::ShallowCopy ...
+    theTarget->SetPrimitiveType( theSource->GetPrimitiveType() );
+    
+    theTarget->SetPointSpriteMode( theSource->GetPointSpriteMode() );
+    
+    theTarget->SetPointSpriteClamp( theSource->GetPointSpriteClamp() );
+    theTarget->SetPointSpriteSize( theSource->GetPointSpriteSize() );
+    theTarget->SetPointSpriteMinSize( theSource->GetPointSpriteMinSize() );
+    theTarget->SetPointSpriteMaxSize( theSource->GetPointSpriteMaxSize() );
+    theTarget->SetPointSpriteMagnification( theSource->GetPointSpriteMagnification() );
+    
+    theTarget->SetImageData( theSource->GetImageData() );
+    theTarget->SetPointSpriteAlphaThreshold( theSource->GetPointSpriteAlphaThreshold() );
+
+    CopyPolyDataMapper(theTarget, theSource);
+  }
+}
index 57e6347bed04467dc1168ed46b3bbee13c00c7ed..e4a655e9f239095bcc3ee8df4e08a5af9e322755 100644 (file)
@@ -55,6 +55,8 @@
 
 #endif
 
+class VISU_OpenGLPointSpriteMapper;
+
 namespace VISU
 {
   void
@@ -96,6 +98,25 @@ namespace VISU
     }else
       theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
   }
+
+  //! Checks whether the scalar range is the same or not
+  bool
+  CheckIsSameRange(vtkFloatingPointType* theTarget,
+                  vtkFloatingPointType* theSource);
+
+  //! Customizes vtkMapper::ShallowCopy
+  void
+  CopyMapper(vtkMapper* theTarget, vtkMapper* theSource);
+
+  //! Customizes vtkPolyDataMapper::ShallowCopy
+  void
+  CopyPolyDataMapper(vtkPolyDataMapper* theTarget, 
+                    vtkPolyDataMapper* theSource);
+
+  //! Customizes VISU_OpenGLPointSpriteMapper::ShallowCopy
+  void
+  CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget, 
+                           VISU_OpenGLPointSpriteMapper* theSource);
 }
 
 #endif
index 54f4c0c247178a02f6aeaad41dd14bbcde14dde4..dbdf62ab915e61197f6a190adfa18321c4b6f81a 100644 (file)
@@ -66,7 +66,7 @@ VISU_Plot3DPL::~VISU_Plot3DPL()
 
 void
 VISU_Plot3DPL::
-ShallowCopy(VISU_PipeLine *thePipeLine)
+DoShallowCopy(VISU_PipeLine *thePipeLine)
 {
   if(VISU_Plot3DPL *aPipeLine = dynamic_cast<VISU_Plot3DPL*>(thePipeLine)){
     SetOrientation (aPipeLine->GetPlaneOrientation(),
@@ -77,7 +77,7 @@ ShallowCopy(VISU_PipeLine *thePipeLine)
     SetContourPrs( aPipeLine->GetIsContourPrs() );
     SetNumberOfContours( aPipeLine->GetNumberOfContours() );
   }
-  Superclass::ShallowCopy(thePipeLine);
+  Superclass::DoShallowCopy(thePipeLine);
 }
 
 VISU_CutPlanesPL::PlaneOrientation
index d2fd79fb27c4f0553c28599ef14b5b5a014239d9..733f65beb16f038b0df467292a133b2672314b0e 100644 (file)
@@ -37,19 +37,11 @@ class vtkCellDataToPointData;
 
 class VISU_Plot3DPL : public VISU_ScalarMapPL
 {
-protected:
-  VISU_Plot3DPL();
-  VISU_Plot3DPL(const VISU_Plot3DPL&);
-
 public:
   vtkTypeMacro(VISU_Plot3DPL,VISU_ScalarMapPL);
   static VISU_Plot3DPL* New();
   virtual ~VISU_Plot3DPL();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   VISU_CutPlanesPL::PlaneOrientation
   GetPlaneOrientation() const;
 
@@ -125,7 +117,16 @@ public:
   void SetMapScale(vtkFloatingPointType theMapScale);
 
 protected:
-  virtual THook* DoHook();
+  VISU_Plot3DPL();
+  VISU_Plot3DPL(const VISU_Plot3DPL&);
+
+  virtual
+  THook* 
+  DoHook();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
 
   vtkFloatingPointType myAngle[3];
   bool myIsRelative, myIsContour;
index ec75b0877a3b7436c6dd1a34c3254256ac6ada9c..73922a8bbbd04c91a8d09478557d060e8e866b7d 100644 (file)
@@ -194,17 +194,16 @@ VISU_ScalarMapOnDeformedShapePL
  */
 void
 VISU_ScalarMapOnDeformedShapePL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine)
 {
-  VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(thePipeLine);
-  if(aPipeLine){
+  if(VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(thePipeLine)){
      SetScale(aPipeLine->GetScale());
      SetScalars(aPipeLine->GetScalars());
      vtkFloatingPointType aRange[2];
      aPipeLine->GetSourceRange(aRange);
      SetScalarRange(aRange);
   }
-  Superclass::ShallowCopy(thePipeLine);
+  Superclass::DoShallowCopy(thePipeLine);
 }
 
 /*!
index fa990596007fde3b9c87539c4ca980d3e76a5beb..b57f0c1bd493c40bf7d89946924530f5b50c66f9 100644 (file)
@@ -38,11 +38,6 @@ class vtkPointDataToCellData;
 class VISU_ScalarMapOnDeformedShapePL : public VISU_ScalarMapPL
 {
 protected:
-  VISU_ScalarMapOnDeformedShapePL();
-  
-  virtual ~VISU_ScalarMapOnDeformedShapePL();
-  
-  VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&);
 public:
   vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL,VISU_ScalarMapPL);
 
@@ -50,10 +45,6 @@ public:
   VISU_ScalarMapOnDeformedShapePL* 
   New();
 
-  virtual 
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   virtual
   void
   SetScale(vtkFloatingPointType theScale);
@@ -112,6 +103,17 @@ public:
   SetMapScale(vtkFloatingPointType theMapScale = 1.0);
   
 protected:
+  VISU_ScalarMapOnDeformedShapePL();
+  
+  virtual
+  ~VISU_ScalarMapOnDeformedShapePL();
+  
+  VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&);
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
+
   vtkFloatingPointType myScaleFactor;
   vtkWarpVector  *myDeformVectors;
   vtkMergeFilter *myMergeFilter;
index 755e45753552f2da6e0dc9847ccbf48299734f4b..e915b3c401a00bc38c16490c489d879e938c1dd0 100644 (file)
@@ -70,7 +70,7 @@ VISU_ScalarMapPL
 //----------------------------------------------------------------------------
 void
 VISU_ScalarMapPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine)
 {
   if(VISU_ScalarMapPL *aPipeLine = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine)){
     SetScalarRange(aPipeLine->GetScalarRange());
@@ -79,7 +79,7 @@ VISU_ScalarMapPL
     SetScaling(aPipeLine->GetScaling());
     SetMapScale(aPipeLine->GetMapScale());
   }
-  Superclass::ShallowCopy(thePipeLine);
+  Superclass::DoShallowCopy(thePipeLine);
 }
 
 
@@ -153,9 +153,10 @@ void
 VISU_ScalarMapPL
 ::SetScalarRange(vtkFloatingPointType theRange[2])
 {
-  myFieldTransform->SetScalarRange(theRange);
-  myBarTable->SetRange(theRange);
-  Modified();
+  if(!VISU::CheckIsSameRange(GetScalarRange(), theRange)){
+    myFieldTransform->SetScalarRange(theRange);
+    myBarTable->SetRange(theRange);
+  }
 }
 
 void
@@ -163,7 +164,8 @@ VISU_ScalarMapPL
 ::SetScalarMin(vtkFloatingPointType theValue)
 {
   vtkFloatingPointType aScalarRange[2] = {theValue, GetScalarRange()[1]};
-  SetScalarRange(aScalarRange);
+  if(!VISU::CheckIsSameRange(GetScalarRange(), aScalarRange))
+    SetScalarRange(aScalarRange);
 }
 
 void
@@ -171,7 +173,8 @@ VISU_ScalarMapPL
 ::SetScalarMax(vtkFloatingPointType theValue)
 {
   vtkFloatingPointType aScalarRange[2] = {GetScalarRange()[0], theValue};
-  SetScalarRange(aScalarRange);
+  if(!VISU::CheckIsSameRange(GetScalarRange(), aScalarRange))
+    SetScalarRange(aScalarRange);
 }
 
 
@@ -244,19 +247,22 @@ void
 VISU_ScalarMapPL
 ::Update() 
 { 
-  vtkFloatingPointType *aRange = myFieldTransform->GetScalarRange();
+  vtkFloatingPointType *aRange = GetScalarRange();
   vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
   if(myBarTable->GetScale() == VTK_SCALE_LOG10)
-    VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
-  myMapperTable->SetRange(aScalarRange);
+    VISU_LookupTable::ComputeLogRange(aRange, aScalarRange);
+
+  if(!VISU::CheckIsSameRange(myMapperTable->GetTableRange(), aScalarRange))
+    myMapperTable->SetRange(aScalarRange);
 
   myMapperTable->Build();
   myBarTable->Build();
 
   myMapper->SetLookupTable(myMapperTable);
-  myMapper->SetScalarRange(aScalarRange);
+  if(!VISU::CheckIsSameRange(myMapper->GetScalarRange(), aScalarRange))
+    myMapper->SetScalarRange(aScalarRange);
 
-  VISU_PipeLine::Update();
+  Superclass::Update();
 }
 
 
index fb7be40a889f2e60102b705c6fa858dc833a279b..97720d6860d43839059c97b836edf1f2858d6b2c 100644 (file)
@@ -56,10 +56,6 @@ public:
   VISU_ScalarMapPL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   //----------------------------------------------------------------------------
   virtual
   int
@@ -148,6 +144,10 @@ protected:
   typedef vtkDataSet THook;
   virtual THook* DoHook();
 
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
+
   VISU_LookupTable* myMapperTable;
   VISU_LookupTable* myBarTable;
   VISU_FieldTransform* myFieldTransform;
index 62cd50b49ba9ac2dc2fecc51a8af57198ac6ba32..b0b238057e85515ab6feea9a35e4a6925bf8dd85 100644 (file)
@@ -50,7 +50,9 @@ static vtkFloatingPointType aCoeffOfIntStep = 1.0E+1;
 
 vtkStandardNewMacro(VISU_StreamLinesPL);
 
-VISU_StreamLinesPL::VISU_StreamLinesPL(){
+VISU_StreamLinesPL
+::VISU_StreamLinesPL()
+{
   myStream = vtkStreamLine::New();
   myCenters = vtkCellCenters::New();
   myGeomFilter = VTKViewer_GeometryFilter::New();
@@ -59,7 +61,9 @@ VISU_StreamLinesPL::VISU_StreamLinesPL(){
   mySource = NULL;
 }
 
-VISU_StreamLinesPL::~VISU_StreamLinesPL(){
+VISU_StreamLinesPL
+::~VISU_StreamLinesPL()
+{
   myPointsFilter->UnRegisterAllOutputs();
   myPointsFilter->Delete();
 
@@ -73,7 +77,10 @@ VISU_StreamLinesPL::~VISU_StreamLinesPL(){
   myStream->Delete();
 }
 
-void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
+void
+VISU_StreamLinesPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine)
+{
   if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine)){
     SetParams(aPipeLine->GetIntegrationStep(),
              aPipeLine->GetPropagationTime(),
@@ -82,7 +89,7 @@ void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
              aPipeLine->GetUsedPoints(),
              aPipeLine->GetDirection());
   }
-  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
+  Superclass::DoShallowCopy(thePipeLine);
 }
 
 
index bf45db45651520e17f263f1c62f7dbd08b04fdb8..35cee6ab0db5c985113250f2e839adf3ba6e69ed 100644 (file)
@@ -53,10 +53,6 @@ public:
   VISU_StreamLinesPL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   virtual
   size_t 
   SetParams(vtkFloatingPointType theIntStep, 
@@ -197,6 +193,10 @@ public:
             vtkFloatingPointType thePercents = 0.3);
 
 protected:
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
+
   static 
   size_t
   GetNecasseryMemorySize(vtkIdType theNbOfPoints, 
index f6976ad33432648b506e0b1c609bd1cdea041637..813b4116387c15172b4c416cf0ce94da0aa549b6 100644 (file)
@@ -72,13 +72,13 @@ VISU_VectorsPL
 
 void
 VISU_VectorsPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine)
 {
   if(VISU_VectorsPL *aPipeLine = dynamic_cast<VISU_VectorsPL*>(thePipeLine)){
     SetGlyphType(aPipeLine->GetGlyphType());
     SetGlyphPos(aPipeLine->GetGlyphPos());
   }
-  Superclass::ShallowCopy(thePipeLine);
+  Superclass::DoShallowCopy(thePipeLine);
 }
 
 
index 38f8baaa379738f4d67963146fef77fdd17ba693..b8b3e6eaf763ff81de8a119d74e0ebc7cec8a75b 100644 (file)
@@ -55,10 +55,6 @@ public:
   VISU_VectorsPL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   virtual
   void
   SetScale(vtkFloatingPointType theScale);
@@ -121,6 +117,10 @@ protected:
   THook* 
   DoHook();
 
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine);
+
   GlyphType myTypeGlyph;
   GlyphPos myPosGlyph;
   vtkGlyph3D *myBaseGlyph;