]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
1. To improve ShallowCopy functionality
authorapo <apo@opencascade.com>
Fri, 7 Oct 2005 17:29:12 +0000 (17:29 +0000)
committerapo <apo@opencascade.com>
Fri, 7 Oct 2005 17:29:12 +0000 (17:29 +0000)
 - first shallow copy itself,
 - then shallow copy base class
This order of function call gives us possibility to summize all settings by calling Build function

2. Improve Update functionality in the same as ShallowCopy, namely
 - first updates its own properties,
 - then updates base class properties.
This order of function call gives us possibility to summize all settings

src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_GaussPointsPL.hxx
src/PIPELINE/VISU_IsoSurfacesPL.cxx
src/PIPELINE/VISU_Plot3DPL.cxx
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_VectorsPL.cxx

index 2207f492480b66c83c80f619d8ebe9681c8043ae..7f53c95166b1f3dc2ef28bf7d0beda7274d84e3f 100644 (file)
@@ -37,7 +37,6 @@ vtkStandardNewMacro(VISU_CutLinesPL);
 VISU_CutLinesPL::VISU_CutLinesPL(){}
 
 void VISU_CutLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_CutPlanesPL::ShallowCopy(thePipeLine);
   if(VISU_CutLinesPL *aPipeLine = dynamic_cast<VISU_CutLinesPL*>(thePipeLine)){
     SetOrientation(aPipeLine->GetPlaneOrientation(1),
                   aPipeLine->GetRotateX(1),aPipeLine->GetRotateY(1),1);
@@ -45,6 +44,7 @@ void VISU_CutLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
     SetDefault();
     if (!aPipeLine->IsDefault()) SetPosition(aPipeLine->GetPosition());
   }
+  VISU_CutPlanesPL::ShallowCopy(thePipeLine);
 }
 
 void VISU_CutLinesPL::Init(){
index 32fb5612307055610971a80f8f5cab0e5662f0d8..63dd3e5a42966a4dee8b3c794f1fe08e2b8a42a2 100644 (file)
@@ -49,7 +49,6 @@ VISU_CutPlanesPL::~VISU_CutPlanesPL(){
 }
 
 void VISU_CutPlanesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
   if(VISU_CutPlanesPL *aPipeLine = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine)){
     SetOrientation(aPipeLine->GetPlaneOrientation(),
                   aPipeLine->GetRotateX(),aPipeLine->GetRotateY());
@@ -58,6 +57,7 @@ void VISU_CutPlanesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
     for (int i = 0, iend = GetNbParts(); i < iend; i++)
       if(!aPipeLine->IsPartDefault(i))         SetPartPosition(i, aPipeLine->GetPartPosition(i));
   }
+  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
 void VISU_CutPlanesPL::Init(){
index c276548df7820aa02e608f686d19ac9fd9e3f663..913feb183f3169a9428edd9cea55d1b67ef165bc 100644 (file)
@@ -47,10 +47,10 @@ VISU_DeformedShapePL::~VISU_DeformedShapePL(){
 }
 
 void VISU_DeformedShapePL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
   if(VISU_DeformedShapePL *aPipeLine = dynamic_cast<VISU_DeformedShapePL*>(thePipeLine)){
     SetScale(aPipeLine->GetScale());
   }
+  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
 float VISU_DeformedShapePL::GetScaleFactor(vtkDataSet* theDataSet){
index c605cdbb260f9ba560ddb6bf9fbc52a8e5060229..f339f45db9316c324ff70cb4d6a58824f3d8b4b3 100644 (file)
@@ -62,7 +62,6 @@ void
 VISU_GaussPointsPL
 ::ShallowCopy(VISU_PipeLine *thePipeLine)
 {
-  Superclass::ShallowCopy(thePipeLine);
   if(VISU_GaussPointsPL *aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
     SetGaussPtsIDMapper(aPipeLine->GetGaussPtsIDMapper());
     
@@ -79,8 +78,8 @@ VISU_GaussPointsPL
     SetMagnification(aPipeLine->GetMagnification());
     SetMagnificationIncrement(aPipeLine->GetMagnificationIncrement());
     SetAlphaThreshold(aPipeLine->GetAlphaThreshold());
-    Init();
   }
+  Superclass::ShallowCopy(thePipeLine);
 }
 
 
@@ -122,15 +121,15 @@ VISU_GaussPointsPL
 
   myGeomFilter->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
   myPSMapper->SetInput( myGeomFilter->GetOutput() );
+
+  SetSourceRange();
 }
 
 //----------------------------------------------------------------------------
-void 
+void
 VISU_GaussPointsPL
-::Init()
+::Update()
 {
-  VISU_ScalarMapPL::Init();
-
   GetSourceRange(mySourceScalarRange);
   myDeltaScalarRange = mySourceScalarRange[1] - mySourceScalarRange[0];
 
@@ -140,17 +139,11 @@ VISU_GaussPointsPL
 
   vtkCellData* aCellData = aDataSet->GetCellData();
   myScalarArray = aCellData->GetScalars();
-}
-
-//----------------------------------------------------------------------------
-void
-VISU_GaussPointsPL
-::Update()
-{
-  VISU_ScalarMapPL::Update();
 
   myPSMapper->SetLookupTable( myMapperTable );
-  myPSMapper->SetScalarRange( myMapperTable->GetRange() );
+  myPSMapper->SetScalarRange( mySourceScalarRange );
+
+  VISU_ScalarMapPL::Update();
 }
 
 //----------------------------------------------------------------------------
index 0a310f08273837187cc6eedbc3815e1976c7238e..dd8f4ea830654b1debea5c63aa86ba4124a9b7be 100644 (file)
@@ -66,10 +66,6 @@ public:
   void
   Build();
 
-  virtual
-  void
-  Init();
-
   virtual
   void
   Update();
index 7462ff51024f04e81bda3dc35be7ae4dbf4a932d..c3ffd9b4e29b2f3c3cb5c00aad1e64ffdcda5fc6 100644 (file)
@@ -48,12 +48,12 @@ VISU_IsoSurfacesPL::~VISU_IsoSurfacesPL(){
 }
 
 void VISU_IsoSurfacesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
   if(VISU_IsoSurfacesPL *aPipeLine = dynamic_cast<VISU_IsoSurfacesPL*>(thePipeLine)){
     SetNbParts(aPipeLine->GetNbParts());
     float aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()};
     SetRange(aRange);
   }
