1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File : MeasureGUI_AnnotationInteractor.h
25 // Author : Anton POLETAEV, Open CASCADE S.A.S.
27 #ifndef MEASUREGUI_ANNOTATIONINTERACTOR_H
28 #define MEASUREGUI_ANNOTATIONINTERACTOR_H
30 #include <GEOM_Annotation.hxx>
31 #include <SelectMgr_EntityOwner.hxx>
32 #include <SelectMgr_SequenceOfOwner.hxx>
37 class OCCViewer_Viewer;
38 class OCCViewer_ViewManager;
39 class OCCViewer_ViewPort3d;
40 class SUIT_ViewWindow;
43 * \class MeasureGUI_AnnotationInteractor
44 * \brief Class implementing logical layer for interactive dragging of annotation
45 * labels. It includes two components: listener for GUI events occurring
46 * inside of OCCT 3D viewer and processor for hooked events to perform
47 * interactive modification of the selected annotation within current
50 class MeasureGUI_AnnotationInteractor : public QObject
57 //! Connects to existing viewer/view windows to process events.
58 //! \param theGUI [in] the geometry module's GUI interface.
59 //! \param theOwner [in] the owner of the instance.
60 MeasureGUI_AnnotationInteractor( GeometryGUI* theGUI, QObject* theOwner );
63 virtual ~MeasureGUI_AnnotationInteractor();
67 //! Enables event processing and interaction handlers.
70 //! Disables event processing and interaction handlers.
73 //! Set entry of allowed annotation presentations.
74 void SetEditEntry( const QString& theEntry ) { myEditEntry = theEntry; }
78 //! Connect interactor's event handler to the view window given.
79 void ConnectView( SUIT_ViewWindow* theWindow );
81 //! Disconnect interactor's event handler from the view window given.
82 void DisconnectView( SUIT_ViewWindow* theWindow );
86 //! Emitted when interactor begins modification of the interactive object.
87 void SignalInteractionStarted( Handle_GEOM_Annotation theIO );
89 //! Emitted when interactor finished modification of the interactive object.
90 void SignalInteractionFinished( Handle_GEOM_Annotation theIO );
94 //! Handler for signal coming from GUI layer.
95 void OnViewCreated( SUIT_ViewWindow* );
97 //! Handler for signal coming from GUI layer.
98 void OnViewRemoved( SUIT_ViewWindow* );
102 //! Hooks and process events from OCCT viewer prior to their coming into the base viewer class.
103 //! It handles the events coming to viewport and identifies whether the events can
104 //! invoke an interaction operation or not. If yes, the operation is performed within the
105 //! interactor class and events are "accepted". Otherwise, the events are passed to
106 //! viewer's subroutines.
107 virtual bool eventFilter( QObject*, QEvent* );
111 GeometryGUI* myGeomGUI;
113 OCCViewer_ViewManager* myVM;
114 OCCViewer_Viewer* myViewer;
115 OCCViewer_ViewPort3d* myActiveViewPort;
116 Handle(GEOM_Annotation) myActiveIO;
117 SelectMgr_SequenceOfOwner mySelection;