From 63aa1ff3179faf125e2798a9a182d31b8c85a45d Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 7 Oct 2005 17:32:22 +0000 Subject: [PATCH] To improve Create, Restore and SameAs methods, namely - 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 | 36 +++++++++++++++++-------------- src/VISU_I/VISU_GaussPoints_i.cc | 8 +++---- src/VISU_I/VISU_ScalarMap_i.cc | 2 +- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index d6a83498..9325460c 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -83,8 +83,6 @@ VISU::ColoredPrs3d_i { DoHook(); - TSuperClass::SameAs(theOrigin); - ColoredPrs3d_i* anOrigin = const_cast(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 diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index b9d60abb..70593b23 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -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); diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index c4a51a50..da9ea777 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -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(); } -- 2.39.2