+  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
 int VISU_IsoSurfacesPL::GetNbParts() {
index a7e8287e0931b2bc34d1a9430c91c1e0fb21e6f1..164d9a7ac6fb06377105d9c7d98417f243364dd4 100644 (file)
@@ -68,7 +68,6 @@ void
 VISU_Plot3DPL::
 ShallowCopy(VISU_PipeLine *thePipeLine)
 {
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
   if(VISU_Plot3DPL *aPipeLine = dynamic_cast<VISU_Plot3DPL*>(thePipeLine)){
     SetOrientation (aPipeLine->GetPlaneOrientation(),
                     aPipeLine->GetRotateX(), aPipeLine->GetRotateY());
@@ -78,6 +77,7 @@ ShallowCopy(VISU_PipeLine *thePipeLine)
     SetContourPrs( aPipeLine->GetIsContourPrs() );
     SetNumberOfContours( aPipeLine->GetNumberOfContours() );
   }
+  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
 VISU_CutPlanesPL::PlaneOrientation
index 1a644c7c378decab74a85c3b9c7d172cc95e70a8..4888d159aa4282c8d762ff3a7c1a07a1a91d28ed 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "VISU_ScalarMapPL.hxx"
 #include "VISU_PipeLineUtils.hxx"
+#include "SALOME_ExtractGeometry.h"
 
 
 //============================================================================
@@ -38,8 +39,6 @@ vtkStandardNewMacro(VISU_ScalarMapPL);
 VISU_ScalarMapPL
 ::VISU_ScalarMapPL()
 {
-  myFieldTransform = VISU_FieldTransform::New();
-
   myMapperTable = VISU_LookupTable::New();
   myMapperTable->SetScale(VTK_SCALE_LINEAR);
   myMapperTable->SetHueRange(0.667,0.0);
@@ -49,6 +48,10 @@ VISU_ScalarMapPL
   myBarTable->SetHueRange(0.667,0.0);
 
   myExtractor = VISU_Extractor::New();
+  myExtractor->SetInput(myExtractGeometry->GetOutput());
+
+  myFieldTransform = VISU_FieldTransform::New();
+  myFieldTransform->SetInput(myExtractor->GetOutput());
 
   myIsShrinkable = true;
 }
@@ -74,7 +77,6 @@ VISU_ScalarMapPL
     SetScalarMode(aPipeLine->GetScalarMode());
     SetNbColors(aPipeLine->GetNbColors());
     SetScaling(aPipeLine->GetScaling());
-    Update();
   }
   Superclass::ShallowCopy(thePipeLine);
 }
@@ -205,15 +207,13 @@ void
 VISU_ScalarMapPL
 ::Init()
 {
-  //SetSourceRange();
+  SetSourceRange();
 }
 
 void
 VISU_ScalarMapPL
 ::Build() 
 {
-  myExtractor->SetInput(GetInput2());
-  myFieldTransform->SetInput(myExtractor->GetOutput());
   myMapper->SetInput(DoHook());
   Update();
 }
index 9b9f781e77b42214f5bfbfc1e445b3d9b6db1647..6690dc42d80fbce38cd2b2d3fb9941783b3ac879 100644 (file)
@@ -74,14 +74,15 @@ VISU_StreamLinesPL::~VISU_StreamLinesPL(){
 }
 
 void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
-  if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine))
+  if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine)){
     SetParams(aPipeLine->GetIntegrationStep(),
              aPipeLine->GetPropagationTime(),
              aPipeLine->GetStepLength(),
              aPipeLine->GetSource(),
              aPipeLine->GetUsedPoints(),
              aPipeLine->GetDirection());
+  }
+  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
 }
 
 
index c34d36d9de8c7aaa94e0dd53497450ddf1489917..9ffb775a68cc914bd8a38fb312f826d81086932f 100644 (file)
@@ -70,11 +70,11 @@ VISU_VectorsPL::~VISU_VectorsPL(){
 }
 
 void VISU_VectorsPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
   if(VISU_VectorsPL *aPipeLine = dynamic_cast<VISU_VectorsPL*>(thePipeLine)){
     SetGlyphType(aPipeLine->GetGlyphType());
     SetGlyphPos(aPipeLine->GetGlyphPos());
   }
+  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
 }