From: jfa Date: Wed, 12 Dec 2007 11:58:10 +0000 (+0000) Subject: NPAL18277: EDF629: pb. with change of field in Scalar Map on Deformed shape setup. X-Git-Tag: V3_2_9~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ac6d26255c3587801714d73a85e0c6370e559a1;p=modules%2Fvisu.git NPAL18277: EDF629: pb. with change of field in Scalar Map on Deformed shape setup. --- diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 8e94b809..bbbc6bff 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -50,14 +50,14 @@ namespace VISU { //--------------------------------------------------------------- inline - TMinMax + TMinMax GetMinMax(VISU::Result_i* theResult, VISU::PField theField, vtkIdType theCompID) { if(!theResult->IsMinMaxDone()) theResult->GetInput()->BuildMinMax(); - + return theField->GetMinMax(theCompID); } @@ -82,20 +82,20 @@ namespace VISU //--------------------------------------------------------------- struct TSimpleMinMaxController: virtual TVTKMinMaxController { - VISU::Result_i* myResult; - VISU::PField myField; - + VISU::ColoredPrs3d_i* myColoredPrs3d; + TSimpleMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d): - myResult(theColoredPrs3d->GetResult()), - myField(theColoredPrs3d->GetField()) + myColoredPrs3d(theColoredPrs3d) {} - + virtual vtkFloatingPointType GetComponentMin(vtkIdType theCompID) { - if(myField){ - TMinMax aMinMax = GetMinMax(myResult, myField, theCompID); + VISU::PField aField = myColoredPrs3d->GetField(); + if (aField) { + VISU::Result_i* aResult = myColoredPrs3d->GetResult(); + TMinMax aMinMax = GetMinMax(aResult, aField, theCompID); return aMinMax.first; } return TMinMaxController::GetComponentMin(theCompID); @@ -105,8 +105,10 @@ namespace VISU vtkFloatingPointType GetComponentMax(vtkIdType theCompID) { - if(myField){ - TMinMax aMinMax = GetMinMax(myResult, myField, theCompID); + VISU::PField aField = myColoredPrs3d->GetField(); + if (aField) { + VISU::Result_i* aResult = myColoredPrs3d->GetResult(); + TMinMax aMinMax = GetMinMax(aResult, aField, theCompID); return aMinMax.second; } return TMinMaxController::GetComponentMax(theCompID); @@ -166,7 +168,7 @@ VISU::ColoredPrs3d_i } //--------------------------------------------------------------- -void +void VISU::ColoredPrs3d_i ::RemoveFromStudy() { @@ -176,7 +178,7 @@ VISU::ColoredPrs3d_i TRemoveFromStudy(VISU::ColoredPrs3d_i* theRemovable): myRemovable(theRemovable) {} - + virtual void Execute() @@ -208,13 +210,13 @@ VISU::ColoredPrs3d_i myFieldName = anOrigin->GetFieldName(); } Build(-1); - + TSuperClass::SameAs(theOrigin); - + SetScalarMode(anOrigin->GetScalarMode()); SetNbColors(anOrigin->GetNbColors()); SetBarOrientation(anOrigin->GetBarOrientation()); - + SetMinMaxController(anOrigin->GetMinMaxController()); if(anOrigin->IsRangeFixed()) @@ -226,7 +228,7 @@ VISU::ColoredPrs3d_i SetSize(anOrigin->GetWidth(), anOrigin->GetHeight()); SetLabels(anOrigin->GetLabels()); SetTitle(anOrigin->GetTitle()); - + SetBoldTitle(anOrigin->IsBoldTitle()); SetItalicTitle(anOrigin->IsItalicTitle()); SetShadowTitle(anOrigin->IsShadowTitle()); @@ -234,7 +236,7 @@ VISU::ColoredPrs3d_i vtkFloatingPointType r,g,b; anOrigin->GetTitleColor(&r,&g,&b); SetTitleColor(r,g,b); - + SetBoldLabel(anOrigin->IsBoldLabel()); SetItalicLabel(anOrigin->IsItalicLabel()); SetShadowLabel(anOrigin->IsShadowLabel()); @@ -243,13 +245,13 @@ VISU::ColoredPrs3d_i SetLabelColor(r,g,b); } } - + void VISU::ColoredPrs3d_i -::SameAsParams(const ColoredPrs3d_i* theOrigin, - const std::string& theMeshName, +::SameAsParams(const ColoredPrs3d_i* theOrigin, + const std::string& theMeshName, const std::string& theFieldName, - VISU::Entity theEntity, + VISU::Entity theEntity, int theIteration, bool theIsFixedRange) { @@ -260,11 +262,11 @@ VISU::ColoredPrs3d_i int aScalarMode = (const_cast(theOrigin))->GetScalarMode(); SameAs(theOrigin); - + myIsFixedRange = theIsFixedRange; - + Build(-1); - + SetScalarMode(aScalarMode); // mkr : IPAL14030 Update(); @@ -272,7 +274,7 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- -CORBA::Long +CORBA::Long VISU::ColoredPrs3d_i ::GetScalarMode() { @@ -281,19 +283,19 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetScalarMode(CORBA::Long theScalarMode) +::SetScalarMode(CORBA::Long theScalarMode) { myScalarMapPL->SetScalarMode(theScalarMode); } -CORBA::Double +CORBA::Double VISU::ColoredPrs3d_i ::GetMin() { return myScalarMapPL->GetScalarRange()[0]; } -CORBA::Double +CORBA::Double VISU::ColoredPrs3d_i ::GetMax() { @@ -315,9 +317,9 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- bool VISU::ColoredPrs3d_i -::IsRangeFixed() -{ - return myIsFixedRange; +::IsRangeFixed() +{ + return myIsFixedRange; } //---------------------------------------------------------------------------- @@ -338,7 +340,7 @@ VISU::ColoredPrs3d_i } //---------------------------------------------------------------------------- -CORBA::Double +CORBA::Double VISU::ColoredPrs3d_i ::GetSourceMin() { @@ -351,7 +353,7 @@ VISU::ColoredPrs3d_i } //---------------------------------------------------------------------------- -CORBA::Double +CORBA::Double VISU::ColoredPrs3d_i ::GetSourceMax() { @@ -364,7 +366,7 @@ VISU::ColoredPrs3d_i } //---------------------------------------------------------------------------- -vtkFloatingPointType +vtkFloatingPointType VISU::ColoredPrs3d_i ::GetComponentMin(vtkIdType theCompID) { @@ -376,7 +378,7 @@ VISU::ColoredPrs3d_i } //---------------------------------------------------------------------------- -vtkFloatingPointType +vtkFloatingPointType VISU::ColoredPrs3d_i ::GetComponentMax(vtkIdType theCompID) { @@ -410,7 +412,7 @@ VISU::ColoredPrs3d_i ProcessVoidEvent(new TEvent(myScalarMapPL, theNbColors)); } -CORBA::Long +CORBA::Long VISU::ColoredPrs3d_i ::GetNbColors() { @@ -424,54 +426,54 @@ VISU::ColoredPrs3d_i myOrientation = theOrientation; } -VISU::ScalarMap::Orientation +VISU::ScalarMap::Orientation VISU::ColoredPrs3d_i -::GetBarOrientation() +::GetBarOrientation() { return myOrientation; } void VISU::ColoredPrs3d_i -::SetPosition(CORBA::Double X, CORBA::Double Y) -{ - myPosition[0] = X; +::SetPosition(CORBA::Double X, CORBA::Double Y) +{ + myPosition[0] = X; myPosition[1] = Y; } CORBA::Double VISU::ColoredPrs3d_i -::GetPosX() +::GetPosX() { return myPosition[0]; } CORBA::Double VISU::ColoredPrs3d_i -::GetPosY() -{ +::GetPosY() +{ return myPosition[1]; } void VISU::ColoredPrs3d_i -::SetSize(CORBA::Double theWidth, CORBA::Double theHeight) +::SetSize(CORBA::Double theWidth, CORBA::Double theHeight) { - myWidth = theWidth; + myWidth = theWidth; myHeight = theHeight; } CORBA::Double VISU::ColoredPrs3d_i -::GetWidth() +::GetWidth() { return myWidth; } CORBA::Double VISU::ColoredPrs3d_i -::GetHeight() -{ +::GetHeight() +{ return myHeight; } @@ -484,14 +486,14 @@ VISU::ColoredPrs3d_i CORBA::Long VISU::ColoredPrs3d_i -::GetLabels() -{ +::GetLabels() +{ return myNumberOfLabels; } void VISU::ColoredPrs3d_i -::SetTitle(const char* theTitle) +::SetTitle(const char* theTitle) { // mkr : IPAL14030 std::strstream aStream; @@ -510,17 +512,17 @@ VISU::ColoredPrs3d_i } } -char* +char* VISU::ColoredPrs3d_i -::GetTitle() -{ +::GetTitle() +{ return CORBA::string_dup(myTitle.c_str()); } bool VISU::ColoredPrs3d_i -::IsBoldTitle() -{ +::IsBoldTitle() +{ return myIsBoldTitle; } @@ -533,29 +535,29 @@ VISU::ColoredPrs3d_i bool VISU::ColoredPrs3d_i -::IsItalicTitle() -{ +::IsItalicTitle() +{ return myIsItalicTitle; } void VISU::ColoredPrs3d_i ::SetItalicTitle(bool isItalic) -{ +{ myIsItalicTitle = isItalic; } bool VISU::ColoredPrs3d_i -::IsShadowTitle() -{ +::IsShadowTitle() +{ return myIsShadowTitle; } void VISU::ColoredPrs3d_i ::SetShadowTitle(bool isShadow) -{ +{ myIsShadowTitle = isShadow; } @@ -575,24 +577,24 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::GetTitleColor(vtkFloatingPointType* theR, - vtkFloatingPointType* theG, +::GetTitleColor(vtkFloatingPointType* theR, + vtkFloatingPointType* theG, vtkFloatingPointType* theB) { - *theR = myTitleColor[0]; - *theG = myTitleColor[1]; + *theR = myTitleColor[0]; + *theG = myTitleColor[1]; *theB = myTitleColor[2]; } void VISU::ColoredPrs3d_i -::SetTitleColor(vtkFloatingPointType theR, - vtkFloatingPointType theG, +::SetTitleColor(vtkFloatingPointType theR, + vtkFloatingPointType theG, vtkFloatingPointType theB) { - myTitleColor[0] = theR; - myTitleColor[1] = theG; - myTitleColor[2] = theB; + myTitleColor[0] = theR; + myTitleColor[1] = theG; + myTitleColor[2] = theB; } bool @@ -604,14 +606,14 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetBoldLabel(bool isBold) +::SetBoldLabel(bool isBold) { myIsBoldLabel = isBold; } bool VISU::ColoredPrs3d_i -::IsItalicLabel() +::IsItalicLabel() { return myIsItalicLabel; } @@ -625,7 +627,7 @@ VISU::ColoredPrs3d_i bool VISU::ColoredPrs3d_i -::IsShadowLabel() +::IsShadowLabel() { return myIsShadowLabel; } @@ -653,24 +655,24 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::GetLabelColor(vtkFloatingPointType* theR, - vtkFloatingPointType* theG, +::GetLabelColor(vtkFloatingPointType* theR, + vtkFloatingPointType* theG, vtkFloatingPointType* theB) { - *theR = myLabelColor[0]; - *theG = myLabelColor[1]; + *theR = myLabelColor[0]; + *theG = myLabelColor[1]; *theB = myLabelColor[2]; } void VISU::ColoredPrs3d_i -::SetLabelColor(vtkFloatingPointType theR, - vtkFloatingPointType theG, +::SetLabelColor(vtkFloatingPointType theR, + vtkFloatingPointType theG, vtkFloatingPointType theB) { - myLabelColor[0] = theR; - myLabelColor[1] = theG; - myLabelColor[2] = theB; + myLabelColor[0] = theR; + myLabelColor[1] = theG; + myLabelColor[2] = theB; } //---------------------------------------------------------------------------- @@ -685,11 +687,11 @@ VISU::ColoredPrs3d_i /** * Creates ColoredPrs3d and initialises it from resources */ -VISU::Storable* +VISU::Storable* VISU::ColoredPrs3d_i -::Create(const char* theMeshName, +::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const char* theFieldName, int theIteration) { DoHook(); // to create proper pipeline @@ -761,7 +763,7 @@ VISU::ColoredPrs3d_i myTitFontType = VTK_COURIER; else if ( f.family() == "Times" ) myTitFontType = VTK_TIMES; - + myIsBoldTitle = f.bold(); myIsItalicTitle = f.italic(); myIsShadowTitle = f.underline(); @@ -784,7 +786,7 @@ VISU::ColoredPrs3d_i myLblFontType = VTK_COURIER; else if ( f.family() == "Times" ) myLblFontType = VTK_TIMES; - + myIsBoldLabel = f.bold(); myIsItalicLabel = f.italic(); myIsShadowLabel = f.underline(); @@ -799,7 +801,7 @@ VISU::ColoredPrs3d_i return this; } -VISU::Storable* +VISU::Storable* VISU::ColoredPrs3d_i ::Restore(const Storable::TRestoringMap& theMap) { @@ -819,7 +821,7 @@ VISU::ColoredPrs3d_i SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt()); SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt()); SetBarOrientation((VISU::ScalarMap::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt()); - + myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1(); myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt(); myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble(); @@ -846,7 +848,7 @@ VISU::ColoredPrs3d_i return this; } -void +void VISU::ColoredPrs3d_i ::ToStream(std::ostringstream& theStr) { @@ -902,14 +904,14 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- -VISU::Storable* +VISU::Storable* VISU::ColoredPrs3d_i ::Build(int theRestoring) { if(MYDEBUG) MESSAGE("ColoredPrs3d_i::Build - "<Init(); - if(!myIsFixedRange) + if(!myIsFixedRange) myScalarMapPL->SetSourceRange(); const VISU::TValField& aValField = myField->myValField; const VISU::PValForTime aValForTime = aValField.find(myIteration)->second; @@ -938,9 +940,10 @@ VISU::ColoredPrs3d_i aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d", GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp); CORBA::String_var anIOR = GetID(); - CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true); + CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(), + anIOR,myName.c_str(),"",aComment.latin1(),true); mySObject = myStudy->FindObjectIOR(anIOR); - + // Set icon if (GetIconName() != 0) { @@ -961,7 +964,7 @@ VISU::ColoredPrs3d_i throw; } #endif - if(myAddToStudy) + if(myAddToStudy) aStudyBuilder->CommitCommand(); return this; } @@ -970,14 +973,14 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- const VISU::PField& VISU::ColoredPrs3d_i -::GetField() const -{ +::GetField() const +{ return myField; } //---------------------------------------------------------------------------- -CORBA::Boolean +CORBA::Boolean VISU::ColoredPrs3d_i ::IsTimeStampFixed() { @@ -1010,35 +1013,35 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- const std::string& VISU::ColoredPrs3d_i -::GetMeshName() const -{ +::GetMeshName() const +{ return myMeshName; } VISU::Entity VISU::ColoredPrs3d_i -::GetEntity() const -{ +::GetEntity() const +{ return VISU::Entity(myEntity); } const std::string& VISU::ColoredPrs3d_i -::GetFieldName() const -{ +::GetFieldName() const +{ return myFieldName; } int VISU::ColoredPrs3d_i -::GetIteration() const -{ +::GetIteration() const +{ return myIteration; } VISU_ScalarMapPL* VISU::ColoredPrs3d_i ::GetScalarMapPL() -{ +{ return myScalarMapPL; }