From 677ce619eaf304f8c5354bd59a442401ad58f195 Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 3 Aug 2005 12:41:45 +0000 Subject: [PATCH] Publish Animation: publish presentation type always with comment; solve pb with incorrect show of published presentation --- src/VISU_I/VISU_ScalarMap_i.cc | 49 +++++++++++++++++++------------ src/VISU_I/VISU_ScalarMap_i.hh | 7 +++++ src/VISU_I/VISU_TimeAnimation.cxx | 14 +++++---- 3 files changed, 45 insertions(+), 25 deletions(-) diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 7f8fcf5c..b943952e 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -144,6 +144,17 @@ void VISU::ScalarMap_i::SameAs(const ScalarMap_i* theOrigin) Update(); } +void VISU::ScalarMap_i::SameAsParams (const ScalarMap_i* theOrigin) +{ + int time = GetIteration(); + SameAs(theOrigin); + myIteration = time; + + //??Build(true); + Build(-1); + Update(); +} + /** * Creates Scalar Map and initialises it from resources @@ -157,7 +168,7 @@ VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0); SetScalarMode(aScalarMode); - + // Orientation int orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0); if (orient == 1) @@ -171,15 +182,15 @@ VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity float aXorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.01 : 0.2; aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin); myPosition[0] = aXorigin; - + float aYorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.1 : 0.012; aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin); myPosition[1] = aYorigin; - + // Scalar Bar size myWidth = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.1 : 0.6; myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth); - + myHeight = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.8:0.12; myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight); @@ -189,7 +200,7 @@ VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity // Nb of Labels myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 ); - + // Scalar Range int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0); myIsFixedRange = (rangeType == 1) ? true : false; @@ -200,9 +211,9 @@ VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0); SetRange(aMin,aMax); } - + bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false); - + if( isLog ) SetScaling(VISU::LOGARITHMIC); else @@ -211,53 +222,53 @@ VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity // Fonts properties definition myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true; myTitFontType = VTK_ARIAL; - + if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) ) { QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" ); - + if ( f.family() == "Arial" ) myTitFontType = VTK_ARIAL; else if ( f.family() == "Courier" ) myTitFontType = VTK_COURIER; else if ( f.family() == "Times" ) myTitFontType = VTK_TIMES; - + myIsBoldTitle = f.bold(); myIsItalicTitle = f.italic(); myIsShadowTitle = f.underline(); } - + QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) ); - - myTitleColor[0] = aTextColor.red() / 255; + + myTitleColor[0] = aTextColor.red() / 255; myTitleColor[1] = aTextColor.green() / 255; myTitleColor[2] = aTextColor.blue() / 255; - + /// myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true; myLblFontType = VTK_ARIAL; - + if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) ) { QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" ); - + if ( f.family() == "Arial" ) myLblFontType = VTK_ARIAL; else if ( f.family() == "Courier" ) myLblFontType = VTK_COURIER; else if ( f.family() == "Times" ) myLblFontType = VTK_TIMES; - + myIsBoldLabel = f.bold(); myIsItalicLabel = f.italic(); myIsShadowLabel = f.underline(); } QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) ); - - myLabelColor[0] = aLabelColor.red() / 255; + + myLabelColor[0] = aLabelColor.red() / 255; myLabelColor[1] = aLabelColor.green() / 255; myLabelColor[2] = aLabelColor.blue() / 255; diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index ee67e302..ec5a60c1 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -124,6 +124,13 @@ namespace VISU{ typedef VISU::ScalarMap TInterface; VISU_ScalarMapPL* GetScalarMapPL(){ return myScalarMapPL;} + /*! + * \brief Works like SameAs() method, but keep myIteration value unchanged. + * + * Is used in VISU_TimeAnimation class implementation. + */ + void SameAsParams (const ScalarMap_i* theOrigin); + protected: Storable* Build(int theRestoring); virtual void DoHook(); diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index d75e4845..abb4672c 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -215,7 +215,7 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) { } break; - case VISU::TPLOT3D: // Cut Planes + case VISU::TPLOT3D: // Plot3d { VISU::Plot3D_i* aPresent = new VISU::Plot3D_i (pResult, false); aPresent->Create(aMeshName.latin1(), anEntity, @@ -666,15 +666,16 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy() _PTR(SObject) newObj = aStudyBuilder->NewObject(aAnimSObject); aStudyBuilder->Addreference(newObj, aData.myField); if (aData.myPrs.empty()) { - VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","", - GetPresentationComment(aData.myPrsType).c_str(),"","",true); - } else { + generatePresentations(i); + //VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","", + // GetPresentationComment(aData.myPrsType).c_str(),"","",true); + }// else { ostringstream strOut; aData.myPrs[0]->ToStream(strOut); string aPrsComment = strOut.str(); VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","", aData.myPrs[0]->GetComment(),"",aPrsComment.c_str(),true); - } + //} } aStudyBuilder->CommitCommand(); @@ -815,7 +816,8 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) } aData.myPrs[0]->GetOffset(aData.myOffset); for (int i = 1; i < aData.myNbFrames; i++) { - aData.myPrs[i]->SameAs(aData.myPrs[0]); + //jfa 03.08.2005:aData.myPrs[i]->SameAs(aData.myPrs[0]); + aData.myPrs[i]->SameAsParams(aData.myPrs[0]);//jfa 03.08.2005 } } string aStr = aAnimSObject->GetID(); -- 2.39.2