1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
22 #include "ATOMSOLVGUI_Selection.h"
24 #include <LightApp_DataOwner.h>
25 #include <LightApp_Displayer.h>
26 #include <SalomeApp_Study.h>
28 #include <OCCViewer_ViewModel.h>
30 #include <SUIT_Session.h>
31 #include <SUIT_ViewWindow.h>
32 #include <SUIT_ViewManager.h>
33 #include <SUIT_ViewModel.h>
35 #include <SALOMEDSClient_SObject.hxx>
36 #include <SALOMEDSClient_Study.hxx>
38 #include <SALOME_Prs.h>
39 #include <SALOME_InteractiveObject.hxx>
42 #include <SALOME_Actor.h>
44 #include <SVTK_ViewModel.h>
48 #include <vtkActorCollection.h>
50 ATOMSOLVGUI_Selection::ATOMSOLVGUI_Selection()
54 ATOMSOLVGUI_Selection::~ATOMSOLVGUI_Selection()
58 QVariant ATOMSOLVGUI_Selection::parameter( const int ind, const QString& p ) const
60 if ( p == "displaymode" )
61 return QVariant( displayMode( ind ) );
63 return LightApp_Selection::parameter( ind, p );
66 QString ATOMSOLVGUI_Selection::displayMode( const int index ) const
68 SALOME_View* view = LightApp_Displayer::GetActiveView();
69 QString viewType = activeViewType();
70 if ( view && viewType == SVTK_Viewer::Type() ) {
71 if ( SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1() ) ) {
72 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
73 vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
76 vtkActor* actor = lst->GetNextActor();
78 SALOME_Actor* salActor = dynamic_cast<SALOME_Actor*>( actor );
80 int dm = salActor->GetRepresentation();
87 } // if ( salome actor )
89 } // if ( lst == vtkPrs->GetObjects() )