Version: 9.16.0
LightApp_SelectionMgr.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
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, or (at your option) any later version.
10//
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.
15//
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
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23#ifndef LIGHTAPP_SELECTIONMGR_H
24#define LIGHTAPP_SELECTIONMGR_H
25
26#include "LightApp.h"
27
28#include <SUIT_SelectionMgr.h>
29
30#include <QtCore/QTime>
31
32#ifndef DISABLE_SALOMEOBJECT
34 #include <QMap>
35 #include <NCollection_DataMap.hxx>
36
37 #include <TColStd_IndexedMapOfInteger.hxx>
38 #include <TColStd_MapOfInteger.hxx>
39
40 class SALOME_ListIO;
41 class TCollection_AsciiString;
42#else
43#include <QStringList>
44#endif
45
47
53{
54 Q_OBJECT
55
56public:
57 LightApp_SelectionMgr( LightApp_Application*, const bool = true );
58 virtual ~LightApp_SelectionMgr();
59
60 LightApp_Application* application() const;
61
62 virtual void setSelected( const SUIT_DataOwnerPtrList&, const bool = false );
63
64#ifndef DISABLE_SALOMEOBJECT
65 typedef NCollection_DataMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger;
66 typedef NCollection_DataMap< TCollection_AsciiString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger;
67
68 void selectedObjects( SALOME_ListIO&, const QString& = QString(), const bool = true, const bool sole=false ) const;
69 Handle(SALOME_InteractiveObject) soleSelectedObject( const QString& = QString(), const bool = true ) const;
70 void setSelectedObjects( const SALOME_ListIO&, const bool = false );
71
72 void GetIndexes( const Handle(SALOME_InteractiveObject)& IObject,
73 TColStd_IndexedMapOfInteger& theIndex );
74 void GetIndexes( const QString& theEntry,
75 TColStd_IndexedMapOfInteger& theIndex );
76
77 //bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject,
78 void AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject,
79 const TColStd_MapOfInteger& theIndices,
80 bool modeShift );
81
82 void selectObjects( const Handle(SALOME_InteractiveObject)& IObject,
83 TColStd_IndexedMapOfInteger theIndex, bool append );
84 void selectObjects( MapIOOfMapOfInteger theMapIO, bool append );
85
86 void selectedSubOwners( MapEntryOfMapOfInteger& theMap );
87#else
88 void selectedObjects( QStringList&, const QString& = QString(), const bool = true ) const;
89 void setSelectedObjects( const QStringList&, const bool = false );
90#endif
91
92 void clearSelectionCache();
93 bool isSelectionCacheEnabled() const;
94 void setSelectionCacheEnabled( bool );
95
96signals:
98
99private:
100 virtual void selectionChanged( SUIT_Selector* );
101
102#ifndef DISABLE_SALOMEOBJECT
103 QList<Handle(SALOME_InteractiveObject)> selectionCache( const QString& = QString() ) const;
104#else
105 QStringList selectionCache( const QString& = QString() ) const;
106#endif
107 bool isActualSelectionCache( const QString& = QString() ) const;
108
109 QStringList selectorTypes() const;
110
111private:
112#ifndef DISABLE_SALOMEOBJECT
114#else
115 typedef QString SelObject;
116#endif
118 typedef QMap<QString, QTime> TimeMap;
119 typedef QMap<QString, SelList> CacheMap;
120
121private:
123
125
129};
130
131#endif
Handle(TDocStd_Application) CAF_Application
Get OCAF application.
Definition: CAF_Application.cxx:97
#define LIGHTAPP_EXPORT
Definition: LightApp.h:36
Definition: LightApp_Application.h:77
Definition: LightApp_SelectionMgr.h:53
TimeMap myCacheTimes
Definition: LightApp_SelectionMgr.h:127
NCollection_DataMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger
Definition: LightApp_SelectionMgr.h:65
typedef Handle(SALOME_InteractiveObject) SelObject
void selectedObjects(SALOME_ListIO &, const QString &=QString(), const bool=true, const bool sole=false) const
bool myCacheState
Definition: LightApp_SelectionMgr.h:126
QList< SelObject > SelList
Definition: LightApp_SelectionMgr.h:117
void setSelectedObjects(const SALOME_ListIO &, const bool=false)
QMap< QString, SelList > CacheMap
Definition: LightApp_SelectionMgr.h:119
NCollection_DataMap< TCollection_AsciiString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger
Definition: LightApp_SelectionMgr.h:66
CacheMap myCacheSelection
Definition: LightApp_SelectionMgr.h:128
QTime myTimeStamp
Definition: LightApp_SelectionMgr.h:124
QMap< QString, QTime > TimeMap
Definition: LightApp_SelectionMgr.h:118
LightApp_Application * myApp
Definition: LightApp_SelectionMgr.h:122
Definition: SALOME_ListIO.hxx:29
Manage list of SUIT_DataOwnerPtr.
Definition: SUIT_DataOwner.h:67
Definition: SUIT_SelectionMgr.h:39
virtual void setSelected(const SUIT_DataOwnerPtrList &, const bool=false)
Definition: SUIT_SelectionMgr.cxx:130
Definition: SUIT_Selector.h:44