]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To improve Create, Restore and SameAs methods, namely
authorapo <apo@opencascade.com>
Fri, 7 Oct 2005 17:32:22 +0000 (17:32 +0000)
committerapo <apo@opencascade.com>
Fri, 7 Oct 2005 17:32:22 +0000 (17:32 +0000)
- first, create a corresponding pipeline by calling virtual DoHook method,
- next, call Build method initialize input of the pipeline

src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_ScalarMap_i.cc

index d6a8349888bd4bbb8fe2758ca06ec0643027aa6c..9325460c6a82f92d9a541b0c850c2b8904f52f75 100644 (file)
@@ -83,8 +83,6 @@ VISU::ColoredPrs3d_i
 {
   DoHook();
 
-  TSuperClass::SameAs(theOrigin);
-
   ColoredPrs3d_i* anOrigin = const_cast<ColoredPrs3d_i*>(theOrigin);
  
   myField = anOrigin->GetField();
@@ -93,6 +91,10 @@ VISU::ColoredPrs3d_i
   myIteration = anOrigin->GetIteration();
   myFieldName = anOrigin->GetFieldName();
 
+  Build(-1);
+
+  TSuperClass::SameAs(theOrigin);
+
   SetScalarMode(anOrigin->GetScalarMode());
   SetNbColors(anOrigin->GetNbColors());
   SetBarOrientation(anOrigin->GetBarOrientation());
@@ -406,7 +408,14 @@ VISU::ColoredPrs3d_i
         const char* theFieldName, 
         int theIteration)
 {
-  DoHook();
+  DoHook(); // to create proper pipeline
+
+  myMeshName = theMeshName;
+  myEntity = (VISU::TEntity)theEntity;
+  myFieldName =theFieldName;
+  myIteration = theIteration;
+
+  Build(false); // to get corresponding input from result and initilize the pipeline
 
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
 
@@ -490,13 +499,6 @@ VISU::ColoredPrs3d_i
   myLabelColor[0] = aLabelColor.red()   / 255;
   myLabelColor[1] = aLabelColor.green() / 255;
   myLabelColor[2] = aLabelColor.blue()  / 255;
-
-  myMeshName = theMeshName;
-  myEntity = (VISU::TEntity)theEntity;
-  myFieldName =theFieldName;
-  myIteration = theIteration;
-  
-  return Build(false);
 }
 
 VISU::Storable* 
@@ -505,17 +507,19 @@ VISU::ColoredPrs3d_i
 {
   DoHook();
 
+  myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
+  myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
+  myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
+  myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt();
+
+  Build(true);
+
   TSuperClass::Restore(theMap);
 
   SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
   SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
   SetBarOrientation((VISU::ScalarMap::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
   
-  myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
-  myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
-  myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
-  myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt();
-
   myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1();
   myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
   myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
@@ -541,7 +545,7 @@ VISU::ColoredPrs3d_i
 
   myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
 
-  return Build(true);
+  return this;
 }
 
 void 
index b9d60abb4491496353e49a8af06cc646fe378954..70593b23d071b03fd55d69f38ae3a59a882947fc 100644 (file)
@@ -442,6 +442,7 @@ VISU::GaussPoints_i
     throw std::runtime_error("There is no TimeStamp with the parameters !!!");
 
   myGaussPointsPL->SetGaussPtsIDMapper(aGaussPtsIDMapper);
+  myScalarMapPL->Init();
   myGaussPointsPL->Build();
 }
 
@@ -544,14 +545,13 @@ VISU::GaussPoints_i
       myPipeLine->GetMapper()->SetScalarVisibility(1);
 
       if(VISU_ScalarBarCtrl *aScalarBarCtrl = anActor->GetScalarBarCtrl()){
-       vtkIdType aScalarMode = GetScalarMode();
-       TMinMax aTMinMax = myField->GetMinMax(aScalarMode);
        float aRange[2];
        myScalarMapPL->GetSourceRange(aRange);
-       //float *aRange = myScalarMapPL->GetBarTable()->GetRange();
+       aScalarBarCtrl->SetRangeLocal(aRange);
 
+       vtkIdType aScalarMode = GetScalarMode();
+       TMinMax aTMinMax = myField->GetMinMax(aScalarMode);
        aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second);
-       aScalarBarCtrl->SetRangeLocal(aRange);
 
        aScalarBarCtrl->SetOrientation(myOrientation);
 
index c4a51a50e1388bd1561c41f72bc4438b7b6feaf7..da9ea7773f3d947eb23a4be7d849d93c0ee5aec3 100644 (file)
@@ -134,7 +134,6 @@ VISU::ScalarMap_i
 
   SetScaling(anOrigin->GetScaling());
 
-  Build(-1);
   Update();
 }
 
@@ -279,6 +278,7 @@ VISU::ScalarMap_i
     throw std::runtime_error("There is no TimeStamp with the parameters !!!");
 
   myScalarMapPL->SetIDMapper(anIDMapper);
+  myScalarMapPL->Init();
   myScalarMapPL->Build();
 }