1 // Copyright (C) 2009-2012 CEA/DEN, EDF R&D
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.
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 #ifndef _HEXABLOCKGUI_DOCUMENTSELECTIONMODEL_HXX_
21 #define _HEXABLOCKGUI_DOCUMENTSELECTIONMODEL_HXX_
23 #include <QItemSelectionModel>
25 #include <LightApp_SelectionMgr.h>
27 #include <SVTK_ViewWindow.h>
28 #include <SVTK_Selector.h>
30 // #include <SOCC_ViewModel.h>
31 // #include <SOCC_ViewWindow.h>
32 // #include <OCCViewer_ViewWindow.h>
34 #include "MyGEOMBase_Helper.hxx"
36 #include "klinkitemselectionmodel.hxx"
37 #include "HEXABLOCKGUI_DocumentModel.hxx"
40 class OCCViewer_ViewWindow;
47 class PatternBuilderSelectionModel: public KLinkItemSelectionModel
50 PatternBuilderSelectionModel( QAbstractItemModel *model,
51 QItemSelectionModel *proxySelector, QObject *parent = 0 ):
52 KLinkItemSelectionModel( model, proxySelector, parent )
57 class PatternDataSelectionModel : public QItemSelectionModel,
58 public MyGEOMBase_Helper
63 PatternDataSelectionModel( QAbstractItemModel * model );
64 virtual ~PatternDataSelectionModel();
66 void setVertexSelection();
67 void setEdgeSelection();
68 void setQuadSelection();
69 void setHexaSelection();
70 void setAllSelection();
71 void highlightVTKElts( const QModelIndexList& elts );
74 QModelIndex indexBy( int role, const QString& value );
75 QModelIndex indexBy( int role, const QVariant& var );
78 void setSalomeSelectionMgr( LightApp_SelectionMgr* mgr );
79 void SetSelectionMode( Selection_Mode theMode );
82 void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous );
83 void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
84 void salomeSelectionChanged(); // Salome to Qt
87 SVTK_ViewWindow* _getVTKViewWindow();
88 OCCViewer_ViewWindow* _getOCCViewWindow();
90 QModelIndex _indexOf( const QString& anIOEntry, int role );
91 void _setVTKSelectionMode( const QModelIndex& eltIndex, SVTK_ViewWindow* vtkViewWindow );
92 void _highlightGEOM( const QMultiMap<QString, int>& entrySubIDs );
93 void _highlightGEOM( const QModelIndex & index );
94 void _selectVTK( const QModelIndex & index );
96 QModelIndex _geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject );
97 QModelIndex _vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject );
99 LightApp_SelectionMgr* _salomeSelectionMgr;
100 int _selectionFilter;
102 bool _theModelSelectionChanged;
103 bool _theVtkSelectionChanged;
104 bool _theGeomSelectionChanged;
110 class GroupsSelectionModel : public QItemSelectionModel
115 GroupsSelectionModel( QAbstractItemModel * model );
116 virtual ~GroupsSelectionModel();
118 QModelIndex indexBy( int role, const QVariant& var );
121 // void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous );
122 void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
125 SVTK_ViewWindow* _getVTKViewWindow();
126 void _highlightGroups( const QModelIndex& eltIndex );
133 class MeshSelectionModel : public QItemSelectionModel
138 MeshSelectionModel( QAbstractItemModel * model );
139 virtual ~MeshSelectionModel();
141 QModelIndex indexBy( int role, const QVariant& var );
144 // void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous );
145 void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
148 SVTK_ViewWindow* _getVTKViewWindow();
149 void _highlightPropagation( const QModelIndex& eltIndex );