From: apo Date: Mon, 27 Nov 2006 06:37:03 +0000 (+0000) Subject: Bug fixing X-Git-Tag: WP1_2_3_05-12-2006_cache_system~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c1b30befe7cec783cdc9ca720ffa35009b50496b;p=modules%2Fvisu.git Bug fixing --- diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index 0e7f6fc5..c4c4cd75 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -188,40 +188,42 @@ VISU_PipeLine myMapper->Update(); } -int -VISU_PipeLine -::CheckAvailableMemory(const vtkFloatingPointType& theSize) -{ - try{ - if(theSize > ULONG_MAX) return 0; - size_t aSize = size_t(theSize); - char *aCheck = new char[aSize]; - if(aCheck) delete [] aCheck; - if(MYDEBUG && aCheck == NULL) - MESSAGE("CheckAvailableMemory("< theMinSize) - theSize /= 2; + // Finds acceptable memory size by half-deflection methods + static size_t EPSILON = 2 * 1024; + size_t aMax = std::max(theSize, theMinSize); + size_t aMin = std::min(theSize, theMinSize); + cout<<"GetAvailableMemory - "< 0 && (aMax - aMin) > EPSILON){ + size_t aRoot = (aMax + aMin) / 2; + if(CheckAvailableMemory(aRoot)) + aMin = aRoot; else - return 0; - return theSize; + aMax = aRoot; + } + cout<<"; "<GetNumberOfPoints(); - vtkFloatingPointType aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents); - int isPoss = CheckAvailableMemory(aSize); - if(!isPoss){ + size_t aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents); + size_t anIsPossible = CheckAvailableMemory(aSize); + if(!anIsPossible){ vtkFloatingPointType aMaxStepLength = max(GetMaxStepLength(theDataSet),thePropogationTime); vtkFloatingPointType aMinStepLength = GetMinStepLength(theDataSet); vtkFloatingPointType aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease; @@ -144,13 +144,13 @@ VISU_StreamLinesPL } aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents); if(CheckAvailableMemory(aSize)){ - isPoss = i; + anIsPossible = i; break; } } } - if(MYDEBUG) MESSAGE("FindPossibleParams - aSize = "<::TResult TColoredPrs3d; TColoredPrs3d* aColoredPrs3d = dynamic_cast(thePrs3d); TColoredPrs3d* aSameColoredPrs3d = new TColoredPrs3d(VISU::ColoredPrs3d_i::EPublishUnderTimeStamp); + aSameColoredPrs3d->SetCResult(aColoredPrs3d->GetCResult()); + aSameColoredPrs3d->SetMeshName(aColoredPrs3d->GetCMeshName().c_str()); + aSameColoredPrs3d->SetEntity(aColoredPrs3d->GetEntity()); + aSameColoredPrs3d->SetFieldName(aColoredPrs3d->GetCFieldName().c_str()); + aSameColoredPrs3d->SetTimeStampNumber(aColoredPrs3d->GetTimeStampNumber()); aSameColoredPrs3d->SameAs(aColoredPrs3d); } @@ -3307,12 +3308,9 @@ void VisuGUI::OnPlot3dFromCutPlane() void VisuGUI::OnCacheProperties() { - CORBA::Object_var anObject = GetSelectedObj( this ); - if( CORBA::is_nil( anObject ) ) - return; - - VISU::ColoredPrs3dCache_i* aCache = dynamic_cast(VISU::GetServant(anObject).in()); - if( !aCache ) + CORBA::Object_var anObject = GetSelectedObj(this); + VISU::ColoredPrs3dCache_var aCache = VISU::GetInterface(anObject); + if( CORBA::is_nil( aCache ) ) return; VisuGUI_CacheDlg* aDlg = new VisuGUI_CacheDlg( this, diff --git a/src/VISUGUI/VisuGUI_CacheDlg.cxx b/src/VISUGUI/VisuGUI_CacheDlg.cxx index 2ee018b5..617b0836 100644 --- a/src/VISUGUI/VisuGUI_CacheDlg.cxx +++ b/src/VISUGUI/VisuGUI_CacheDlg.cxx @@ -30,7 +30,6 @@ #include "VisuGUI_Tools.h" #include "VISU_PipeLine.hxx" -#include "VISU_ColoredPrs3dCache_i.hh" #include "SUIT_Desktop.h" #include "SUIT_MessageBox.h" diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 12b5523b..f6029722 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -28,8 +28,9 @@ #ifndef VisuGUI_Prs3dTools_HeaderFile #define VisuGUI_Prs3dTools_HeaderFile +#include "VISUConfig.hh" +#include "VisuGUI_Tools.h" #include "VisuGUI_ViewTools.h" -#include "VisuGUI_DialogRunner.h" #include "VISU_ColoredPrs3dFactory.hh" #include "VISU_ColoredPrs3dCache_i.hh" @@ -37,18 +38,6 @@ namespace VISU { - class ColoredPrs3d_i; - class CutLines_i; - - //--------------------------------------------------------------- - inline - int - runAndWait( QDialog* dlg, const bool modal ) - { - VisuGUI_DialogRunner r( dlg ); - return r.run( modal ); - } - //--------------------------------------------------------------- template void @@ -301,16 +290,24 @@ namespace VISU //---------------------------------------------------------------------------- - VISU::Prs3d_i* - GetPrs3d(CORBA::Object_ptr theObject) + template + typename TInterface::_var_type + GetInterface(CORBA::Object_ptr theObject) + { + if(!CORBA::is_nil(theObject)) + return TInterface::_narrow(theObject); + return TInterface::_nil(); + } + + + //---------------------------------------------------------------------------- + template + TServant* + GetServantInterface(CORBA::Object_ptr theObject) { if(!CORBA::is_nil(theObject)){ - VISU::Base_var aBase = VISU::Base::_narrow(theObject); - if(!CORBA::is_nil(aBase)){ - PortableServer::ServantBase_var aServant = VISU::GetServant(aBase); - if(aServant.in()) - return dynamic_cast(aServant.in()); - } + PortableServer::ServantBase_var aServant = GetServant(theObject); + return dynamic_cast(aServant.in()); } return NULL; } diff --git a/src/VISUGUI/VisuGUI_Slider.cxx b/src/VISUGUI/VisuGUI_Slider.cxx index 25f61d9f..12682cbe 100644 --- a/src/VISUGUI/VisuGUI_Slider.cxx +++ b/src/VISUGUI/VisuGUI_Slider.cxx @@ -80,6 +80,11 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule, myMainWindow( theViewWindow->getMainWindow1() ), mySelectionMgr( theSelectionMgr ) { + VISU::ViewManager_var aViewManager = VISU::GetVisuGen( myModule )->GetViewManager(); + VISU::View_var aView = aViewManager->GetCurrentView(); + if(!CORBA::is_nil(aView.in())) + myView3D = VISU::View3D::_narrow(aView); + //SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); setHorizontallyStretchable( true ); @@ -207,26 +212,23 @@ VisuGUI_Slider::~VisuGUI_Slider() void VisuGUI_Slider::enableControls( bool on ) { - //mySlider->setMinValue( 0 ); - //mySlider->setMaxValue( 0 ); - //mySlider->setValue( 0 ); - + widget()->setEnabled( on ); if( on ) { - myTimeStampStrings->clear(); - myTimeStampIndices->clear(); - - if( myHolderList.size() == 0 ) + if( myHolderList.empty() ) return; - VISU::ColoredPrs3dHolder_var aHolder = myHolderList[0]; - VISU::ColoredPrs3d_var aPrs = aHolder->GetDevice(); + myTimeStampStrings->clear(); + myTimeStampIndices->clear(); - CORBA::Long aTimeStampNumber = aPrs->GetTimeStampNumber(); - VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = aPrs->GetTimeStampsRange(); + VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front(); + VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = aHolder->GetTimeStampsRange(); CORBA::Long aLength = aTimeStampsRange->length(); + VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput(); + CORBA::Long aTimeStampNumber = anInput->myTimeStampNumber; + mySlider->setMinValue( 0 ); mySlider->setMaxValue( aLength-1 ); @@ -234,40 +236,40 @@ void VisuGUI_Slider::enableControls( bool on ) myLastTimeStamp->setText( aTimeStampsRange[aLength-1].myTime.in() ); myTimeStampsNumber->setText( QString("(") + QString::number( aLength ) + ")" ); - int current = 0; - for( int index = 0; index < aLength; index++ ) + CORBA::Long a_current_index = 0; + for( CORBA::Long an_index = 0; an_index < aLength; an_index++ ) { - VISU::ColoredPrs3d::TimeStampInfo anInfo = aTimeStampsRange[ index ]; - long aNumber = anInfo.myNumber; + VISU::ColoredPrs3d::TimeStampInfo anInfo = aTimeStampsRange[ an_index ]; + CORBA::Long aNumber = anInfo.myNumber; QString aTime = anInfo.myTime.in(); myTimeStampStrings->insertItem( aTime ); myTimeStampIndices->insertItem( QString::number( aNumber ) ); if( aNumber == aTimeStampNumber ) - current = index; + a_current_index = an_index; } - - mySlider->setValue( current ); + myTimeStampStrings->setFont(myTimeStampStrings->font()); + myTimeStampStrings->updateGeometry(); + + myTimeStampIndices->setFont(myTimeStampStrings->font()); + myTimeStampIndices->updateGeometry(); + + myTimeStampStrings->setCurrentItem( a_current_index ); + myTimeStampIndices->setCurrentItem( a_current_index ); + mySlider->setValue( a_current_index ); } else { myPlayButton->setOn( false ); } - myTimeStampStrings->setFont(myTimeStampStrings->font()); - myTimeStampStrings->updateGeometry(); - - myTimeStampIndices->setFont(myTimeStampStrings->font()); - myTimeStampIndices->updateGeometry(); - - widget()->setEnabled( on ); } void VisuGUI_Slider::onSelectionChanged() { //cout << "VisuGUI_Slider::onSelectionChanged()" << endl; - myHolderList.resize(0); + myHolderList.clear(); _PTR(SObject) aSObject; @@ -277,8 +279,7 @@ void VisuGUI_Slider::onSelectionChanged() SALOME_ListIO aListIO; mySelectionMgr->selectedObjects(aListIO); SALOME_ListIteratorOfListIO anIter(aListIO); - for( int k = 0; anIter.More(); anIter.Next() ) - { + for(; anIter.More(); anIter.Next() ){ Handle(SALOME_InteractiveObject) anIO = anIter.Value(); if (anIO->hasEntry()) { SalomeApp_Study* theStudy = dynamic_cast(anApp->activeStudy()); @@ -293,16 +294,14 @@ void VisuGUI_Slider::onSelectionChanged() if(!CORBA::is_nil(aHolder)) { //cout << "ColoredPrs3dHolder" << endl; - myHolderList.resize(k+1); - myHolderList[k] = aHolder; - k++; + myHolderList.push_back(aHolder); } } } } } - enableControls( myHolderList.size() != 0 ); + enableControls( !myHolderList.empty() ); } void VisuGUI_Slider::onTimeStampActivated( int value ) @@ -359,46 +358,38 @@ void VisuGUI_Slider::onLast() void VisuGUI_Slider::onValueChanged( int value ) { - if( myHolderList.size() == 0 ) + if( myHolderList.empty() ) return; - VISU::ColoredPrs3dHolder_var aHolder = myHolderList[0]; - VISU::ColoredPrs3d_var aPrs = aHolder->GetDevice(); - - VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = aPrs->GetTimeStampsRange(); + VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front(); + VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = aHolder->GetTimeStampsRange(); CORBA::Long aLength = aTimeStampsRange->length(); if(value < 0 || aLength <= value) return; + VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput(); + CORBA::Long aTimeStampNumber = anInput->myTimeStampNumber; CORBA::Long aNumber = aTimeStampsRange[ value ].myNumber; + if(aNumber == aTimeStampNumber) + return; - HolderList::iterator it = myHolderList.begin(); - HolderList::iterator itEnd = myHolderList.end(); - for( ; it != itEnd; ++it ) + THolderList::const_iterator anIter = myHolderList.begin(); + THolderList::const_iterator anIterEnd = myHolderList.end(); + for( ; anIter != anIterEnd; anIter++ ) { - VISU::ColoredPrs3dHolder_var aHolder = *it; + VISU::ColoredPrs3dHolder_var aHolder = *anIter; if( CORBA::is_nil( aHolder.in() ) ) continue; - VISU::ColoredPrs3dHolder::BasicInput* anInput = aHolder->GetBasicInput(); + VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput(); anInput->myTimeStampNumber = aNumber; - VISU::View_var aView = VISU::GetVisuGen( myModule )->GetViewManager()->GetCurrentView(); - if( CORBA::is_nil( aView.in() ) ) - continue; - - VISU::View3D_var aView3D = VISU::View3D::_narrow( aView ); - if( CORBA::is_nil( aView3D.in() ) ) - continue; - - aHolder->Apply( aHolder->GetDevice(), *anInput, aView3D ); + aHolder->Apply( aHolder->GetDevice(), anInput, myView3D ); } myTimeStampStrings->setCurrentItem( value ); myTimeStampIndices->setCurrentItem( value ); - - myMainWindow->Repaint(); } void VisuGUI_Slider::onSpeedChanged( int value ) diff --git a/src/VISUGUI/VisuGUI_Slider.h b/src/VISUGUI/VisuGUI_Slider.h index f4473268..bc86ba67 100644 --- a/src/VISUGUI/VisuGUI_Slider.h +++ b/src/VISUGUI/VisuGUI_Slider.h @@ -39,8 +39,6 @@ namespace VISU class ColoredPrs3dHolder_i; } -typedef std::vector HolderList; - class QCheckBox; class QComboBox; class QLabel; @@ -91,6 +89,7 @@ private: VisuGUI_Module* myModule; VVTK_MainWindow* myMainWindow; LightApp_SelectionMgr* mySelectionMgr; + VISU::View3D_var myView3D; QSlider* mySlider; QLabel* myFirstTimeStamp; @@ -112,8 +111,8 @@ private: QTimer* myTimer; - //PrsList myPrsList; - HolderList myHolderList; + typedef std::vector THolderList; + THolderList myHolderList; }; #endif diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 9b2d8e73..f4da70ae 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -27,9 +27,11 @@ #include "VisuGUI_Tools.h" +#include "VisuGUI_ViewTools.h" +#include "VisuGUI_Prs3dTools.h" +#include "VisuGUI_DialogRunner.h" #include "VisuGUI.h" -#include "VisuGUI_ViewTools.h" #include "VISU_Gen_i.hh" #include "VISU_Prs3d_i.hh" @@ -72,18 +74,21 @@ //============================================================================= namespace VISU { + //------------------------------------------------------------ SUIT_Desktop* GetDesktop(const CAM_Module* theModule) { return theModule->application()->desktop(); } + //------------------------------------------------------------ LightApp_SelectionMgr* GetSelectionMgr(const SalomeApp_Module* theModule) { return theModule->getApp()->selectionMgr(); } + //------------------------------------------------------------ SalomeApp_Study* GetAppStudy(const CAM_Module* theModule) { @@ -91,12 +96,14 @@ namespace VISU dynamic_cast(theModule->application()->activeStudy()); } + //------------------------------------------------------------ _PTR(Study) GetCStudy(const SalomeApp_Study* theStudy) { return theStudy->studyDS(); } + //------------------------------------------------------------ bool IsStudyLocked( _PTR(Study) theStudy ) { @@ -105,6 +112,7 @@ namespace VISU return true; } + //------------------------------------------------------------ bool CheckLock( _PTR(Study) theStudy, QWidget* theWidget ) @@ -119,6 +127,15 @@ namespace VISU return false; } + //------------------------------------------------------------ + int + runAndWait( QDialog* dlg, const bool modal ) + { + VisuGUI_DialogRunner r( dlg ); + return r.run( modal ); + } + + //------------------------------------------------------------ LightApp_DataObject* FindDataObject(SUIT_DataObject* theDataObject, const QString& theEntry, @@ -146,6 +163,7 @@ namespace VISU return NULL; } + //------------------------------------------------------------ LightApp_DataObject* FindDataObject(CAM_Module* theModule, _PTR(SObject) theSObject) @@ -160,6 +178,7 @@ namespace VISU return FindDataObject(aRootDataObject,anEntry.c_str(),aLevel); } + //------------------------------------------------------------ void UpdateObjBrowser(SalomeApp_Module* theModule, bool theIsUpdateDataModel, @@ -173,6 +192,7 @@ namespace VISU theModule->getApp()->updateActions(); } + //------------------------------------------------------------ bool IsSObjectTable( _PTR(SObject) theSObject ) { @@ -186,6 +206,7 @@ namespace VISU return false; } + //------------------------------------------------------------ VISU_Gen_i* GetVisuGen(const CAM_Module* theModule) { @@ -204,6 +225,7 @@ namespace VISU return aGen; } + //------------------------------------------------------------ SALOME_MED::MED_Gen_var GetMEDEngine() { @@ -219,7 +241,9 @@ namespace VISU } - VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject) + //------------------------------------------------------------ + VISU::Storable::TRestoringMap + getMapOfValue(_PTR(SObject) theSObject) { VISU::Storable::TRestoringMap aMap; if (theSObject) { @@ -234,7 +258,9 @@ namespace VISU return aMap; } - QString getValue (_PTR(SObject) theSObject, QString theKey) + //------------------------------------------------------------ + QString + getValue(_PTR(SObject) theSObject, QString theKey) { QString aStr(""); VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject); @@ -268,6 +294,7 @@ namespace VISU return CORBA::Object::_nil(); } + //------------------------------------------------------------ CORBA::Object_var GetSelectedObj(const SalomeApp_Module* theModule, Handle(SALOME_InteractiveObject)* theIO, @@ -287,6 +314,7 @@ namespace VISU return CORBA::Object::_nil(); } + //------------------------------------------------------------ VISU::Prs3d_i* GetPrsToModify(const SalomeApp_Module* theModule, Handle(SALOME_InteractiveObject)* theIO, @@ -296,24 +324,18 @@ namespace VISU return NULL; CORBA::Object_var anObject = GetSelectedObj(theModule, theIO); - if (CORBA::is_nil(anObject)) - return NULL; - - PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); - if (!aServant.in()) - return NULL; - - VISU::Base_i* aBase = dynamic_cast(aServant.in()); - if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER){ - VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject); - VISU::ColoredPrs3d_var aColoredPrs3d = aHolder->GetDevice(); - aServant = VISU::GetServant(aColoredPrs3d); - aBase = dynamic_cast(aServant.in()); + if(VISU::Base_i* aBase = GetServantInterface(anObject)){ + if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER){ + VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject); + VISU::ColoredPrs3d_var aColoredPrs3d = aHolder->GetDevice(); + aBase = dynamic_cast(GetServant(aColoredPrs3d).in()); + } + return dynamic_cast(aBase); } - - return dynamic_cast(aBase); + return NULL; } + //------------------------------------------------------------ void Add(LightApp_SelectionMgr* theSelectionMgr, const Handle(SALOME_InteractiveObject)& theIO) @@ -324,6 +346,7 @@ namespace VISU theSelectionMgr->setSelectedObjects(aListIO); } + //------------------------------------------------------------ void Remove(LightApp_SelectionMgr* theSelectionMgr, const Handle(SALOME_InteractiveObject)& theIO) @@ -341,9 +364,8 @@ namespace VISU theSelectionMgr->setSelectedObjects(aNewListIO); } - /*! - * Restores selection after presentation creating and editing - */ + //------------------------------------------------------------ + //! Restores selection after presentation creating and editing void RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d) { @@ -455,6 +477,7 @@ namespace VISU return true; } + //------------------------------------------------------------ void DeleteSObject(VisuGUI* theModule, _PTR(Study) theStudy, @@ -484,6 +507,7 @@ namespace VISU } } + //------------------------------------------------------------ void DeletePrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs) @@ -499,79 +523,54 @@ namespace VISU thePrs->RemoveFromStudy(); } + //------------------------------------------------------------ // Presentation management - void ChangeRepresentation (const SalomeApp_Module* theModule, VISU::PresentationType theType) { - SVTK_ViewWindow* vw = GetActiveViewWindow(theModule); - if (!vw) - return; - - Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO); - if (CORBA::is_nil(anObject)) return; - - VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject); - if (CORBA::is_nil(aVisuObj)) return; - - PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); - if (!aServant.in()) return; - - VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in()); - if (aPrs3d) { - if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) { - switch (theType) { - case VISU::SHRINK: - if (anActor->IsShrunk()) - anActor->UnShrink(); - else - anActor->SetShrink(); - break; - default: - if (VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d)) { - aMesh->SetPresentationType(theType); - RecreateActor(theModule, aMesh); - } else { - anActor->SetRepresentation(theType); - } - } - vw->Repaint(); + if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(theModule)){ + if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(theModule)){ + if (VISU_Actor* anActor = GetActor(aPrs3d, aViewWindow)) { + switch (theType) { + case VISU::SHRINK: + if (anActor->IsShrunk()) + anActor->UnShrink(); + else + anActor->SetShrink(); + break; + default: + if (VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d)) { + aMesh->SetPresentationType(theType); + RecreateActor(theModule, aMesh); + } else { + anActor->SetRepresentation(theType); + } + } + aViewWindow->Repaint(); + } } } } + //------------------------------------------------------------ void SetShading ( const SalomeApp_Module* theModule, bool theOn ) { - SVTK_ViewWindow* vw = GetActiveViewWindow(theModule); - if (!vw) - return; - - Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO); - if (CORBA::is_nil(anObject)) return; - - VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject); - if (CORBA::is_nil(aVisuObj)) return; - - PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); - if (!aServant.in()) return; - - VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in()); - if (aPrs3d) { - if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) { - if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast(anActor) ) - aScalarMapActor->SetShading( theOn ); + if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(theModule)){ + if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(theModule)){ + if (VISU_Actor* anActor = GetActor(aPrs3d, aViewWindow)) { + if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast(anActor) ) + aScalarMapActor->SetShading( theOn ); + } + aViewWindow->Repaint(); } - vw->Repaint(); } } + //------------------------------------------------------------ // SObject type - bool CheckTimeStamp(const SalomeApp_Module* theModule, _PTR(SObject)& theSObject, @@ -600,6 +599,7 @@ namespace VISU return false; } + //------------------------------------------------------------ VISU::Result_i* CheckResult(const SalomeApp_Module* theModule, _PTR(SObject) theSource, @@ -635,8 +635,8 @@ namespace VISU return dynamic_cast(VISU::GetServant(anObject).in()); } + //------------------------------------------------------------ // VTK View - VISU_Actor* PublishMeshInView(const SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs, @@ -661,6 +661,7 @@ namespace VISU return aActor; } + //------------------------------------------------------------ void RepaintViewWindows (const SalomeApp_Module* theModule, const Handle(SALOME_InteractiveObject)& theIObject) @@ -688,6 +689,7 @@ namespace VISU } } + //------------------------------------------------------------ VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, const char* theEntry) @@ -703,6 +705,7 @@ namespace VISU return NULL; } + //------------------------------------------------------------ VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs) @@ -715,6 +718,7 @@ namespace VISU return NULL; } + //------------------------------------------------------------ void RecreateActor (const SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs) @@ -740,6 +744,7 @@ namespace VISU QApplication::restoreOverrideCursor(); } + //------------------------------------------------------------ static bool ComputeVisiblePropBounds(SVTK_ViewWindow* theViewWindow, @@ -778,6 +783,7 @@ namespace VISU return somethingVisible; } + //------------------------------------------------------------ void SetFitAll(SVTK_ViewWindow* theViewWindow) { static vtkFloatingPointType PRECISION = 0.000001; @@ -839,6 +845,7 @@ namespace VISU return NULL; } + //------------------------------------------------------------ // Internal function used by several public functions below void UpdateCurve(VISU::Curve_i* theCurve, @@ -892,6 +899,7 @@ namespace VISU } } + //------------------------------------------------------------ void PlotTable(const SalomeApp_Module* theModule, VISU::Table_i* table, @@ -941,6 +949,7 @@ namespace VISU } } + //------------------------------------------------------------ void PlotCurve(const SalomeApp_Module* theModule, VISU::Curve_i* theCurve, @@ -974,6 +983,7 @@ namespace VISU aPlot->Repaint(); } + //------------------------------------------------------------ void PlotRemoveCurve(const SalomeApp_Module* theModule, VISU::Curve_i* pCrv) @@ -1001,6 +1011,7 @@ namespace VISU } } + //------------------------------------------------------------ void PlotContainer(const SalomeApp_Module* theModule, VISU::Container_i* container, @@ -1036,6 +1047,7 @@ namespace VISU aPlot->Repaint(); } + //------------------------------------------------------------ void CreatePlot(SalomeApp_Module* theModule, _PTR(SObject) theTableSO) @@ -1290,6 +1302,7 @@ namespace VISU return aList; } + //------------------------------------------------------------ int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow) { int minIndx = 1; @@ -1311,6 +1324,7 @@ namespace VISU return minIndx; } + //------------------------------------------------------------ void AddScalarBarPosition (VisuGUI* theModule, SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d, int pos) { @@ -1319,6 +1333,7 @@ namespace VISU aMap[theViewWindow].insert(aPair); } + //------------------------------------------------------------ void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d) { @@ -1330,4 +1345,5 @@ namespace VISU return; } } + //------------------------------------------------------------ } diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index c68ffffc..41647fcb 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -39,6 +39,7 @@ #include CORBA_SERVER_HEADER(MED_Gen) class QWidget; +class QDialog; class SUIT_Desktop; class SUIT_ViewWindow; @@ -71,6 +72,8 @@ namespace VISU bool CheckLock( _PTR(Study) theStudy, QWidget* theWidget ); + int runAndWait( QDialog* dlg, const bool modal ); + void UpdateObjBrowser(SalomeApp_Module* theModule, bool theIsUpdateDataModel = true, _PTR(SObject) theSObject = _PTR(SObject)()); @@ -83,12 +86,15 @@ namespace VISU // Selection LightApp_SelectionMgr* GetSelectionMgr(const SalomeApp_Module* theModule); + CORBA::Object_var GetSelectedObj(const SalomeApp_Study* theStudy, const QString& theEntry, VISU::Storable::TRestoringMap* theMap = NULL); + CORBA::Object_var GetSelectedObj(const SalomeApp_Module* theModule, Handle(SALOME_InteractiveObject)* theIO = NULL, VISU::Storable::TRestoringMap* theMap = NULL); + VISU::Prs3d_i* GetPrsToModify(const SalomeApp_Module* theModule, Handle(SALOME_InteractiveObject)* theIO = NULL, VISU::Storable::TRestoringMap* theMap = NULL); diff --git a/src/VISU_I/VISUConfig.hh b/src/VISU_I/VISUConfig.hh index cbfb9157..5464c505 100644 --- a/src/VISU_I/VISUConfig.hh +++ b/src/VISU_I/VISUConfig.hh @@ -76,6 +76,8 @@ namespace VISU public virtual PortableServer::RefCountServantBase { public: + typedef VISU::Base TInterface; + Base_i(); virtual ~Base_i(); virtual char* GetID(); diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index 93af6996..5a18f0be 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -43,8 +43,6 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif -static int INCMEMORY = 4; - static int MEMORY_UNIT = 1000; //---------------------------------------------------------------------------- @@ -92,8 +90,9 @@ VISU::ColoredPrs3dCache_i //---------------------------------------------------------------------------- template -int -CheckIsPossible(const VISU::ColoredPrs3dHolder::BasicInput& theInput) +size_t +CheckIsPossible(const VISU::ColoredPrs3dHolder::BasicInput& theInput, + bool theMemoryCheck) { VISU::Result_i* aResult = dynamic_cast( VISU::GetServant(theInput.myResult).in() ); std::string aMeshName = theInput.myMeshName.in(); @@ -102,7 +101,12 @@ CheckIsPossible(const VISU::ColoredPrs3dHolder::BasicInput& theInput) CORBA::Long aTimeStampNumber = theInput.myTimeStampNumber; typedef typename VISU::TL::TColoredEnum2Type::TResult TColoredPrs3d; - return TColoredPrs3d::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); + return TColoredPrs3d::IsPossible(aResult, + aMeshName, + anEntity, + aFieldName, + aTimeStampNumber, + theMemoryCheck); } @@ -110,85 +114,62 @@ CheckIsPossible(const VISU::ColoredPrs3dHolder::BasicInput& theInput) int VISU::ColoredPrs3dCache_i ::IsPossible(VISU::VISUType theType, - const VISU::ColoredPrs3dHolder::BasicInput& theInput, - bool theMemoryCheck) + const VISU::ColoredPrs3dHolder::BasicInput& theInput) { //cout << "VISU::ColoredPrs3dCache_i::IsPossible " << endl; - bool anIsPossible = false; + size_t aMemoryNeeded = 0; switch(theType){ case TSCALARMAP: - anIsPossible = CheckIsPossible(theInput); + aMemoryNeeded = CheckIsPossible(theInput, true); + break; case TGAUSSPOINTS: - anIsPossible = CheckIsPossible(theInput); + aMemoryNeeded = CheckIsPossible(theInput, true); + break; case TDEFORMEDSHAPE: - anIsPossible = CheckIsPossible(theInput); + aMemoryNeeded = CheckIsPossible(theInput, true); + break; case TSCALARMAPONDEFORMEDSHAPE: - anIsPossible = CheckIsPossible(theInput); + aMemoryNeeded = CheckIsPossible(theInput, true); + break; case TISOSURFACE: - anIsPossible = CheckIsPossible(theInput); + aMemoryNeeded = CheckIsPossible(theInput, true); + break; case TSTREAMLINES: - anIsPossible = CheckIsPossible(theInput); + aMemoryNeeded = CheckIsPossible(theInput, true); + break; case TPLOT3D: - anIsPossible = CheckIsPossible(theInput); + aMemoryNeeded = CheckIsPossible(theInput, true); + break; case TCUTPLANES: - anIsPossible = CheckIsPossible(theInput); + aMemoryNeeded = CheckIsPossible(theInput, true); + break; case TCUTLINES: - anIsPossible = CheckIsPossible(theInput); + aMemoryNeeded = CheckIsPossible(theInput, true); + break; case TVECTORS: - anIsPossible = CheckIsPossible(theInput); + aMemoryNeeded = CheckIsPossible(theInput, true); + break; } - - if( anIsPossible && theMemoryCheck ) - { - //cout << "Memory checking..." << endl; - if( GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED ) - { - long aMemoryUsed = 0; - - VISU::ColoredPrs3d_i* aPrs3d; - TColoredPrs3dHolderMap::iterator aMapIterator = myHolderMap.begin(); - TColoredPrs3dHolderMap::iterator aMapIteratorEnd = myHolderMap.end(); - for(; aMapIterator != aMapIteratorEnd; ++aMapIterator) - { - TLastVisitedPrsList aList = aMapIterator->second; - - TLastVisitedPrsList::iterator it = aList.begin(); - TLastVisitedPrsList::iterator itEnd = aList.end(); - for(; it != itEnd; ++it) - { - aPrs3d = *it; - if( aPrs3d ) + if(aMemoryNeeded > 0){ + if(GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED){ + size_t aMemoryUsed = 0; + TColoredPrs3dHolderMap::const_iterator aHolderIter = myHolderMap.begin(); + TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = myHolderMap.end(); + for(; aHolderIter != aHolderIterEnd; aHolderIter++){ + const TLastVisitedPrsList& aPrsList = aHolderIter->second; + TLastVisitedPrsList::const_iterator aPrsIter = aPrsList.begin(); + TLastVisitedPrsList::const_iterator aPrsIterEnd = aPrsList.end(); + for(; aPrsIter != aPrsIterEnd; aPrsIter++){ + if(VISU::ColoredPrs3d_i* aPrs3d = *aPrsIter) aMemoryUsed += aPrs3d->GetMemorySize(); } } - - long aMemoryLimit = GetLimitedMemory() * MEMORY_UNIT; - - //cout << "Cache memory : " << aMemoryLimit << endl; - //cout << "Memory used : " << aMemoryUsed << endl; - - VISU::Result_i* aResult = dynamic_cast( VISU::GetServant(theInput.myResult).in() ); - std::string aMeshName = theInput.myMeshName.in(); - VISU::Entity anEntity = theInput.myEntity; - std::string aFieldName = theInput.myFieldName.in(); - long aTimeStampNumber = theInput.myTimeStampNumber; - - VISU::Result_i::TInput* anInput = aResult->GetInput(); - float aMemoryNeeded = anInput->GetTimeStampSize(aMeshName, - (VISU::TEntity)anEntity, - aFieldName, - aTimeStampNumber); - aMemoryNeeded *= INCMEMORY; - //cout << "Memory needed : " << aMemoryNeeded << endl; - - if( aMemoryUsed + aMemoryNeeded > aMemoryLimit ) - anIsPossible = false; + size_t aMemoryLimit = GetLimitedMemory() * MEMORY_UNIT; + //cout<<"Memory needed: "< 0; } @@ -353,7 +334,7 @@ VISU::ColoredPrs3dCache_i VISU::ColoredPrs3dHolder_i* theHolder) { thePrs3d->SetHolderEntry( theHolder->GetEntry() ); - GetLastVisitedPrsList(theHolder).push_back(thePrs3d); + GetLastVisitedPrsList(theHolder).push_front(thePrs3d); return thePrs3d; } @@ -387,7 +368,7 @@ VISU::ColoredPrs3dCache_i { TLastVisitedPrsList aList = GetLastVisitedPrsList(theHolder); if( !aList.empty() ) - return aList.back(); + return aList.front(); return NULL; } @@ -399,28 +380,23 @@ VISU::ColoredPrs3dCache_i ::FindPrsByInput(TLastVisitedPrsList& theLastVisitedPrsList, const VISU::ColoredPrs3dHolder::BasicInput& theInput) { - //cout << "VISU::ColoredPrs3dCache_i::FindPrsByInput() "; - VISU::ColoredPrs3d_i* aPrs3d = NULL; - VISU::ColoredPrs3dHolder::BasicInput_var anInput; - TLastVisitedPrsList::iterator it = theLastVisitedPrsList.begin(); - TLastVisitedPrsList::iterator itEnd = theLastVisitedPrsList.end(); - for(; it != itEnd; ++it) + // User reverse iteration to start from last visited items + TLastVisitedPrsList::iterator anIter = theLastVisitedPrsList.begin(); + TLastVisitedPrsList::iterator aEndIter = theLastVisitedPrsList.end(); + for(; anIter != aEndIter; anIter++) { - aPrs3d = *it; - anInput = aPrs3d->GetBasicInput(); - + VISU::ColoredPrs3d_i* aPrs3d = *anIter; + VISU::ColoredPrs3dHolder::BasicInput_var anInput = aPrs3d->GetBasicInput(); if(anInput->myResult->_is_equivalent(theInput.myResult) && !strcmp(anInput->myMeshName.in(), theInput.myMeshName.in()) && anInput->myEntity == theInput.myEntity && !strcmp(anInput->myFieldName.in(), theInput.myFieldName.in()) && anInput->myTimeStampNumber == theInput.myTimeStampNumber ) { - //cout << "returns " << aPrs3d->GetName() << endl; + theLastVisitedPrsList.erase(anIter); return aPrs3d; } } - - //cout << "returns NULL" << endl; return NULL; } @@ -434,32 +410,38 @@ VISU::ColoredPrs3dCache_i VISU::View3D_ptr theView3D) { //cout << "VISU::ColoredPrs3dCache_i::UpdateLastVisitedPrs" << endl; + VISU::ColoredPrs3d_i* aLastVisitedPrs3d = GetLastVisitedPrs(theHolder); TLastVisitedPrsList& aLastVisitedPrsList = GetLastVisitedPrsList(theHolder); VISU::ColoredPrs3d_i* aPrs3d = FindPrsByInput(aLastVisitedPrsList, theInput); - if(aPrs3d) - { - aLastVisitedPrsList.pop_front(); - } - else if(IsPossible(theHolder->GetPrsType(), theInput, true)) - { + bool anIsCheckPossible = GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED; + if(aPrs3d){ + aLastVisitedPrsList.push_front(aPrs3d); + //cout << "FindPrsByInput " << aPrs3d; + }else if(anIsCheckPossible && IsPossible(theHolder->GetPrsType(), theInput)){ aPrs3d = CreatePrs(theHolder->GetPrsType(), theInput, theHolder); - //cout << "Created " << aPrs3d->GetName() << endl; - } - else - { - //cout << "Move only" << endl; - aPrs3d = aLastVisitedPrsList.front(); - aLastVisitedPrsList.pop_front(); + //cout << "Created " << aPrs3d; + }else{ + aPrs3d = aLastVisitedPrsList.back(); + aLastVisitedPrsList.pop_back(); + aLastVisitedPrsList.push_front(aPrs3d); + //cout << "Move only " << aPrs3d; } - aLastVisitedPrsList.push_back(aPrs3d); + //cout << "; " << aLastVisitedPrsList.size() << endl; + aPrs3d->SetResultObject(theInput.myResult); + aPrs3d->SetMeshName(theInput.myMeshName); + aPrs3d->SetEntity(theInput.myEntity); + aPrs3d->SetFieldName(theInput.myFieldName); + aPrs3d->SetTimeStampNumber(theInput.myTimeStampNumber); aPrs3d->SameAs(thePrs); - - if(aPrs3d && !CORBA::is_nil(theView3D)) - { - //cout << "Display " << aPrs3d->GetName() << endl; - VISU::ColoredPrs3d_var aColoredPrs3d = aPrs3d->_this(); - theView3D->DisplayOnly(aColoredPrs3d); + if(!CORBA::is_nil(theView3D)){ + if(aPrs3d != aLastVisitedPrs3d){ + VISU::ColoredPrs3d_var aColoredPrs3d = aLastVisitedPrs3d->_this(); + theView3D->Erase(aColoredPrs3d); + aColoredPrs3d = aPrs3d->_this(); + theView3D->Display(aColoredPrs3d); + }else + theView3D->Update(); return true; } diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh index ad847d82..4eb1f3cb 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh @@ -158,8 +158,7 @@ namespace VISU //---------------------------------------------------------------------------- virtual int IsPossible(VISU::VISUType theType, - const VISU::ColoredPrs3dHolder::BasicInput& theInput, - bool theMemoryCheck = false); + const VISU::ColoredPrs3dHolder::BasicInput& theInput); VISU::ColoredPrs3d_i* FindPrsByInput(TLastVisitedPrsList& theLastVisitedPrsList, diff --git a/src/VISU_I/VISU_ColoredPrs3dFactory.hh b/src/VISU_I/VISU_ColoredPrs3dFactory.hh index cd7a6a3e..3dac4d94 100644 --- a/src/VISU_I/VISU_ColoredPrs3dFactory.hh +++ b/src/VISU_I/VISU_ColoredPrs3dFactory.hh @@ -203,7 +203,7 @@ namespace VISU const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - CORBA::Long theIteration) + CORBA::Long theTimeStampNumber) { typedef typename TPrs3d_i::TInterface TPrs3d; typename TPrs3d::_var_type aPrs3d; @@ -213,10 +213,10 @@ namespace VISU if(aStudy->GetProperties()->IsLocked()) return NULL; - if(TPrs3d_i::IsPossible(aResult, theMeshName, theEntity, theFieldName, theIteration)){ + if(TPrs3d_i::IsPossible(aResult, theMeshName, theEntity, theFieldName, theTimeStampNumber, true)){ TPrs3d_i* aPresent = new TPrs3d_i(ColoredPrs3d_i::EPublishUnderTimeStamp); - if(CreatColoredPrs3d(aPresent, aResult, theMeshName, theEntity, theFieldName, theIteration)) + if(CreatColoredPrs3d(aPresent, aResult, theMeshName, theEntity, theFieldName, theTimeStampNumber)) return aPresent; aPresent->_remove_ref(); @@ -227,21 +227,21 @@ namespace VISU //---------------------------------------------------------------------------- - template typename TPrs3d_i::TInterface::_var_type + template + typename TPrs3d_i::TInterface::_var_type Prs3dOnField(Result_ptr theResult, const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - CORBA::Long theIteration) + CORBA::Long theTimeStampNumber) { - typedef typename TPrs3d_i::TInterface TPrs3d; - typename TPrs3d::_var_type aPrs3d; if(TPrs3d_i* aPrs3d = CreatePrs3d(theResult, theMeshName, theEntity, theFieldName, - theIteration)) + theTimeStampNumber)) return aPrs3d->_this(); + typedef typename TPrs3d_i::TInterface TPrs3d; return TPrs3d::_nil(); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index f6e71de9..0c382e1b 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -35,6 +35,7 @@ #include #include +#include #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -348,20 +349,10 @@ CORBA::Long VISU::ColoredPrs3d_i ::GetMemorySize() { - VISU::Result_i* aResult = dynamic_cast( VISU::GetServant(GetResultObject()).in() ); - std::string aMeshName = GetCMeshName(); - VISU::Entity anEntity = GetEntity(); - std::string aFieldName = GetCFieldName(); - long aTimeStampNumber = GetTimeStampNumber(); - - VISU::Result_i::TInput* anInput = aResult->GetInput(); - float aSize = anInput->GetTimeStampSize(aMeshName, - (VISU::TEntity)anEntity, - aFieldName, - aTimeStampNumber); - aSize *= INCMEMORY; - - return (CORBA::Long)aSize; + vtkDataSet* aDataSet = GetPipeLine()->GetMapper()->GetInput(); + vtkFloatingPointType aSize = aDataSet->GetActualMemorySize() * 1024.0; + vtkFloatingPointType aMemorySize = aSize * INCMEMORY; + return CORBA::Long(aMemorySize); } VISU::ColoredPrs3dHolder::BasicInput* @@ -405,14 +396,8 @@ VISU::ColoredPrs3d_i if(const ColoredPrs3d_i* aPrs3d = dynamic_cast(theOrigin)){ ColoredPrs3d_i* anOrigin = const_cast(aPrs3d); - SetCResult(anOrigin->GetCResult()); - SetMeshName(anOrigin->GetCMeshName().c_str()); - SetEntity(anOrigin->GetEntity()); - SetFieldName(anOrigin->GetCFieldName().c_str()); - SetTimeStampNumber(anOrigin->GetTimeStampNumber()); - OnSetInput(); - - Build(ESameAs); + if(OnSetInput()) + Build(ESameAs); TSuperClass::SameAs(theOrigin); @@ -442,20 +427,6 @@ VISU::ColoredPrs3d_i } } -//---------------------------------------------------------------------------- -void -VISU::ColoredPrs3d_i -::SameAsParams(const ColoredPrs3d_i* theOrigin) -{ - CORBA::Long aTimeStampNumber = GetTimeStampNumber(); - SameAs(theOrigin); - SetTimeStampNumber(aTimeStampNumber); - OnSetInput(); - - Build(ESameAs); - Update(); -} - //---------------------------------------------------------------------------- CORBA::Long VISU::ColoredPrs3d_i @@ -920,7 +891,7 @@ VISU::ColoredPrs3d_i ::Create(const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber) + CORBA::Long theTimeStampNumber) { SetMeshName(theMeshName.c_str()); SetEntity(theEntity); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index ab830a34..f5738ea8 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -45,6 +45,7 @@ namespace VISU public: //---------------------------------------------------------------------------- typedef Prs3d_i TSuperClass; + typedef VISU::ColoredPrs3d TInterface; /*! The enumeration allow to define what mode should be used for the presentation building. @@ -237,7 +238,7 @@ namespace VISU Create(const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber); + CORBA::Long theTimeStampNumber); /*! Retores state of the presentation @@ -260,14 +261,6 @@ namespace VISU void SameAs(const Prs3d_i* theOrigin); - /*! - * \brief Works like SameAs() method, but keep myTimeStampNumber value unchanged. - * - * Is used in VISU_TimeAnimation class implementation. - */ - void - SameAsParams(const ColoredPrs3d_i* theOrigin); - virtual bool IsBoldTitle(); diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index e5db69d2..eba9b965 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -46,21 +46,21 @@ static int MYDEBUG = 0; //--------------------------------------------------------------- -int +size_t VISU::CutLines_i ::IsPossible(Result_i* theResult, const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber, - int isMemoryCheck) + CORBA::Long theTimeStampNumber, + bool theIsMemoryCheck) { return TSuperClass::IsPossible(theResult, theMeshName, theEntity, theFieldName, theTimeStampNumber, - isMemoryCheck); + theIsMemoryCheck); } //--------------------------------------------------------------- @@ -125,7 +125,7 @@ VISU::CutLines_i ::Create(const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber) + CORBA::Long theTimeStampNumber) { return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } @@ -477,7 +477,7 @@ bool VISU::CutLines_i ::CheckIsPossible() { - return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true); } diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index 0a934d5d..fc2c11d1 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -203,13 +203,13 @@ namespace VISU public: //! Extends VISU_ColoredPrs3d_i::IsPossible static - int + size_t IsPossible(Result_i* theResult, const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber, - int isMemoryCheck = true); + CORBA::Long theTimeStampNumber, + bool theIsMemoryCheck); //! Extends VISU_ColoredPrs3d_i::Create virtual @@ -217,7 +217,7 @@ namespace VISU Create(const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber); + CORBA::Long theTimeStampNumber); //! Extends VISU_ColoredPrs3d_i::ToStream virtual diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index 35774065..c19a4b94 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -39,16 +39,16 @@ static int MYDEBUG = 0; //---------------------------------------------------------------------------- -int +size_t VISU::CutPlanes_i ::IsPossible(Result_i* theResult, - const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - int theTimeStampNumber, - int isMemoryCheck) + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theTimeStampNumber, + bool theIsMemoryCheck) { - return TSuperClass::IsPossible(theResult,theMeshName,theEntity,theFieldName,theTimeStampNumber,isMemoryCheck); + return TSuperClass::IsPossible(theResult,theMeshName,theEntity,theFieldName,theTimeStampNumber,theIsMemoryCheck); } @@ -102,9 +102,9 @@ VISU::CutPlanes_i VISU::Storable* VISU::CutPlanes_i ::Create(const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - int theTimeStampNumber) + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theTimeStampNumber) { return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } @@ -285,7 +285,7 @@ bool VISU::CutPlanes_i ::CheckIsPossible() { - return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index e1547929..45f23f9a 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -132,13 +132,13 @@ namespace VISU public: //! Redefines VISU_ColoredPrs3d_i::IsPossible static - int + size_t IsPossible(Result_i* theResult, const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber, - int isMemoryCheck = true); + CORBA::Long theTimeStampNumber, + bool theIsMemoryCheck); //! Redefines VISU_ColoredPrs3d_i::Create virtual @@ -146,7 +146,7 @@ namespace VISU Create(const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber); + CORBA::Long theTimeStampNumber); //! Redefines VISU_ColoredPrs3d_i::ToStream virtual diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index b8d0f05f..9f7f3969 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -44,28 +44,29 @@ static int MYDEBUG = 0; //--------------------------------------------------------------- -int +size_t VISU::DeformedShape_i ::IsPossible(Result_i* theResult, const std::string& theMeshName, - VISU::Entity theEntity, + VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber, - int isMemoryCheck) + CORBA::Long theTimeStampNumber, + bool theIsMemoryCheck) { try{ - bool aResult = TSuperClass::IsPossible(theResult, - theMeshName, - theEntity, - theFieldName, - theTimeStampNumber, - isMemoryCheck); + size_t aResult = TSuperClass::IsPossible(theResult, + theMeshName, + theEntity, + theFieldName, + theTimeStampNumber, + theIsMemoryCheck); if(aResult){ VISU::Result_i::TInput* anInput = theResult->GetInput(); VISU::PField aField = anInput->GetField(theMeshName, (VISU::TEntity)theEntity, theFieldName); - return aField->myNbComp > 1; + if(aField->myNbComp > 1) + return aResult; } }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"<GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity); - bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize); + size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize); MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<GetInput()->GetMeshOnGroupSize(theMeshName,theGroupName); - bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize); + size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize); INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<GetSize(); - bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize); + size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize); MESSAGE("Result_i::IsPossible - CheckAvailableMemory = "<GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theTimeStampNumber); VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); - bool aResult = VISU_StreamLinesPL::IsPossible(aDataSet); + size_t aResult = VISU_StreamLinesPL::IsPossible(aDataSet); MESSAGE("StreamLines_i::IsPossible - aResult = "<GetOffset(aData.myOffset); for (int i = 1; i < aData.myNbFrames; i++) { //jfa 03.08.2005:aData.myPrs[i]->SameAs(aData.myPrs[0]); - aData.myPrs[i]->SameAsParams(aData.myPrs[0]);//jfa 03.08.2005 + aData.myPrs[i]->SameAs(aData.myPrs[0]);//jfa 03.08.2005 } } string aStr = aAnimSObject->GetID(); diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index f7634ac7..5be3f830 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -45,16 +45,16 @@ static int INCMEMORY = 4+12; //--------------------------------------------------------------- -int +size_t VISU::Vectors_i ::IsPossible(Result_i* theResult, const std::string& theMeshName, - VISU::Entity theEntity, + VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber, - int isMemoryCheck) + CORBA::Long theTimeStampNumber, + bool theIsMemoryCheck) { - bool aResult = false; + size_t aResult = 0; try{ aResult = TSuperClass::IsPossible(theResult, theMeshName, @@ -62,7 +62,7 @@ VISU::Vectors_i theFieldName, theTimeStampNumber, false); - if(isMemoryCheck && aResult){ + if(theIsMemoryCheck && aResult){ VISU::Result_i::TInput* anInput = theResult->GetInput(); float aSize = anInput->GetTimeStampSize(theMeshName, (VISU::TEntity)theEntity, @@ -150,7 +150,7 @@ VISU::Vectors_i ::Create(const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber) + CORBA::Long theTimeStampNumber) { return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } @@ -275,7 +275,7 @@ bool VISU::Vectors_i ::CheckIsPossible() { - return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true); } //--------------------------------------------------------------- diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index e83613b7..80bdc051 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -116,12 +116,13 @@ namespace VISU public: //! Redefines VISU_ColoredPrs3d_i::IsPossible static - int IsPossible(Result_i* theResult, - const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - int theTimeStampNumber, - int isMemoryCheck = true); + size_t + IsPossible(Result_i* theResult, + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theTimeStampNumber, + bool theIsMemoryCheck); //! Redefines VISU_ColoredPrs3d_i::Create virtual @@ -129,7 +130,7 @@ namespace VISU Create(const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - int theTimeStampNumber); + CORBA::Long theTimeStampNumber); //! Redefines VISU_ColoredPrs3d_i::ToStream virtual