mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-02 21:00:34 +05:00
PAL16774,PAL16631(SALOME crash after a mesh computation that failed because of lack of memory)
Catch exceptions during visualization
This commit is contained in:
parent
f0331f699b
commit
17429a9441
@ -1290,22 +1290,27 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
|
|
||||||
extractContainers( sel_objects, to_process );
|
extractContainers( sel_objects, to_process );
|
||||||
|
|
||||||
if (vtkwnd) {
|
try {
|
||||||
SALOME_ListIteratorOfListIO It( to_process );
|
if (vtkwnd) {
|
||||||
for (; It.More(); It.Next()) {
|
SALOME_ListIteratorOfListIO It( to_process );
|
||||||
Handle(SALOME_InteractiveObject) IOS = It.Value();
|
for (; It.More(); It.Next()) {
|
||||||
if (IOS->hasEntry()) {
|
Handle(SALOME_InteractiveObject) IOS = It.Value();
|
||||||
SMESH::UpdateView(anAction, IOS->getEntry());
|
if (IOS->hasEntry()) {
|
||||||
if (anAction == SMESH::eDisplayOnly)
|
SMESH::UpdateView(anAction, IOS->getEntry());
|
||||||
anAction = SMESH::eDisplay;
|
if (anAction == SMESH::eDisplayOnly)
|
||||||
}
|
anAction = SMESH::eDisplay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// PAL13338 + PAL15161 -->
|
// PAL13338 + PAL15161 -->
|
||||||
if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy) /*&& !automaticUpdate()*/ )
|
if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy))
|
||||||
SMESH::UpdateView();
|
SMESH::UpdateView();
|
||||||
// PAL13338 + PAL15161 <--
|
// PAL13338 + PAL15161 <--
|
||||||
|
}
|
||||||
|
catch (...) { // PAL16774 (Crash after display of many groups)
|
||||||
|
SMESH::OnVisuException();
|
||||||
|
}
|
||||||
|
|
||||||
if (anAction == SMESH::eErase) {
|
if (anAction == SMESH::eErase) {
|
||||||
SALOME_ListIO l1;
|
SALOME_ListIO l1;
|
||||||
@ -1364,82 +1369,6 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
if (checkLock(aStudy)) break;
|
if (checkLock(aStudy)) break;
|
||||||
|
|
||||||
startOperation( 701 );
|
startOperation( 701 );
|
||||||
// LightApp_SelectionMgr *Sel = selectionMgr();
|
|
||||||
// SALOME_ListIO selected; Sel->selectedObjects( selected );
|
|
||||||
|
|
||||||
// int nbSel = selected.Extent();
|
|
||||||
// if (nbSel != 1) {
|
|
||||||
// SUIT_MessageBox::warn1(desktop(),
|
|
||||||
// tr("SMESH_WRN_WARNING"),
|
|
||||||
// tr("SMESH_WRN_NO_AVAILABLE_DATA"),
|
|
||||||
// tr("SMESH_BUT_OK"));
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// SMESH::SMESH_Mesh_var aMesh;
|
|
||||||
// SMESH::SMESH_subMesh_var aSubMesh;
|
|
||||||
// Handle(SALOME_InteractiveObject) IObject = selected.First();
|
|
||||||
// if (IObject->hasEntry()) {
|
|
||||||
// _PTR(SObject) aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
|
|
||||||
// GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj );
|
|
||||||
// if ( aShapeObject->_is_nil() ) {
|
|
||||||
// // imported mesh
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// if ( aMeshSObj ) {
|
|
||||||
// aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj);
|
|
||||||
// aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj);
|
|
||||||
// if ( !aSubMesh->_is_nil() )
|
|
||||||
// aMesh = aSubMesh->GetFather();
|
|
||||||
|
|
||||||
// if (!aMesh->_is_nil()) {
|
|
||||||
// SMESH::algo_error_array_var errors = GetSMESHGen()->GetAlgoState(aMesh,aShapeObject);
|
|
||||||
// if ( errors->length() > 0 ) {
|
|
||||||
// SUIT_MessageBox::warn1(desktop(),
|
|
||||||
// tr("SMESH_WRN_WARNING"),
|
|
||||||
// SMESH::GetMessageOnAlgoStateErrors( errors.in() ),
|
|
||||||
// tr("SMESH_BUT_OK"));
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// if (GetSMESHGen()->Compute(aMesh, aShapeObject))
|
|
||||||
// SMESH::ModifiedMesh(aMeshSObj, true);
|
|
||||||
// else
|
|
||||||
// SUIT_MessageBox::warn1(desktop(),
|
|
||||||
// tr("SMESH_WRN_WARNING"),
|
|
||||||
// tr("SMESH_WRN_COMPUTE_FAILED"),
|
|
||||||
// tr("SMESH_BUT_OK"));
|
|
||||||
// }
|
|
||||||
// catch(const SALOME::SALOME_Exception & S_ex){
|
|
||||||
// SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// updateObjBrowser();
|
|
||||||
|
|
||||||
// if (automaticUpdate()) {
|
|
||||||
// SVTK_ViewWindow* aVTKView = SMESH::GetViewWindow(this, /*create*/true);
|
|
||||||
// if (aVTKView) {
|
|
||||||
// CORBA::Long anId = aStudy->StudyId();
|
|
||||||
// TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId, IObject->getEntry());
|
|
||||||
// if (aVisualObj) {
|
|
||||||
// aVisualObj->Update();
|
|
||||||
// SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
|
|
||||||
// if (!anActor) {
|
|
||||||
// anActor = SMESH::CreateActor(aStudy, IObject->getEntry());
|
|
||||||
// if (anActor) {
|
|
||||||
// SMESH::DisplayActor(aVTKView, anActor); //apo
|
|
||||||
// SMESH::FitAll();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// SMESH::RepaintCurrentView();
|
|
||||||
// Sel->setSelectedObjects( selected );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "SMESHGUI_HypothesesUtils.h"
|
#include "SMESHGUI_HypothesesUtils.h"
|
||||||
|
|
||||||
#include "SMDS_SetIterator.hxx"
|
#include "SMDS_SetIterator.hxx"
|
||||||
|
#include <SMDS_Mesh.hxx>
|
||||||
|
|
||||||
#include "GEOMBase.h"
|
#include "GEOMBase.h"
|
||||||
#include "GEOM_Actor.h"
|
#include "GEOM_Actor.h"
|
||||||
@ -67,6 +68,8 @@
|
|||||||
#include <BRepBndLib.hxx>
|
#include <BRepBndLib.hxx>
|
||||||
#include <BRepMesh_IncrementalMesh.hxx>
|
#include <BRepMesh_IncrementalMesh.hxx>
|
||||||
|
|
||||||
|
#include <Standard_ErrorHandler.hxx>
|
||||||
|
|
||||||
// QT Includes
|
// QT Includes
|
||||||
#include <qframe.h>
|
#include <qframe.h>
|
||||||
#include <qlayout.h>
|
#include <qlayout.h>
|
||||||
@ -814,6 +817,9 @@ void SMESHGUI_ComputeOp::startOperation()
|
|||||||
}
|
}
|
||||||
SUIT_OverrideCursor aWaitCursor;
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
try {
|
try {
|
||||||
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
if (gen->Compute(aMesh, myMainShape))
|
if (gen->Compute(aMesh, myMainShape))
|
||||||
computeFailed = false;
|
computeFailed = false;
|
||||||
}
|
}
|
||||||
@ -822,6 +828,9 @@ void SMESHGUI_ComputeOp::startOperation()
|
|||||||
//SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
//SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
anErrors = gen->GetComputeErrors( aMesh, myMainShape );
|
anErrors = gen->GetComputeErrors( aMesh, myMainShape );
|
||||||
// if ( anErrors->length() == 0 ) {
|
// if ( anErrors->length() == 0 ) {
|
||||||
// SUIT_MessageBox::warn1(desktop(),
|
// SUIT_MessageBox::warn1(desktop(),
|
||||||
@ -843,33 +852,28 @@ void SMESHGUI_ComputeOp::startOperation()
|
|||||||
{
|
{
|
||||||
SMESH::ModifiedMesh(aMeshSObj, !computeFailed, aMesh->NbNodes() == 0);
|
SMESH::ModifiedMesh(aMeshSObj, !computeFailed, aMesh->NbNodes() == 0);
|
||||||
update( UF_ObjBrowser | UF_Model );
|
update( UF_ObjBrowser | UF_Model );
|
||||||
|
Sel->setSelectedObjects( selected );
|
||||||
|
|
||||||
// SHOW MESH
|
// SHOW MESH
|
||||||
// NPAL16631: if ( getSMESHGUI()->automaticUpdate() ) {
|
// NPAL16631: if ( getSMESHGUI()->automaticUpdate() )
|
||||||
if ( !memoryLack && getSMESHGUI()->automaticUpdate() ) // NPAL16631
|
if ( !memoryLack && getSMESHGUI()->automaticUpdate() )
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
SVTK_ViewWindow* aVTKView = SMESH::GetViewWindow(getSMESHGUI(), true);
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
if (aVTKView) {
|
OCC_CATCH_SIGNALS;
|
||||||
int anId = study()->id();
|
#endif
|
||||||
TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId, IObject->getEntry());
|
SMESH::UpdateView(eDisplay, IObject->getEntry());
|
||||||
if (aVisualObj) {
|
|
||||||
aVisualObj->Update();
|
|
||||||
SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
|
|
||||||
if (!anActor) {
|
|
||||||
anActor = SMESH::CreateActor(studyDS(), IObject->getEntry());
|
|
||||||
if (anActor) {
|
|
||||||
SMESH::DisplayActor(aVTKView, anActor); //apo
|
|
||||||
SMESH::FitAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SMESH::RepaintCurrentView();
|
|
||||||
Sel->setSelectedObjects( selected );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
memoryLack = true;
|
#ifdef _DEBUG_
|
||||||
|
cout << "Exception thrown during mesh visualization" << endl;
|
||||||
|
#endif
|
||||||
|
if ( SMDS_Mesh::CheckMemory(true) ) { // has memory to show warning?
|
||||||
|
SMESH::OnVisuException();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
memoryLack = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -899,6 +903,7 @@ void SMESHGUI_ComputeOp::startOperation()
|
|||||||
}
|
}
|
||||||
else if ( noError )
|
else if ( noError )
|
||||||
{
|
{
|
||||||
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
myDlg->myFullInfo->SetInfoByMesh( aMesh );
|
myDlg->myFullInfo->SetInfoByMesh( aMesh );
|
||||||
myDlg->myFullInfo->show();
|
myDlg->myFullInfo->show();
|
||||||
myDlg->myBriefInfo->hide();
|
myDlg->myBriefInfo->hide();
|
||||||
|
@ -25,10 +25,12 @@
|
|||||||
#include "SMESHGUI.h"
|
#include "SMESHGUI.h"
|
||||||
#include "SMESH_Actor.h"
|
#include "SMESH_Actor.h"
|
||||||
#include "SMESH_ObjectDef.h"
|
#include "SMESH_ObjectDef.h"
|
||||||
|
#include <SMDS_Mesh.hxx>
|
||||||
|
|
||||||
#include <SUIT_Desktop.h>
|
#include <SUIT_Desktop.h>
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
#include <SUIT_Study.h>
|
#include <SUIT_Study.h>
|
||||||
|
#include <SUIT_MessageBox.h>
|
||||||
|
|
||||||
#include <SALOME_ListIO.hxx>
|
#include <SALOME_ListIO.hxx>
|
||||||
#include <SALOME_ListIteratorOfListIO.hxx>
|
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||||
@ -55,9 +57,11 @@
|
|||||||
// VTK
|
// VTK
|
||||||
#include <vtkRenderer.h>
|
#include <vtkRenderer.h>
|
||||||
#include <vtkActorCollection.h>
|
#include <vtkActorCollection.h>
|
||||||
|
#include <vtkUnstructuredGrid.h>
|
||||||
|
|
||||||
// OCCT
|
// OCCT
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
|
#include <Standard_ErrorHandler.hxx>
|
||||||
|
|
||||||
// STL
|
// STL
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -69,10 +73,100 @@ namespace SMESH {
|
|||||||
typedef map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
|
typedef map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
|
||||||
static TVisualObjCont VISUAL_OBJ_CONT;
|
static TVisualObjCont VISUAL_OBJ_CONT;
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Remove VisualObj and its actor from all views
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void RemoveVisualObjectWithActors( const char* theEntry )
|
||||||
|
{
|
||||||
|
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
|
||||||
|
( SUIT_Session::session()->activeApplication() );
|
||||||
|
SUIT_ViewManager* aViewManager =
|
||||||
|
app ? app->getViewManager(SVTK_Viewer::Type(), true) : 0;
|
||||||
|
if ( aViewManager ) {
|
||||||
|
QPtrVector<SUIT_ViewWindow> views = aViewManager->getViews();
|
||||||
|
for ( int iV = 0; iV < views.count(); ++iV ) {
|
||||||
|
if ( SMESH_Actor* actor = FindActorByEntry( views[iV], theEntry)) {
|
||||||
|
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV]))
|
||||||
|
vtkWnd->RemoveActor(actor);
|
||||||
|
actor->Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( aViewManager->study() );
|
||||||
|
int aStudyId = aStudy->id();
|
||||||
|
TVisualObjCont::key_type aKey(aStudyId,theEntry);
|
||||||
|
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
|
||||||
|
if(anIter != VISUAL_OBJ_CONT.end()) {
|
||||||
|
// for unknown reason, object destructor is not called, so clear object manually
|
||||||
|
anIter->second->GetUnstructuredGrid()->SetCells(0,0,0);
|
||||||
|
anIter->second->GetUnstructuredGrid()->SetPoints(0);
|
||||||
|
}
|
||||||
|
VISUAL_OBJ_CONT.erase(aKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Remove all VisualObjs and their actors from all views
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void RemoveAllObjectsWithActors()
|
||||||
|
{
|
||||||
|
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
|
||||||
|
( SUIT_Session::session()->activeApplication() );
|
||||||
|
SUIT_ViewManager* aViewManager =
|
||||||
|
app ? app->getViewManager(SVTK_Viewer::Type(), true) : 0;
|
||||||
|
if ( aViewManager ) {
|
||||||
|
QPtrVector<SUIT_ViewWindow> views = aViewManager->getViews();
|
||||||
|
for ( int iV = 0; iV < views.count(); ++iV ) {
|
||||||
|
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) {
|
||||||
|
vtkRenderer *aRenderer = vtkWnd->getRenderer();
|
||||||
|
vtkActorCollection *aCollection = aRenderer->GetActors();
|
||||||
|
aCollection->InitTraversal();
|
||||||
|
while(vtkActor *anAct = aCollection->GetNextActor()){
|
||||||
|
if(SMESH_Actor *actor = dynamic_cast<SMESH_Actor*>(anAct)){
|
||||||
|
vtkWnd->RemoveActor(actor);
|
||||||
|
actor->Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.begin();
|
||||||
|
for ( ; anIter != VISUAL_OBJ_CONT.end(); ++anIter ) {
|
||||||
|
// for unknown reason, object destructor is not called, so clear object manually
|
||||||
|
anIter->second->GetUnstructuredGrid()->SetCells(0,0,0);
|
||||||
|
anIter->second->GetUnstructuredGrid()->SetPoints(0);
|
||||||
|
}
|
||||||
|
VISUAL_OBJ_CONT.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Notify the user on problems during visualization
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void OnVisuException()
|
||||||
|
{
|
||||||
|
SUIT_MessageBox::warn1 (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
|
||||||
|
QObject::tr("SMESH_VISU_PROBLEM"),
|
||||||
|
QObject::tr("SMESH_BUT_OK"));
|
||||||
|
}
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Returns an updated visual object
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
TVisualObjPtr GetVisualObj(int theStudyId, const char* theEntry){
|
TVisualObjPtr GetVisualObj(int theStudyId, const char* theEntry){
|
||||||
TVisualObjPtr aVisualObj;
|
TVisualObjPtr aVisualObj;
|
||||||
|
TVisualObjCont::key_type aKey(theStudyId,theEntry);
|
||||||
try{
|
try{
|
||||||
TVisualObjCont::key_type aKey(theStudyId,theEntry);
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
|
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
|
||||||
if(anIter != VISUAL_OBJ_CONT.end()){
|
if(anIter != VISUAL_OBJ_CONT.end()){
|
||||||
aVisualObj = anIter->second;
|
aVisualObj = anIter->second;
|
||||||
@ -92,10 +186,8 @@ namespace SMESH {
|
|||||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
|
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
|
||||||
if(!aMesh->_is_nil()){
|
if(!aMesh->_is_nil()){
|
||||||
aVisualObj.reset(new SMESH_MeshObj(aMesh));
|
aVisualObj.reset(new SMESH_MeshObj(aMesh));
|
||||||
aVisualObj->Update();
|
|
||||||
TVisualObjCont::value_type aValue(aKey,aVisualObj);
|
TVisualObjCont::value_type aValue(aKey,aVisualObj);
|
||||||
VISUAL_OBJ_CONT.insert(aValue);
|
VISUAL_OBJ_CONT.insert(aValue);
|
||||||
return aVisualObj;
|
|
||||||
}
|
}
|
||||||
//Try narrow to SMESH_Group interafce
|
//Try narrow to SMESH_Group interafce
|
||||||
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObj);
|
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObj);
|
||||||
@ -108,10 +200,8 @@ namespace SMESH {
|
|||||||
TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
|
TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
|
||||||
if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
|
if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
|
||||||
aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
|
aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
|
||||||
aVisualObj->Update();
|
|
||||||
TVisualObjCont::value_type aValue(aKey,aVisualObj);
|
TVisualObjCont::value_type aValue(aKey,aVisualObj);
|
||||||
VISUAL_OBJ_CONT.insert(aValue);
|
VISUAL_OBJ_CONT.insert(aValue);
|
||||||
return aVisualObj;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Try narrow to SMESH_subMesh interafce
|
//Try narrow to SMESH_subMesh interafce
|
||||||
@ -125,10 +215,8 @@ namespace SMESH {
|
|||||||
TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
|
TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
|
||||||
if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
|
if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
|
||||||
aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
|
aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
|
||||||
aVisualObj->Update();
|
|
||||||
TVisualObjCont::value_type aValue(aKey,aVisualObj);
|
TVisualObjCont::value_type aValue(aKey,aVisualObj);
|
||||||
VISUAL_OBJ_CONT.insert(aValue);
|
VISUAL_OBJ_CONT.insert(aValue);
|
||||||
return aVisualObj;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,7 +225,48 @@ namespace SMESH {
|
|||||||
}
|
}
|
||||||
}catch(...){
|
}catch(...){
|
||||||
INFOS("GetMeshObj - There is no SMESH_Mesh object for the SALOMEDS::Strudy and Entry!!!");
|
INFOS("GetMeshObj - There is no SMESH_Mesh object for the SALOMEDS::Strudy and Entry!!!");
|
||||||
|
return TVisualObjPtr();
|
||||||
}
|
}
|
||||||
|
// Update object
|
||||||
|
bool objModified = false;
|
||||||
|
if ( aVisualObj ) {
|
||||||
|
try {
|
||||||
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
objModified = aVisualObj->Update();
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
#ifdef _DEBUG_
|
||||||
|
cout << "Exception in SMESHGUI_VTKUtils::GetVisualObj()" << endl;
|
||||||
|
#endif
|
||||||
|
OnVisuException();
|
||||||
|
RemoveVisualObjectWithActors( theEntry ); // remove this object
|
||||||
|
aVisualObj.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( objModified ) {
|
||||||
|
// PAL16631. Mesurements showed that to show aVisualObj in shading mode,
|
||||||
|
// ~10 times more memory is used than it occupies.
|
||||||
|
// Warn the user if there is less free memory than 30 sizes of a grid
|
||||||
|
int freeMB = SMDS_Mesh::CheckMemory(true);
|
||||||
|
int usedMB = aVisualObj->GetUnstructuredGrid()->GetActualMemorySize() / 1024;
|
||||||
|
if ( freeMB > 0 && usedMB * 30 > freeMB ) {
|
||||||
|
int continu = SUIT_MessageBox::warn2
|
||||||
|
(SMESHGUI::desktop(),
|
||||||
|
QObject::tr("SMESH_WRN_WARNING"),
|
||||||
|
QObject::tr("SMESH_CONTINUE_MESH_VISUALIZATION"),
|
||||||
|
QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"),
|
||||||
|
1, 0, 1);
|
||||||
|
if ( !continu ) {
|
||||||
|
// remove the corresponding actors from all views
|
||||||
|
RemoveVisualObjectWithActors( theEntry );
|
||||||
|
aVisualObj.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return aVisualObj;
|
return aVisualObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,28 +341,72 @@ namespace SMESH {
|
|||||||
void RepaintCurrentView()
|
void RepaintCurrentView()
|
||||||
{
|
{
|
||||||
if (SVTK_ViewWindow* wnd = GetCurrentVtkView())
|
if (SVTK_ViewWindow* wnd = GetCurrentVtkView())
|
||||||
{
|
{
|
||||||
wnd->getRenderer()->Render();
|
try {
|
||||||
wnd->Repaint(false);
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
wnd->getRenderer()->Render();
|
||||||
|
wnd->Repaint(false);
|
||||||
}
|
}
|
||||||
|
catch (...) {
|
||||||
|
OnVisuException();
|
||||||
|
#ifdef _DEBUG_
|
||||||
|
cout << "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RepaintViewWindow(SVTK_ViewWindow* theWindow)
|
void RepaintViewWindow(SVTK_ViewWindow* theWindow)
|
||||||
{
|
{
|
||||||
theWindow->getRenderer()->Render();
|
try {
|
||||||
theWindow->Repaint();
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
theWindow->getRenderer()->Render();
|
||||||
|
theWindow->Repaint();
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
OnVisuException();
|
||||||
|
#ifdef _DEBUG_
|
||||||
|
cout << "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow)" << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderViewWindow(SVTK_ViewWindow* theWindow)
|
void RenderViewWindow(SVTK_ViewWindow* theWindow)
|
||||||
{
|
{
|
||||||
theWindow->getRenderer()->Render();
|
try {
|
||||||
theWindow->Repaint();
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
theWindow->getRenderer()->Render();
|
||||||
|
theWindow->Repaint();
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
OnVisuException();
|
||||||
|
#ifdef _DEBUG_
|
||||||
|
cout << "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow)" << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FitAll(){
|
void FitAll(){
|
||||||
if(SVTK_ViewWindow* wnd = GetCurrentVtkView() ){
|
if(SVTK_ViewWindow* wnd = GetCurrentVtkView() ){
|
||||||
wnd->onFitAll();
|
try {
|
||||||
wnd->Repaint();
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
wnd->onFitAll();
|
||||||
|
wnd->Repaint();
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
OnVisuException();
|
||||||
|
#ifdef _DEBUG_
|
||||||
|
cout << "Exception in SMESHGUI_VTKUtils::FitAll()" << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,8 +479,19 @@ namespace SMESH {
|
|||||||
|
|
||||||
void DisplayActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
|
void DisplayActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
|
||||||
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
|
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
|
||||||
vtkWnd->AddActor(theActor);
|
try {
|
||||||
vtkWnd->Repaint();
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
vtkWnd->AddActor(theActor);
|
||||||
|
vtkWnd->Repaint();
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
OnVisuException();
|
||||||
|
#ifdef _DEBUG_
|
||||||
|
cout << "Exception in SMESHGUI_VTKUtils::DisplayActor()" << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +514,6 @@ namespace SMESH {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
|
void UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
|
||||||
{
|
{
|
||||||
if(SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd)){
|
if(SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd)){
|
||||||
@ -425,11 +608,12 @@ namespace SMESH {
|
|||||||
{
|
{
|
||||||
_PTR(Study) aStudy = GetActiveStudyDocument();
|
_PTR(Study) aStudy = GetActiveStudyDocument();
|
||||||
CORBA::Long anId = aStudy->StudyId();
|
CORBA::Long anId = aStudy->StudyId();
|
||||||
TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry());
|
if ( TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry())) {
|
||||||
if( aVisualObj )
|
// if( aVisualObj )
|
||||||
aVisualObj->Update();
|
// aVisualObj->Update(); -> PAL16631, already done in GetVisualObj()
|
||||||
if ( theDisplay )
|
if ( theDisplay )
|
||||||
UpdateView(SMESH::eDisplay,theIO->getEntry());
|
UpdateView(SMESH::eDisplay,theIO->getEntry());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,6 +64,8 @@ namespace SMESH {
|
|||||||
SMESHGUI_EXPORT
|
SMESHGUI_EXPORT
|
||||||
TVisualObjPtr GetVisualObj(int theStudyId,
|
TVisualObjPtr GetVisualObj(int theStudyId,
|
||||||
const char* theEntry);
|
const char* theEntry);
|
||||||
|
SMESHGUI_EXPORT
|
||||||
|
void OnVisuException(); // PAL16631
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
SMESHGUI_EXPORT
|
SMESHGUI_EXPORT
|
||||||
|
@ -51,8 +51,8 @@ msgstr ""
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PROJECT VERSION\n"
|
"Project-Id-Version: PROJECT VERSION\n"
|
||||||
"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
|
"POT-Creation-Date: 2002-05-28 10:46:48 AM CEST\n"
|
||||||
"PO-Revision-Date: 2005-06-07 10:51+0400\n"
|
"PO-Revision-Date: 2004-10-20 17:25+0400\n"
|
||||||
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
|
||||||
"Content-Type: text/plain; charset=iso-8859-1\n"
|
"Content-Type: text/plain; charset=iso-8859-1\n"
|
||||||
|
|
||||||
@ -1386,6 +1386,13 @@ msgstr "Select an object"
|
|||||||
msgid "SMESH_AUTO_GROUPS"
|
msgid "SMESH_AUTO_GROUPS"
|
||||||
msgstr "Automatically create groups"
|
msgstr "Automatically create groups"
|
||||||
|
|
||||||
|
msgid "SMESH_CONTINUE_MESH_VISUALIZATION"
|
||||||
|
msgstr "It seems that there is not enouth memory to show the mesh.\n"
|
||||||
|
"Do you wish to continue visualization?"
|
||||||
|
|
||||||
|
msgid "SMESH_VISU_PROBLEM"
|
||||||
|
msgstr "Mesh visualization failed, probably due to lack of memory"
|
||||||
|
|
||||||
#----------------------------------------------------
|
#----------------------------------------------------
|
||||||
|
|
||||||
msgid "SMESHGUI_FilterLibraryDlg::ADD_TO_TLT"
|
msgid "SMESHGUI_FilterLibraryDlg::ADD_TO_TLT"
|
||||||
|
Loading…
Reference in New Issue
Block a user