Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MeasureGUI_DimensionInteractor.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, 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 
33 #include <SelectMgr_EntityOwner.hxx>
34 #include <NCollection_Sequence.hxx>
35 #include <AIS_ListOfInteractive.hxx>
36 #include <AIS_InteractiveObject.hxx>
37 #include <AIS_Dimension.hxx>
38 #include <V3d_View.hxx>
39 #include <gp_Pln.hxx>
40 
41 class OCCViewer_ViewManager;
42 class OCCViewer_Viewer;
43 class SUIT_ViewWindow;
44 
45 //=================================================================================
46 // class : MeasureGUI_DimensionInteractor
47 // purpose : Interactive editor of dimension presentations
48 //=================================================================================
50 {
51  Q_OBJECT
52 
53 public:
54  enum Operation
55  {
60  };
61 
62 public:
65 
66 public:
67  void Enable();
68  void Disable();
69 
70 protected:
79  const Qt::MouseButtons theButtons,
80  const Qt::KeyboardModifiers theKeys );
81 
91  bool StartOperation( const Operation theOperation,
92  const Handle(V3d_View)& theView,
93  const int theX,
94  const int theY );
95 
105  void MoveFlyoutFree( const Handle(V3d_View)& theView, const int theX, const int theY );
106 
116  void MoveFlyoutInPlane( const Handle(V3d_View)& theView, const int theX, const int theY );
117 
126  void MoveText( const Handle(V3d_View)& theView, const int theX, const int theY );
127 
128 signals:
129  void InteractionStarted( Handle_AIS_InteractiveObject theIO );
130  void InteractionFinished( Handle_AIS_InteractiveObject theIO );
131 
132 protected:
133  void ConnectView( SUIT_ViewWindow* );
134  void DisconnectView( SUIT_ViewWindow* );
135  gp_Lin Projection( const Handle(V3d_View)&, const int, const int );
136  gp_Pnt ProjectPlane( const Handle(V3d_View)&,
137  const int,
138  const int,
139  const gp_Pln&,
140  bool& );
141  Standard_Real SensitivityTolerance( const Handle(V3d_View)& );
142 
143 protected:
156  virtual bool eventFilter( QObject*, QEvent* );
157 
158 protected slots:
159  void OnViewCreated( SUIT_ViewWindow* );
160  void OnViewRemoved( SUIT_ViewWindow* );
161 
162 private:
163  typedef NCollection_Sequence<Handle(SelectMgr_EntityOwner)> SeqOfOwners;
164 
165 private:
168  OCCViewer_ViewManager* myVM;
169  OCCViewer_Viewer* myViewer;
173  Handle(AIS_Dimension) myInteractedIO;
175 };
176 
177 #endif