SHAPER 9.16.0
XGUI_Selection.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_Selection_H
21#define XGUI_Selection_H
22
23#include "XGUI.h"
24
25#include <ModuleBase_Definitions.h>
26#include <ModuleBase_ISelection.h>
27
28#include <QModelIndexList>
29#include <AIS_ListOfInteractive.hxx>
30#include <NCollection_List.hxx>
31#include <TopoDS_Shape.hxx>
32
33#include <SelectMgr_IndexedMapOfOwner.hxx>
34
35class XGUI_Workshop;
36class SelectMgr_EntityOwner;
38
41class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection
42{
43 public:
46 XGUI_Selection(XGUI_Workshop* theWorkshop);
47
50 virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
51 getSelected(const SelectionPlace& thePlace = Browser) const;
52
56 virtual void fillPresentation(std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
57 const Handle(SelectMgr_EntityOwner)& theOwner) const;
58
61 virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getHighlighted() const;
62
64 virtual QObjectPtrList selectedObjects() const;
65
67 virtual QObjectPtrList selectedPresentations() const;
68
70 virtual QMap<ResultPtr, QList<GeomShapePtr>> selectedObjectsAndSubObjects() const;
71
73 virtual QModelIndexList selectedIndexes() const;
74
77 void selectedOwners(SelectMgr_IndexedMapOfOwner& theSelectedOwners) const;
78
83 void entityOwners(const Handle(AIS_InteractiveObject)& theObject,
84 SelectMgr_IndexedMapOfOwner& theOwners) const;
85
89 virtual Handle(AIS_InteractiveObject) getIO(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
90
91protected:
96 ObjectPtr getSelectableObject(const Handle(SelectMgr_EntityOwner)& theOwner) const;
97
100 void getSelectedInViewer(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& thePresentations) const;
101
107 void getSelectedInBrowser(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& thePresentations) const;
108
114 void getSelectedInSketchConstraintsBrowser(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& thePresentations) const;
115
119#ifdef BEFORE_TRIHEDRON_PATCH
120 TopoDS_Shape findAxisShape(Handle(AIS_InteractiveObject) theIO) const;
121#endif
122
123private:
124 XGUI_Workshop* myWorkshop;
125};
126
127#endif
A class which provides access to selection.
Definition: ModuleBase_ISelection.h:44
virtual QMap< ResultPtr, QList< GeomShapePtr > > selectedObjectsAndSubObjects() const =0
Returns map of selected results and their selected subobjects.
virtual QModelIndexList selectedIndexes() const =0
Returns list of currently selected QModelIndexes.
virtual QList< std::shared_ptr< ModuleBase_ViewerPrs > > getHighlighted() const =0
Returns a list of viewer highlited presentations.
virtual void fillPresentation(std::shared_ptr< ModuleBase_ViewerPrs > &thePrs, const Handle &theOwner) const =0
Fills the viewer presentation parameters by the parameters from the owner.
virtual QObjectPtrList selectedPresentations() const =0
Returns list of currently selected results.
virtual QObjectPtrList selectedObjects() const =0
Returns list of features currently selected in object browser.
SelectionPlace
Types of the selection place, where the selection is obtained.
Definition: ModuleBase_ISelection.h:47
virtual Handle getIO(const std::shared_ptr< ModuleBase_ViewerPrs > &thePrs)=0
Return the IO from the viewer presentation.
virtual QList< std::shared_ptr< ModuleBase_ViewerPrs > > getSelected(const SelectionPlace &thePlace=Browser) const =0
Returns a list of viewer selected presentations.
virtual ObjectPtr getSelectableObject(const Handle &theOwner) const =0
Returns list of currently selected QModelIndexes.
Presentation.
Definition: ModuleBase_ViewerPrs.h:37
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