X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_VTKUtils.cxx;h=62e11422dc895d5beb8da6c91b7b8b7b88162d30;hb=591c0c3f5cf38f56eb749ab887f15239cfdf9679;hp=d8144f320dd16aacb844c71be3fa2fd5afd21519;hpb=85b1cfc1f07d0b93d88803c6c0ccadf8f3349719;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index d8144f320..62e11422d 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -1,37 +1,46 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_VTKUtils.cxx +// Author : Open CASCADE S.A.S. // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - +// SMESH includes #include "SMESHGUI_VTKUtils.h" + +#include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_Filter.h" -#include "SMESHGUI.h" -#include "SMESH_Actor.h" -#include "SMESH_ActorUtils.h" -#include "SMESH_ObjectDef.h" +#include +#include +#include #include +// SALOME GUI includes #include #include -#include #include +#include +#include #include #include @@ -44,34 +53,26 @@ #include #include +// SALOME KERNEL includes #include +// IDL includes #include -#include CORBA_CLIENT_HEADER(SMESH_Gen) #include CORBA_CLIENT_HEADER(SMESH_Mesh) #include CORBA_CLIENT_HEADER(SMESH_Group) -#include CORBA_CLIENT_HEADER(SMESH_Hypothesis) - -#include -#include -// VTK +// VTK includes #include #include #include -// OCCT +// OCCT includes #include #include -// STL -#include -using namespace std; - - -namespace SMESH { - - typedef map TVisualObjCont; +namespace SMESH +{ + typedef std::map TVisualObjCont; static TVisualObjCont VISUAL_OBJ_CONT; //============================================================================= @@ -104,7 +105,7 @@ namespace SMESH { SUIT_ViewManager* aViewManager = app ? app->getViewManager(SVTK_Viewer::Type(), true) : 0; if ( aViewManager ) { - QPtrVector views = aViewManager->getViews(); + QVector 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])) @@ -138,7 +139,7 @@ namespace SMESH { for ( int iM = 0; iM < viewMgrs.count(); ++iM ) { SUIT_ViewManager* aViewManager = viewMgrs.at( iM ); if ( aViewManager && aViewManager->getType() == SVTK_Viewer::Type()) { - QPtrVector views = aViewManager->getViews(); + QVector views = aViewManager->getViews(); for ( int iV = 0; iV < views.count(); ++iV ) { if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) { vtkRenderer *aRenderer = vtkWnd->getRenderer(); @@ -180,7 +181,7 @@ namespace SMESH { SUIT_ViewManager* aViewManager = viewMgrs.at( iM ); if ( aViewManager && aViewManager->getType() == SVTK_Viewer::Type() && aViewManager->study()->id() == studyID ) { - QPtrVector views = aViewManager->getViews(); + QVector views = aViewManager->getViews(); for ( int iV = 0; iV < views.count(); ++iV ) { if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) { vtkRenderer *aRenderer = vtkWnd->getRenderer(); @@ -225,22 +226,20 @@ namespace SMESH { // after or at showing this message, so we do an additional check of available memory // char* buf = new char[100*1024]; // delete [] buf; - SUIT_MessageBox::warn1 (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("SMESH_VISU_PROBLEM"), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_VISU_PROBLEM")); } catch (...) { // no more memory at all: last resort - cout<< "SMESHGUI_VTKUtils::OnVisuException(), exception even at showing a message!!!" <GetUnstructuredGrid()->GetActualMemorySize() / 1024; if ( freeMB > 0 && usedMB * 30 > freeMB ) { #ifdef _DEBUG_ - cout << "SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB - << ", usedMB=" << usedMB<< endl; + MESSAGE ( "SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB + << ", usedMB=" << usedMB ); #endif - int continu = 0; + bool continu = false; if ( usedMB * 10 > freeMB ) // even dont try to show - SUIT_MessageBox::warn1 (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("SMESH_NO_MESH_VISUALIZATION"), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_NO_MESH_VISUALIZATION")); else // there is a chance to succeed - continu = SUIT_MessageBox::warn2 + continu = SUIT_MessageBox::warning (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); + SUIT_MessageBox::Yes | SUIT_MessageBox::No, + SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes; if ( !continu ) { // remove the corresponding actors from all views RemoveVisualObjectWithActors( theEntry ); @@ -412,8 +410,8 @@ namespace SMESH { if( !theMgr ) return NULL; - QPtrVector views = theMgr->getViews(); - if( views.containsRef( theWindow ) ) + QVector views = theMgr->getViews(); + if( views.contains( theWindow ) ) return GetVtkViewWindow( theWindow ); else return NULL; @@ -453,7 +451,7 @@ namespace SMESH { } catch (...) { #ifdef _DEBUG_ - cout << "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" << endl; + MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" ); #endif OnVisuException(); } @@ -471,7 +469,7 @@ namespace SMESH { } catch (...) { #ifdef _DEBUG_ - cout << "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow)" << endl; + MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow*)" ); #endif OnVisuException(); } @@ -488,7 +486,7 @@ namespace SMESH { } catch (...) { #ifdef _DEBUG_ - cout << "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow)" << endl; + MESSAGE ( "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow*)" ); #endif OnVisuException(); } @@ -505,7 +503,7 @@ namespace SMESH { } catch (...) { #ifdef _DEBUG_ - cout << "Exception in SMESHGUI_VTKUtils::FitAll()" << endl; + MESSAGE ( "Exception in SMESHGUI_VTKUtils::FitAll()" ); #endif OnVisuException(); } @@ -611,7 +609,7 @@ namespace SMESH { } catch (...) { #ifdef _DEBUG_ - cout << "Exception in SMESHGUI_VTKUtils::DisplayActor()" << endl; + MESSAGE ( "Exception in SMESHGUI_VTKUtils::DisplayActor()" ); #endif OnVisuException(); } @@ -650,7 +648,7 @@ namespace SMESH { vtkActorCollection *aCollection = aRenderer->GetActors(); aCollection->InitTraversal(); while(vtkActor *anAct = aCollection->GetNextActor()) - if(SMESH_Actor *anActor = dynamic_cast(anAct)) + if(dynamic_cast(anAct)) return false; } return true; @@ -754,7 +752,7 @@ namespace SMESH { } }else{ SALOME_ListIteratorOfListIO anIter( selected ); - for(; anIter.More(); anIter.Next()){ + for( ; anIter.More(); anIter.Next()){ Handle(SALOME_InteractiveObject) anIO = anIter.Value(); if ( !Update(anIO,true) ) break; // avoid multiple warinings if visu failed @@ -796,7 +794,7 @@ namespace SMESH { return; } - QPtrVector views = vm->getViews(); + QVector views = vm->getViews(); SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( theModule ); if( !mgr ) @@ -885,7 +883,7 @@ namespace SMESH { void RemoveFilters(SVTK_Selector* theSelector) { - for ( int id = SMESHGUI_NodeFilter; theSelector && id < SMESHGUI_LastFilter; id++ ) + for ( int id = SMESH::NodeFilter; theSelector && id < SMESH::LastFilter; id++ ) theSelector->RemoveFilter( id ); } @@ -963,7 +961,7 @@ namespace SMESH { anIdContainer.insert(aMapIndex(i)); TIdContainer::const_iterator anIter = anIdContainer.begin(); - for(; anIter != anIdContainer.end(); anIter++) + for( ; anIter != anIdContainer.end(); anIter++) theName += QString(" %1").arg(*anIter); return aMapIndex.Extent(); @@ -1043,12 +1041,12 @@ namespace SMESH { if(FindActorByEntry(theIO->getEntry())){ TColStd_IndexedMapOfInteger aMapIndex; theMgr->GetIndexes(theIO,aMapIndex); - typedef set TIdContainer; + typedef std::set TIdContainer; TIdContainer anIdContainer; for( int i = 1; i <= aMapIndex.Extent(); i++) anIdContainer.insert(aMapIndex(i)); TIdContainer::const_iterator anIter = anIdContainer.begin(); - for(; anIter != anIdContainer.end(); anIter++){ + for( ; anIter != anIdContainer.end(); anIter++){ theName += QString(" %1").arg(*anIter); } return aMapIndex.Extent(); @@ -1142,4 +1140,4 @@ namespace SMESH { } } -} +} // end of namespace SMESH