Blue Brain BioExplorer
AbstractManipulator.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2024, EPFL/Blue Brain Project
3  *
4  * The Blue Brain BioExplorer is a tool for scientists to extract and analyse
5  * scientific data from visualization
6  *
7  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
8  *
9  * This program is free software: you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License as published by the Free Software
11  * Foundation, either version 3 of the License, or (at your option) any later
12  * version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License along with
20  * this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
23 #pragma once
24 
26 
27 constexpr float DEFAULT_MOUSE_MOTION_SPEED_MULTIPLIER = 0.25f;
28 
29 namespace core
30 {
35 {
36 public:
37  enum class AxisMode
38  {
39  globalY = 0,
40  localY
41  };
42 
43  AbstractManipulator(Camera& camera, KeyboardHandler& keyboardHandler);
44  virtual ~AbstractManipulator() = default;
45 
47  virtual void adjust(const Boxd& boundingBox);
48  virtual void dragLeft(const Vector2i& to, const Vector2i& from) = 0;
49  virtual void dragRight(const Vector2i& to, const Vector2i& from) = 0;
50  virtual void dragMiddle(const Vector2i& to, const Vector2i& from) = 0;
51  virtual void wheel(const Vector2i& position, float delta) = 0;
52 
53  float getMotionSpeed() const;
54  void updateMotionSpeed(float speed);
55 
56  float getRotationSpeed() const;
57  float getWheelSpeed() const;
58  void rotate(const Vector3d& pivot, double du, double dv, AxisMode axisMode);
59 
60 protected:
63 
66 
69  double _motionSpeed;
70 
74 
75  void translate(const Vector3d& v);
76 };
77 } // namespace core
constexpr float DEFAULT_MOUSE_MOTION_SPEED_MULTIPLIER
virtual void wheel(const Vector2i &position, float delta)=0
void updateMotionSpeed(float speed)
AbstractManipulator(Camera &camera, KeyboardHandler &keyboardHandler)
void rotate(const Vector3d &pivot, double du, double dv, AxisMode axisMode)
virtual void adjust(const Boxd &boundingBox)
virtual void dragMiddle(const Vector2i &to, const Vector2i &from)=0
virtual void dragRight(const Vector2i &to, const Vector2i &from)=0
KeyboardHandler & _keyboardHandler
virtual void dragLeft(const Vector2i &to, const Vector2i &from)=0
virtual ~AbstractManipulator()=default
void translate(const Vector3d &v)
The Camera class is an abstract interface for a camera in a 3D graphics application....
Definition: Camera.h:41
The KeyboardHandler class manages keyboard shortcuts and special keys.
glm::vec< 2, int32_t > Vector2i
Definition: MathTypes.h:130
glm::vec< 3, double > Vector3d
Definition: MathTypes.h:143