Version: 9.12.0
MeasureGUI_DimensionInteractor.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 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 // GEOM GEOMGUI : GUI for Geometry component
24 // File : MeasureGUI_DimensionEditor.h
25 // Author : Anton POLETAEV, Open CASCADE S.A.S.
26 //
27 #ifndef MEASUREGUI_DIMENSIONINTERACTOR_H
28 #define MEASUREGUI_DIMENSIONINTERACTOR_H
29 
30 #include <GeometryGUI.h>
31 #include <QObject>
32 #include <QPointer>
33 
34 #include <SelectMgr_EntityOwner.hxx>
35 #include <NCollection_Sequence.hxx>
36 #include <AIS_ListOfInteractive.hxx>
37 #include <AIS_InteractiveObject.hxx>
38 #include <AIS_Dimension.hxx>
39 #include <V3d_View.hxx>
40 #include <gp_Pln.hxx>
41 
42 class OCCViewer_ViewManager;
43 class OCCViewer_Viewer;
44 class SUIT_ViewWindow;
45 
46 //=================================================================================
47 // class : MeasureGUI_DimensionInteractor
48 // purpose : Interactive editor of dimension presentations
49 //=================================================================================
51 {
52  Q_OBJECT
53 
54 public:
55  enum Operation
56  {
61  };
62 
63 public:
66 
67 public:
68  void Enable();
69  void Disable();
70 
71 protected:
80  const Qt::MouseButtons theButtons,
81  const Qt::KeyboardModifiers theKeys );
82 
92  bool StartOperation( const Operation theOperation,
93  const Handle(V3d_View)& theView,
94  const int theX,
95  const int theY );
96 
106  void MoveFlyoutFree( const Handle(V3d_View)& theView, const int theX, const int theY );
107 
117  void MoveFlyoutInPlane( const Handle(V3d_View)& theView, const int theX, const int theY );
118 
127  void MoveText( const Handle(V3d_View)& theView, const int theX, const int theY );
128 
129 signals:
130  void InteractionStarted( Handle_AIS_InteractiveObject theIO );
131  void InteractionFinished( Handle_AIS_InteractiveObject theIO );
132 
133 protected:
134  void ConnectView( SUIT_ViewWindow* );
135  void DisconnectView( SUIT_ViewWindow* );
136  gp_Lin Projection( const Handle(V3d_View)&, const int, const int );
137  gp_Pnt ProjectPlane( const Handle(V3d_View)&,
138  const int,
139  const int,
140  const gp_Pln&,
141  bool& );
142  Standard_Real SensitivityTolerance( const Handle(V3d_View)& );
143 
144 protected:
157  virtual bool eventFilter( QObject*, QEvent* );
158 
159 protected slots:
160  void OnViewCreated( SUIT_ViewWindow* );
161  void OnViewRemoved( SUIT_ViewWindow* );
162 
163 private:
164  typedef NCollection_Sequence<Handle(SelectMgr_EntityOwner)> SeqOfOwners;
165 
166 private:
169  QPointer<OCCViewer_ViewManager> myVM;
170  OCCViewer_Viewer* myViewer;
174  Handle(AIS_Dimension) myInteractedIO;
176 };
177 
178 #endif
Definition: GeometryGUI.h:74
Definition: MeasureGUI_DimensionInteractor.h:51
~MeasureGUI_DimensionInteractor()
Definition: MeasureGUI_DimensionInteractor.cxx:80
bool StartOperation(const Operation theOperation, const Handle(V3d_View)&theView, const int theX, const int theY)
Prepare for interactive operation.
Definition: MeasureGUI_DimensionInteractor.cxx:209
gp_Pln myFreeMovePlane
Definition: MeasureGUI_DimensionInteractor.h:173
void MoveFlyoutFree(const Handle(V3d_View)&theView, const int theX, const int theY)
Perform "Operation_MoveFlyoutFree". Modify flyout of interactive dimension so as the flyout follows t...
Definition: MeasureGUI_DimensionInteractor.cxx:295
void InteractionFinished(Handle_AIS_InteractiveObject theIO)
Operation
Definition: MeasureGUI_DimensionInteractor.h:56
@ Operation_MoveFlyoutFree
Definition: MeasureGUI_DimensionInteractor.h:57
@ Operation_MoveFlyoutInPlane
Definition: MeasureGUI_DimensionInteractor.h:58
@ Operation_MoveText
Definition: MeasureGUI_DimensionInteractor.h:59
@ Operation_None
Definition: MeasureGUI_DimensionInteractor.h:60
virtual bool eventFilter(QObject *, QEvent *)
Process events from OCC viewer prior to their coming into the base viewer class.
Definition: MeasureGUI_DimensionInteractor.cxx:694
bool myIsEnabled
Definition: MeasureGUI_DimensionInteractor.h:168
GeometryGUI * myGeomGUI
Definition: MeasureGUI_DimensionInteractor.h:167
void MoveFlyoutInPlane(const Handle(V3d_View)&theView, const int theX, const int theY)
Perform "Operation_MoveFlyoutInPlane". Modify flyout of interactive dimension so as the flyout is ext...
Definition: MeasureGUI_DimensionInteractor.cxx:408
void OnViewRemoved(SUIT_ViewWindow *)
Definition: MeasureGUI_DimensionInteractor.cxx:891
gp_Pnt ProjectPlane(const Handle(V3d_View)&, const int, const int, const gp_Pln &, bool &)
Definition: MeasureGUI_DimensionInteractor.cxx:844
Operation GetOperation(const Handle(SelectMgr_EntityOwner)&theEntity, const Qt::MouseButtons theButtons, const Qt::KeyboardModifiers theKeys)
Identify interactive operation by picked entity and pressed buttons with modifiers.
Definition: MeasureGUI_DimensionInteractor.cxx:152
bool myOperationStarted
Definition: MeasureGUI_DimensionInteractor.h:172
NCollection_Sequence< Handle(SelectMgr_EntityOwner)> SeqOfOwners
Definition: MeasureGUI_DimensionInteractor.h:164
void DisconnectView(SUIT_ViewWindow *)
Definition: MeasureGUI_DimensionInteractor.cxx:822
void OnViewCreated(SUIT_ViewWindow *)
Definition: MeasureGUI_DimensionInteractor.cxx:882
SeqOfOwners mySelection
Definition: MeasureGUI_DimensionInteractor.h:175
gp_Lin Projection(const Handle(V3d_View)&, const int, const int)
Definition: MeasureGUI_DimensionInteractor.cxx:831
void ConnectView(SUIT_ViewWindow *)
Definition: MeasureGUI_DimensionInteractor.cxx:813
void Disable()
Definition: MeasureGUI_DimensionInteractor.cxx:127
OCCViewer_Viewer * myViewer
Definition: MeasureGUI_DimensionInteractor.h:170
MeasureGUI_DimensionInteractor(GeometryGUI *, QObject *)
Definition: MeasureGUI_DimensionInteractor.cxx:65
void MoveText(const Handle(V3d_View)&theView, const int theX, const int theY)
Perform "Operation_MoveText". Modify text of interactive dimension so as the text is moved to its fix...
Definition: MeasureGUI_DimensionInteractor.cxx:522
Standard_Real SensitivityTolerance(const Handle(V3d_View)&)
Definition: MeasureGUI_DimensionInteractor.cxx:870
void Enable()
Definition: MeasureGUI_DimensionInteractor.cxx:89
Handle(AIS_Dimension) myInteractedIO
void InteractionStarted(Handle_AIS_InteractiveObject theIO)
Operation myOperation
Definition: MeasureGUI_DimensionInteractor.h:171
QPointer< OCCViewer_ViewManager > myVM
Definition: MeasureGUI_DimensionInteractor.h:169