SHAPER 9.16.0
XGUI_SelectionActivate.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_ISelectionActivate_H
21#define XGUI_ISelectionActivate_H
22
23#include "XGUI.h"
24
25#include "ModuleBase_Definitions.h"
26#include "ModuleBase_ISelectionActivate.h"
27
28#include "SelectMgr_ListOfFilter.hxx"
29
30#include <memory>
31
34class ModelAPI_Object;
35
36class XGUI_Displayer;
37
41{
42public:
44 enum SelectionPlace { Workshop, PropertyPanel, FacesPanel };
45
46public:
48 XGUI_EXPORT XGUI_SelectionActivate(ModuleBase_IWorkshop* theWorkshop);
49
52
56
58 XGUI_EXPORT virtual void updateSelectionModes();
59
61 XGUI_EXPORT virtual void updateSelectionFilters();
62
66 XGUI_EXPORT virtual void activateSelectionFilters
67 (const SelectMgr_ListOfFilter& theSelectionFilters);
68
71 XGUI_EXPORT QIntList activeSelectionModes() const;
72
75 XGUI_EXPORT bool isActive(ObjectPtr theObject) const;
76
81 XGUI_EXPORT void activateObjects(const QIntList& theModes, const QObjectPtrList& theObjList,
82 const bool theUpdateViewer = true);
83
86 XGUI_EXPORT void setSelectionModes(const QIntList& theModes);
87
91 XGUI_EXPORT void activateOnDisplay(const Handle(AIS_InteractiveObject)& theIO,
92 const bool theUpdateViewer);
93
98 XGUI_EXPORT void activateAIS(const Handle(AIS_InteractiveObject)& theIO, const int theMode,
99 const bool theUpdateViewer) const;
100
105 XGUI_EXPORT void deactivateAIS(const Handle(AIS_InteractiveObject)& theIO,
106 const int theMode = -1) const;
107
112 XGUI_EXPORT bool activate(const Handle(AIS_InteractiveObject)& theIO,
113 const bool theUpdateViewer) const;
114
118 XGUI_EXPORT void deactivate(const std::shared_ptr<ModelAPI_Object>& theObject,
119 const bool theUpdateViewer);
120
122 bool isTrihedronActive() const { return myIsTrihedronActive; }
123
125 XGUI_EXPORT void activateTrihedron(bool theIsActive);
126
129 XGUI_EXPORT void deactivateTrihedron(const bool theUpdateViewer) const;
130
132 XGUI_EXPORT void deactivateTrihedronInSelectionModes();
133
134protected:
138 void getSelectionModes(ModuleBase_ModelWidget* theWidget, QIntList& theModes);
139
141 Handle(AIS_InteractiveObject) getTrihedron() const;
142
145 Handle(AIS_InteractiveContext) AISContext() const;
146
150
154 AISObjectPtr getDisplayedAISObject(std::shared_ptr<ModelAPI_Object> theObject) const;
155
158 static int getSelectionMode(int theShapeType);
159
160protected:
163};
164
165#endif
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45
A class which provides interface of activation/deactivate selection modes and using selection filters...
Definition: ModuleBase_ISelectionActivate.h:36
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
An abstract custom widget class.
Definition: ModuleBase_ModelWidget.h:60
Displayer.
Definition: XGUI_Displayer.h:172
A class which implements activation/deactivate selection modes and using selection filters.
Definition: XGUI_SelectionActivate.h:41
virtual void updateSelectionFilters()
Updates active selection filters in the viewer depending on the application state.
Definition: XGUI_SelectionActivate.cpp:104
XGUI_Displayer * getDisplayer() const
Returns displayer.
Definition: XGUI_SelectionActivate.cpp:581
SelectionPlace
Types of the activation place.
Definition: XGUI_SelectionActivate.h:44
Handle getTrihedron() const
Returns Trihedron object if it is displayed.
Definition: XGUI_SelectionActivate.cpp:587
void activateTrihedron(bool theIsActive)
Set trihedron active (used in selection) or non active.
Definition: XGUI_SelectionActivate.cpp:524
bool isTrihedronActive() const
Returns true if the trihedron should be activated in current selection modes.
Definition: XGUI_SelectionActivate.h:122
XGUI_SelectionActivate(ModuleBase_IWorkshop *theWorkshop)
Constructor.
Definition: XGUI_SelectionActivate.cpp:58
virtual void updateSelectionModes()
Updates active selection modes in the viewer depending on the application state.
Definition: XGUI_SelectionActivate.cpp:78
void deactivateTrihedronInSelectionModes()
Get selection modes of trihedron and deactivate it in it.
Definition: XGUI_SelectionActivate.cpp:558
QIntList activeSelectionModes() const
Returns list of currently active selection modes Selection modes will be returned according to TopAbs...
Definition: XGUI_SelectionActivate.cpp:162
AISObjectPtr getDisplayedAISObject(std::shared_ptr< ModelAPI_Object > theObject) const
Returns AIS object displayed in 3D viewer for the given model object.
Definition: XGUI_SelectionActivate.cpp:593
SelectionPlace activeSelectionPlace() const
Returns place of activation modes that now is active.
Definition: XGUI_SelectionActivate.cpp:64
Handle AISContext() const
Returns context of the 3D viewer.
Definition: XGUI_SelectionActivate.cpp:575
void activateObjects(const QIntList &theModes, const QObjectPtrList &theObjList, const bool theUpdateViewer=true)
Activates in local context displayed outside of the context.
Definition: XGUI_SelectionActivate.cpp:189
QIntList myActiveSelectionModes
Current activated selection modes.
Definition: XGUI_SelectionActivate.h:161
void deactivate(const std::shared_ptr< ModelAPI_Object > &theObject, const bool theUpdateViewer)
Deactivates the given object (not allow selection)
Definition: XGUI_SelectionActivate.cpp:488
void activateAIS(const Handle &theIO, const int theMode, const bool theUpdateViewer) const
Activate interactive object.
Definition: XGUI_SelectionActivate.cpp:335
void deactivateTrihedron(const bool theUpdateViewer) const
Find a trihedron in a list of displayed presentations and deactivate it.
Definition: XGUI_SelectionActivate.cpp:532
bool isActive(ObjectPtr theObject) const
Returns true if the given object can be selected.
Definition: XGUI_SelectionActivate.cpp:173
void setSelectionModes(const QIntList &theModes)
Fill container of current selection modes.
Definition: XGUI_SelectionActivate.cpp:289
bool activate(const Handle &theIO, const bool theUpdateViewer) const
Activates the interactive object in the local context.
Definition: XGUI_SelectionActivate.cpp:406
virtual void activateSelectionFilters(const SelectMgr_ListOfFilter &theSelectionFilters)
Activates parameter filters in the workshop, deactivate active out of the container Please find a pos...
Definition: XGUI_SelectionActivate.cpp:135
~XGUI_SelectionActivate()
Destructor.
Definition: XGUI_SelectionActivate.h:51
void activateOnDisplay(const Handle &theIO, const bool theUpdateViewer)
Activate object in the selection modes.
Definition: XGUI_SelectionActivate.cpp:322
static int getSelectionMode(int theShapeType)
Converts shape type (TopAbs_ShapeEnum) to selection mode.
Definition: XGUI_SelectionActivate.cpp:599
void getSelectionModes(ModuleBase_ModelWidget *theWidget, QIntList &theModes)
Returns selection modes of the widget.
Definition: XGUI_SelectionActivate.cpp:150
void deactivateAIS(const Handle &theIO, const int theMode=-1) const
Activate interactive object.
Definition: XGUI_SelectionActivate.cpp:386
bool myIsTrihedronActive
Flag: use trihedgon for selection or not.
Definition: XGUI_SelectionActivate.h:162