1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "ATOMSOLVGUI_Selection.h"
22 #include <LightApp_DataOwner.h>
23 #include <LightApp_Displayer.h>
24 #include <SalomeApp_Study.h>
26 #include <OCCViewer_ViewModel.h>
28 #include <SUIT_Session.h>
29 #include <SUIT_ViewWindow.h>
30 #include <SUIT_ViewManager.h>
31 #include <SUIT_ViewModel.h>
33 #include <SALOMEDSClient_SObject.hxx>
34 #include <SALOMEDSClient_Study.hxx>
36 #include <SALOME_Prs.h>
37 #include <SALOME_InteractiveObject.hxx>
40 #include <SALOME_Actor.h>
42 #include <SVTK_ViewModel.h>
46 #include <vtkActorCollection.h>
48 ATOMSOLVGUI_Selection::ATOMSOLVGUI_Selection()
52 ATOMSOLVGUI_Selection::~ATOMSOLVGUI_Selection()
56 QVariant ATOMSOLVGUI_Selection::parameter( const int ind, const QString& p ) const
58 if ( p == "displaymode" )
59 return QVariant( displayMode( ind ) );
61 return LightApp_Selection::parameter( ind, p );
64 QString ATOMSOLVGUI_Selection::displayMode( const int index ) const
66 SALOME_View* view = LightApp_Displayer::GetActiveView();
67 QString viewType = activeViewType();
68 if ( view && viewType == SVTK_Viewer::Type() ) {
69 if ( SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1() ) ) {
70 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
71 vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
74 vtkActor* actor = lst->GetNextActor();
76 SALOME_Actor* salActor = dynamic_cast<SALOME_Actor*>( actor );
78 int dm = salActor->GetRepresentation();
85 } // if ( salome actor )
87 } // if ( lst == vtkPrs->GetObjects() )