SHAPER 9.16.0
ModuleBase_ISelection.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 ModuleBase_ISelection_H
21#define ModuleBase_ISelection_H
22
23#include "ModuleBase.h"
24#include "ModuleBase_Definitions.h"
25
26#include <ModelAPI_Result.h>
27#include <GeomAPI_Shape.h>
28#include <GeomAPI_Vertex.h>
29
30#include <QModelIndexList>
31#include <AIS_ListOfInteractive.hxx>
32#include <NCollection_List.hxx>
33#include <TopoDS_Shape.hxx>
34
35#include <QList>
36
38class SelectMgr_EntityOwner;
39
43class MODULEBASE_EXPORT ModuleBase_ISelection
44{
45public:
47 enum SelectionPlace { Browser, Viewer, ConstraintsBrowser, AllControls };
48
49 virtual ~ModuleBase_ISelection() {}
50
53 virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
54 getSelected(const SelectionPlace& thePlace = Browser) const = 0;
55
60 static void appendSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>> theValues,
61 QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValuesTo);
62
65 virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getHighlighted() const = 0;
66
70 virtual void fillPresentation(std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
71 const Handle(SelectMgr_EntityOwner)& theOwner) const = 0;
72
74 virtual QObjectPtrList selectedObjects() const = 0;
75
77 virtual QObjectPtrList selectedPresentations() const = 0;
78
80 virtual QMap<ResultPtr, QList<GeomShapePtr>> selectedObjectsAndSubObjects() const = 0;
81
83 virtual QModelIndexList selectedIndexes() const = 0;
84
89 ResultPtr getResult(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
90
95 GeomShapePtr getShape(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
96
100 virtual Handle(AIS_InteractiveObject)
101 getIO(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs) = 0;
102
106 static QList<std::shared_ptr<ModuleBase_ViewerPrs>> getViewerPrs(
107 const QObjectPtrList& theObjects);
108
111 static void filterSelectionOnEqualPoints
112 (QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theSelected);
113protected:
115 virtual ObjectPtr getSelectableObject(const Handle(SelectMgr_EntityOwner)& theOwner) const = 0;
116
117private:
121 static std::shared_ptr<GeomAPI_Vertex> getPresentationVertex(
122 const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
123};
124
125#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 QList< std::shared_ptr< ModuleBase_ViewerPrs > > getSelected(const SelectionPlace &thePlace=Browser) const =0
Returns a list of viewer selected presentations.
Presentation.
Definition: ModuleBase_ViewerPrs.h:37