0031458: Visualization - refine classes across Prs3d and StdPrs packages
[occt.git] / src / AIS / AIS_ViewInputBuffer.hxx
CommitLineData
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
24enum AIS_ViewSelectionTool
25{
26 AIS_ViewSelectionTool_Picking, //!< pick to select
27 AIS_ViewSelectionTool_RubberBand, //!< rubber-band to select
28 AIS_ViewSelectionTool_Polygon //!< polyline to select
29};
30
31//! Input buffer type.
32enum AIS_ViewInputBufferType
33{
34 AIS_ViewInputBufferType_UI, //!< input buffer for filling from UI thread
35 AIS_ViewInputBufferType_GL, //!< input buffer accessible from GL thread
36};
37
38//! Auxiliary structure defining viewer events
39class AIS_ViewInputBuffer
40{
41public:
42
43 bool IsNewGesture; //!< transition from one action to another
44
45 NCollection_Sequence<Aspect_ScrollDelta> ZoomActions; //!< the queue with zoom actions
46
47 struct _orientation
48 {
49 bool ToFitAll; //!< perform FitAll operation
50 bool ToSetViewOrient; //!< set new view orientation
51 V3d_TypeOfOrientation ViewOrient; //!< new view orientation
52
53 _orientation() : ToFitAll (false), ToSetViewOrient (false), ViewOrient (V3d_Xpos) {}
54 } Orientation;
55
56 struct _highlighting
57 {
58 bool ToHilight; //!< perform dynamic highlighting at specified point
59 Graphic3d_Vec2i Point; //!< the new point for dynamic highlighting
60
61 _highlighting() : ToHilight (false) {}
62 } MoveTo;
63
64 struct _selection
65 {
66 AIS_ViewSelectionTool Tool; //!< perform selection
67 bool IsXOR; //!< perform shift selection
68 NCollection_Sequence<Graphic3d_Vec2i>
69 Points; //!< the points for selection
70 bool ToApplyTool; //!< apply rubber-band selection tool
71
72 _selection() : Tool (AIS_ViewSelectionTool_Picking), IsXOR (false), ToApplyTool (false) {}
73 } Selection;
74
75 struct _panningParams
76 {
77 bool ToStart; //!< start panning
78 Graphic3d_Vec2i PointStart; //!< panning start point
79 bool ToPan; //!< perform panning
80 Graphic3d_Vec2i Delta; //!< panning delta
81
82 _panningParams() : ToStart (false), ToPan (false) {}
83 } Panning;
84
85 struct _draggingParams
86 {
87 bool ToStart; //!< start dragging
88 bool ToStop; //!< stop dragging
89 bool ToAbort; //!< abort dragging (restore previous position)
90 Graphic3d_Vec2i PointStart; //!< drag start point
91 Graphic3d_Vec2i PointTo; //!< drag end point
92
93 _draggingParams() : ToStart (false), ToStop (false), ToAbort (false) {}
94 } Dragging;
95
96 struct _orbitRotation
97 {
98 bool ToStart; //!< start orbit rotation
99 Graphic3d_Vec2d PointStart; //!< orbit rotation start point
100 bool ToRotate; //!< perform orbit rotation
101 Graphic3d_Vec2d PointTo; //!< orbit rotation end point
102
103 _orbitRotation() : ToStart (false), ToRotate (false) {}
104 } OrbitRotation;
105
106 struct _viewRotation
107 {
108 bool ToStart; //!< start view rotation
109 Graphic3d_Vec2d PointStart; //!< view rotation start point
110 bool ToRotate; //!< perform view rotation
111 Graphic3d_Vec2d PointTo; //!< view rotation end point
112
113 _viewRotation() : ToStart (false), ToRotate (false) {}
114 } ViewRotation;
115
116 struct _zrotateParams
117 {
118 Graphic3d_Vec2i Point; //!< Z rotation start point
119 double Angle; //!< Z rotation angle
120 bool ToRotate; //!< start Z rotation
121
122 _zrotateParams() : Angle (0.0), ToRotate (false) {}
123 } ZRotate;
124
125public:
126
127 AIS_ViewInputBuffer()
128 : IsNewGesture (false) {}
129
130 //! Reset events buffer.
131 void Reset()
132 {
133 Orientation.ToFitAll = false;
134 Orientation.ToSetViewOrient = false;
135 MoveTo.ToHilight = false;
136 Selection.ToApplyTool = false;
137 IsNewGesture = false;
138 ZoomActions.Clear();
139 Panning.ToStart = false;
140 Panning.ToPan = false;
141 Dragging.ToStart = false;
142 Dragging.ToStop = false;
143 Dragging.ToAbort = false;
144 OrbitRotation.ToStart = false;
145 OrbitRotation.ToRotate = false;
146 ViewRotation.ToStart = false;
147 ViewRotation.ToRotate = false;
148 ZRotate.ToRotate = false;
149 }
150
151};
152
153#endif // _AIS_ViewInputBuffer_HeaderFile