49582f9d |
1 | // Copyright (c) 2016-2019 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
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. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | #ifndef _AIS_ViewInputBuffer_HeaderFile |
15 | #define _AIS_ViewInputBuffer_HeaderFile |
16 | |
17 | #include <Aspect_ScrollDelta.hxx> |
18 | |
19 | #include <Graphic3d_Vec2.hxx> |
20 | #include <NCollection_Sequence.hxx> |
21 | #include <V3d_TypeOfOrientation.hxx> |
22 | |
23 | //! Selection mode |
24 | enum AIS_ViewSelectionTool |
25 | { |
26 | AIS_ViewSelectionTool_Picking, //!< pick to select |
27 | AIS_ViewSelectionTool_RubberBand, //!< rubber-band to select |
e1c9a103 |
28 | AIS_ViewSelectionTool_Polygon, //!< polyline to select |
29 | AIS_ViewSelectionTool_ZoomWindow, //!< zoom-in window (no selection) |
49582f9d |
30 | }; |
31 | |
32 | //! Input buffer type. |
33 | enum AIS_ViewInputBufferType |
34 | { |
35 | AIS_ViewInputBufferType_UI, //!< input buffer for filling from UI thread |
36 | AIS_ViewInputBufferType_GL, //!< input buffer accessible from GL thread |
37 | }; |
38 | |
39 | //! Auxiliary structure defining viewer events |
40 | class AIS_ViewInputBuffer |
41 | { |
42 | public: |
43 | |
44 | bool IsNewGesture; //!< transition from one action to another |
45 | |
46 | NCollection_Sequence<Aspect_ScrollDelta> ZoomActions; //!< the queue with zoom actions |
47 | |
48 | struct _orientation |
49 | { |
50 | bool ToFitAll; //!< perform FitAll operation |
51 | bool ToSetViewOrient; //!< set new view orientation |
52 | V3d_TypeOfOrientation ViewOrient; //!< new view orientation |
53 | |
54 | _orientation() : ToFitAll (false), ToSetViewOrient (false), ViewOrient (V3d_Xpos) {} |
55 | } Orientation; |
56 | |
57 | struct _highlighting |
58 | { |
59 | bool ToHilight; //!< perform dynamic highlighting at specified point |
60 | Graphic3d_Vec2i Point; //!< the new point for dynamic highlighting |
61 | |
62 | _highlighting() : ToHilight (false) {} |
63 | } MoveTo; |
64 | |
65 | struct _selection |
66 | { |
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 |
72 | |
73 | _selection() : Tool (AIS_ViewSelectionTool_Picking), IsXOR (false), ToApplyTool (false) {} |
74 | } Selection; |
75 | |
76 | struct _panningParams |
77 | { |
78 | bool ToStart; //!< start panning |
79 | Graphic3d_Vec2i PointStart; //!< panning start point |
80 | bool ToPan; //!< perform panning |
81 | Graphic3d_Vec2i Delta; //!< panning delta |
82 | |
83 | _panningParams() : ToStart (false), ToPan (false) {} |
84 | } Panning; |
85 | |
86 | struct _draggingParams |
87 | { |
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 |
93 | |
94 | _draggingParams() : ToStart (false), ToStop (false), ToAbort (false) {} |
95 | } Dragging; |
96 | |
97 | struct _orbitRotation |
98 | { |
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 |
103 | |
104 | _orbitRotation() : ToStart (false), ToRotate (false) {} |
105 | } OrbitRotation; |
106 | |
107 | struct _viewRotation |
108 | { |
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 |
113 | |
114 | _viewRotation() : ToStart (false), ToRotate (false) {} |
115 | } ViewRotation; |
116 | |
117 | struct _zrotateParams |
118 | { |
119 | Graphic3d_Vec2i Point; //!< Z rotation start point |
120 | double Angle; //!< Z rotation angle |
121 | bool ToRotate; //!< start Z rotation |
122 | |
123 | _zrotateParams() : Angle (0.0), ToRotate (false) {} |
124 | } ZRotate; |
125 | |
126 | public: |
127 | |
128 | AIS_ViewInputBuffer() |
129 | : IsNewGesture (false) {} |
130 | |
131 | //! Reset events buffer. |
132 | void Reset() |
133 | { |
134 | Orientation.ToFitAll = false; |
135 | Orientation.ToSetViewOrient = false; |
136 | MoveTo.ToHilight = false; |
137 | Selection.ToApplyTool = false; |
138 | IsNewGesture = false; |
139 | ZoomActions.Clear(); |
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; |
150 | } |
151 | |
152 | }; |
153 | |
154 | #endif // _AIS_ViewInputBuffer_HeaderFile |