1 // Copyright (c) 2016-2019 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _AIS_ViewInputBuffer_HeaderFile
15 #define _AIS_ViewInputBuffer_HeaderFile
17 #include <Aspect_ScrollDelta.hxx>
19 #include <Graphic3d_Vec2.hxx>
20 #include <NCollection_Sequence.hxx>
21 #include <V3d_TypeOfOrientation.hxx>
24 enum AIS_ViewSelectionTool
26 AIS_ViewSelectionTool_Picking, //!< pick to select
27 AIS_ViewSelectionTool_RubberBand, //!< rubber-band to select
28 AIS_ViewSelectionTool_Polygon, //!< polyline to select
29 AIS_ViewSelectionTool_ZoomWindow, //!< zoom-in window (no selection)
32 //! Input buffer type.
33 enum AIS_ViewInputBufferType
35 AIS_ViewInputBufferType_UI, //!< input buffer for filling from UI thread
36 AIS_ViewInputBufferType_GL, //!< input buffer accessible from GL thread
39 //! Auxiliary structure defining viewer events
40 class AIS_ViewInputBuffer
44 bool IsNewGesture; //!< transition from one action to another
46 NCollection_Sequence<Aspect_ScrollDelta> ZoomActions; //!< the queue with zoom actions
50 bool ToFitAll; //!< perform FitAll operation
51 bool ToSetViewOrient; //!< set new view orientation
52 V3d_TypeOfOrientation ViewOrient; //!< new view orientation
54 _orientation() : ToFitAll (false), ToSetViewOrient (false), ViewOrient (V3d_Xpos) {}
59 bool ToHilight; //!< perform dynamic highlighting at specified point
60 Graphic3d_Vec2i Point; //!< the new point for dynamic highlighting
62 _highlighting() : ToHilight (false) {}
67 AIS_ViewSelectionTool Tool; //!< perform selection
68 bool IsXOR; //!< perform shift selection
69 NCollection_Sequence<Graphic3d_Vec2i>
70 Points; //!< the points for selection
71 bool ToApplyTool; //!< apply rubber-band selection tool
73 _selection() : Tool (AIS_ViewSelectionTool_Picking), IsXOR (false), ToApplyTool (false) {}
78 bool ToStart; //!< start panning
79 Graphic3d_Vec2i PointStart; //!< panning start point
80 bool ToPan; //!< perform panning
81 Graphic3d_Vec2i Delta; //!< panning delta
83 _panningParams() : ToStart (false), ToPan (false) {}
86 struct _draggingParams
88 bool ToStart; //!< start dragging
89 bool ToStop; //!< stop dragging
90 bool ToAbort; //!< abort dragging (restore previous position)
91 Graphic3d_Vec2i PointStart; //!< drag start point
92 Graphic3d_Vec2i PointTo; //!< drag end point
94 _draggingParams() : ToStart (false), ToStop (false), ToAbort (false) {}
99 bool ToStart; //!< start orbit rotation
100 Graphic3d_Vec2d PointStart; //!< orbit rotation start point
101 bool ToRotate; //!< perform orbit rotation
102 Graphic3d_Vec2d PointTo; //!< orbit rotation end point
104 _orbitRotation() : ToStart (false), ToRotate (false) {}
109 bool ToStart; //!< start view rotation
110 Graphic3d_Vec2d PointStart; //!< view rotation start point
111 bool ToRotate; //!< perform view rotation
112 Graphic3d_Vec2d PointTo; //!< view rotation end point
114 _viewRotation() : ToStart (false), ToRotate (false) {}
117 struct _zrotateParams
119 Graphic3d_Vec2i Point; //!< Z rotation start point
120 double Angle; //!< Z rotation angle
121 bool ToRotate; //!< start Z rotation
123 _zrotateParams() : Angle (0.0), ToRotate (false) {}
128 AIS_ViewInputBuffer()
129 : IsNewGesture (false) {}
131 //! Reset events buffer.
134 Orientation.ToFitAll = false;
135 Orientation.ToSetViewOrient = false;
136 MoveTo.ToHilight = false;
137 Selection.ToApplyTool = false;
138 IsNewGesture = false;
140 Panning.ToStart = false;
141 Panning.ToPan = false;
142 Dragging.ToStart = false;
143 Dragging.ToStop = false;
144 Dragging.ToAbort = false;
145 OrbitRotation.ToStart = false;
146 OrbitRotation.ToRotate = false;
147 ViewRotation.ToStart = false;
148 ViewRotation.ToRotate = false;
149 ZRotate.ToRotate = false;
154 #endif // _AIS_ViewInputBuffer_HeaderFile