1 // SMESH SMESHGUI : Displayer for SMESH module
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : SMESHGUI_Displayer.cxx
25 // Author : Alexander SOLOVYOV
27 // $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHGUI/SMESHGUI_Displayer.cxx
29 #include "SMESHGUI_Displayer.h"
30 #include "SMESHGUI_VTKUtils.h"
32 #include <SalomeApp_Study.h>
33 #include <SalomeApp_Application.h>
34 #include <SVTK_ViewModel.h>
35 #include <SVTK_ViewWindow.h>
37 SMESHGUI_Displayer::SMESHGUI_Displayer( SalomeApp_Application* app )
38 : LightApp_Displayer(),
43 SMESHGUI_Displayer::~SMESHGUI_Displayer()
47 SALOME_Prs* SMESHGUI_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame )
51 SALOME_View* aViewFrame = theViewFrame ? theViewFrame : GetActiveView();
55 SVTK_Viewer* vtk_viewer = dynamic_cast<SVTK_Viewer*>( aViewFrame );
58 SUIT_ViewWindow* wnd = vtk_viewer->getViewManager()->getActiveView();
59 SMESH_Actor* anActor = SMESH::FindActorByEntry( wnd, entry.latin1() );
61 anActor = SMESH::CreateActor( study()->studyDS(), entry.latin1(), true );
64 SMESH::DisplayActor( wnd, anActor );
65 prs = LightApp_Displayer::buildPresentation( entry.latin1(), aViewFrame );
70 SMESH::RemoveActor( vtk_viewer->getViewManager()->getActiveView(), anActor );
77 SalomeApp_Study* SMESHGUI_Displayer::study() const
79 return dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
82 bool SMESHGUI_Displayer::canBeDisplayed( const QString& /*entry*/, const QString& viewer_type ) const
84 return viewer_type==SVTK_Viewer::Type();