Open3D (C++ API)
ModelInteractorLogic.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <map>
30 
33 
34 namespace open3d {
35 
36 namespace visualization {
37 
38 class Scene;
39 
42 
43 public:
45  visualization::Camera* camera,
46  double min_far_plane);
47  virtual ~ModelInteractorLogic();
48 
49  void SetBoundingBox(
50  const geometry::AxisAlignedBoundingBox& bounds) override;
51 
52  void SetModel(GeometryHandle axes,
53  const std::vector<GeometryHandle>& objects);
54 
55  void Rotate(int dx, int dy) override;
56  void RotateZ(int dx, int dy) override;
57  void Dolly(int dy, DragType drag_type) override;
58  void Pan(int dx, int dy) override;
59 
60  void StartMouseDrag() override;
61  void UpdateMouseDragUI() override;
62  void EndMouseDrag() override;
63 
64 private:
65  Scene* scene_;
66  GeometryHandle axes_;
67  std::vector<GeometryHandle> model_;
68  bool is_axes_visible_;
69 
70  geometry::AxisAlignedBoundingBox bounds_at_mouse_down_;
71  std::map<GeometryHandle, Camera::Transform> transforms_at_mouse_down_;
72 
73  void UpdateBoundingBox(const Camera::Transform& t);
74 };
75 
76 } // namespace visualization
77 } // namespace open3d
void Dolly(int dy, DragType drag_type) override
Definition: ModelInteractorLogic.cpp:98
A bounding box that is aligned along the coordinate axes.
Definition: BoundingVolume.h:164
void EndMouseDrag() override
Definition: ModelInteractorLogic.cpp:167
void SetModel(GeometryHandle axes, const std::vector< GeometryHandle > &objects)
Definition: ModelInteractorLogic.cpp:52
Definition: RotationInteractorLogic.h:34
void SetBoundingBox(const geometry::AxisAlignedBoundingBox &bounds) override
Definition: ModelInteractorLogic.cpp:43
Definition: ModelInteractorLogic.h:40
virtual ~ModelInteractorLogic()
Definition: ModelInteractorLogic.cpp:41
ModelInteractorLogic(visualization::Scene *scene, visualization::Camera *camera, double min_far_plane)
Definition: ModelInteractorLogic.cpp:34
RotationInteractorLogic(visualization::Camera *camera, double min_far_plane)
Definition: RotationInteractorLogic.cpp:32
Definition: Camera.h:34
void UpdateMouseDragUI() override
Definition: ModelInteractorLogic.cpp:165
Definition: Open3DViewer.h:29
void Rotate(int dx, int dy) override
Definition: ModelInteractorLogic.cpp:58
void Pan(int dx, int dy) override
Definition: ModelInteractorLogic.cpp:122
void StartMouseDrag() override
Definition: ModelInteractorLogic.cpp:149
void RotateZ(int dx, int dy) override
Rotates about the forward axis of the matrix.
Definition: ModelInteractorLogic.cpp:82
Eigen::Transform< float, 3, Eigen::Affine > Transform
Definition: Camera.h:38
DragType
Definition: MatrixInteractorLogic.h:71
Definition: Scene.h:47