-// 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 <SMESH_Actor.h>
+#include <SMESH_ActorUtils.h>
+#include <SMESH_ObjectDef.h>
#include <SMDS_Mesh.hxx>
+// SALOME GUI includes
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
-#include <SUIT_Study.h>
#include <SUIT_MessageBox.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ResourceMgr.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
+// SALOME KERNEL includes
#include <utilities.h>
+// IDL includes
#include <SALOMEconfig.h>
-#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 <SALOMEDSClient_Study.hxx>
-#include <SALOMEDSClient_SObject.hxx>
-// VTK
+// VTK includes
#include <vtkRenderer.h>
#include <vtkActorCollection.h>
#include <vtkUnstructuredGrid.h>
-// OCCT
+// OCCT includes
#include <TColStd_IndexedMapOfInteger.hxx>
#include <Standard_ErrorHandler.hxx>
-// STL
-#include <set>
-using namespace std;
-
-
-namespace SMESH {
-
- typedef map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
+namespace SMESH
+{
+ typedef std::map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
static TVisualObjCont VISUAL_OBJ_CONT;
//=============================================================================
SUIT_ViewManager* aViewManager =
app ? app->getViewManager(SVTK_Viewer::Type(), true) : 0;
if ( aViewManager ) {
- QPtrVector<SUIT_ViewWindow> views = aViewManager->getViews();
+ QVector<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]))
for ( int iM = 0; iM < viewMgrs.count(); ++iM ) {
SUIT_ViewManager* aViewManager = viewMgrs.at( iM );
if ( aViewManager && aViewManager->getType() == SVTK_Viewer::Type()) {
- QPtrVector<SUIT_ViewWindow> views = aViewManager->getViews();
+ QVector<SUIT_ViewWindow*> views = aViewManager->getViews();
for ( int iV = 0; iV < views.count(); ++iV ) {
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) {
vtkRenderer *aRenderer = vtkWnd->getRenderer();
SUIT_ViewManager* aViewManager = viewMgrs.at( iM );
if ( aViewManager && aViewManager->getType() == SVTK_Viewer::Type() &&
aViewManager->study()->id() == studyID ) {
- QPtrVector<SUIT_ViewWindow> views = aViewManager->getViews();
+ QVector<SUIT_ViewWindow*> views = aViewManager->getViews();
for ( int iV = 0; iV < views.count(); ++iV ) {
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) {
vtkRenderer *aRenderer = vtkWnd->getRenderer();
// 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!!!" <<endl;
- cout<< "Try to remove all visual data..." <<endl;
+ MESSAGE_BEGIN ( "SMESHGUI_VTKUtils::OnVisuException(), exception even at showing a message!!!" <<
+ std::endl << "Try to remove all visual data..." );
if (theVISU_MemoryReserve) {
delete theVISU_MemoryReserve;
theVISU_MemoryReserve = 0;
}
RemoveAllObjectsWithActors();
- SUIT_MessageBox::warn1 (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_VISU_PROBLEM_CLEAR"),
- QObject::tr("SMESH_BUT_OK"));
- cout<< "...done" << endl;
+ SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_VISU_PROBLEM_CLEAR"));
+ MESSAGE_END ( "...done" );
}
}
//================================================================================
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::GetVisualObj()" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::GetVisualObj()" );
#endif
RemoveVisualObjectWithActors( theEntry ); // remove this object
OnVisuException();
int usedMB = aVisualObj->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 );
if( !theMgr )
return NULL;
- QPtrVector<SUIT_ViewWindow> views = theMgr->getViews();
- if( views.containsRef( theWindow ) )
+ QVector<SUIT_ViewWindow*> views = theMgr->getViews();
+ if( views.contains( theWindow ) )
return GetVtkViewWindow( theWindow );
else
return NULL;
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" );
#endif
OnVisuException();
}
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow)" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow*)" );
#endif
OnVisuException();
}
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow)" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow*)" );
#endif
OnVisuException();
}
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::FitAll()" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::FitAll()" );
#endif
OnVisuException();
}
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::DisplayActor()" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::DisplayActor()" );
#endif
OnVisuException();
}
vtkActorCollection *aCollection = aRenderer->GetActors();
aCollection->InitTraversal();
while(vtkActor *anAct = aCollection->GetNextActor())
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct))
+ if(dynamic_cast<SMESH_Actor*>(anAct))
return false;
}
return true;
}
}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
return;
}
- QPtrVector<SUIT_ViewWindow> views = vm->getViews();
+ QVector<SUIT_ViewWindow*> views = vm->getViews();
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( theModule );
if( !mgr )
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 );
}
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();
if(FindActorByEntry(theIO->getEntry())){
TColStd_IndexedMapOfInteger aMapIndex;
theMgr->GetIndexes(theIO,aMapIndex);
- typedef set<int> TIdContainer;
+ typedef std::set<int> 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();
}
}
-}
+} // end of namespace SMESH