SHAPER 9.16.0
XGUI_SelectionMgr.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
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.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef XGUI_SelectionMgr_H
21#define XGUI_SelectionMgr_H
22
23#include "XGUI.h"
24#include <ModuleBase_Definitions.h>
25#include <ModuleBase_ISelection.h>
26#include <ModelAPI_Feature.h>
27#include <QObject>
28#include <QModelIndexList>
29
30#include <AIS_InteractiveObject.hxx>
31#include <AIS_ListOfInteractive.hxx>
32#include <NCollection_List.hxx>
33#include <TopoDS_Shape.hxx>
34#include <SelectMgr_IndexedMapOfOwner.hxx>
35
36class XGUI_Workshop;
38class XGUI_Selection;
39
45class XGUI_EXPORT XGUI_SelectionMgr : public QObject
46{
47Q_OBJECT
48 public:
52 virtual ~XGUI_SelectionMgr();
53
56 {
57 return mySelection;
58 }
59
60 ModuleBase_ISelection::SelectionPlace placeOfSelection() const {
61 return myLastSelectionPlace;
62 }
63
65 void connectViewers();
66
70 void setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners,
71 bool isUpdateViewer);
72
74 void clearSelection();
75
79 void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs> >& theValues);
80
83 void deselectPresentation(const Handle(AIS_InteractiveObject) theObject);
84
87 void updateSelectionBy(const ModuleBase_ISelection::SelectionPlace& thePlace);
88
90 std::list<FeaturePtr> getSelectedFeatures();
91
92signals:
95
96 public slots:
98 void onObjectBrowserSelection();
99
101 void onSketchConstraintsBrowserSelection();
102
104 void onViewerSelection();
105
106private:
110 void convertToObjectBrowserSelection(
111 const QList<std::shared_ptr<ModuleBase_ViewerPrs> >& theValues, QObjectPtrList& theObjects);
112
113 QList<TopoDS_Shape> findAllShapes(const ResultPtr& theResult) const;
114
115private:
117 XGUI_Workshop* myWorkshop;
118
120 XGUI_Selection* mySelection;
121
122 ModuleBase_ISelection::SelectionPlace myLastSelectionPlace;
123};
124
125#endif
SelectionPlace
Types of the selection place, where the selection is obtained.
Definition: ModuleBase_ISelection.h:47
Object browser window object.
Definition: XGUI_ObjectsBrowser.h:154
Selection manager.
Definition: XGUI_SelectionMgr.h:46
XGUI_Selection * selection() const
Returns current selection.
Definition: XGUI_SelectionMgr.h:55
void selectionChanged()
Emitted when selection in a one of the viewers was changed.
Implementation of ModuleBase_ISelection interface.
Definition: XGUI_Selection.h:42
Class which defines a configuration of the application (Workshop) and launches it.
Definition: XGUI_Workshop.h:83