Open3D (C++ API)  0.12.0
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 namespace visualization {
36 namespace rendering {
37 
38 class Open3DScene;
39 
42 
43 public:
45  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  Open3DScene* scene_;
66  bool is_axes_visible_;
67 
68  geometry::AxisAlignedBoundingBox bounds_at_mouse_down_;
69  std::map<std::string, Camera::Transform> transforms_at_mouse_down_;
70 
71  void UpdateBoundingBox(const Camera::Transform& t);
72 };
73 
74 } // namespace rendering
75 } // namespace visualization
76 } // namespace open3d
Definition: ModelInteractorLogic.h:40
A bounding box that is aligned along the coordinate axes.
Definition: BoundingVolume.h:149
Definition: RendererHandle.h:115
void SetModel(GeometryHandle axes, const std::vector< GeometryHandle > &objects)
Definition: ModelInteractorLogic.cpp:54
void SetBoundingBox(const geometry::AxisAlignedBoundingBox &bounds) override
Definition: ModelInteractorLogic.cpp:45
Definition: RotationInteractorLogic.h:35
void Dolly(int dy, DragType drag_type) override
Definition: ModelInteractorLogic.cpp:97
Eigen::Transform< float, 3, Eigen::Affine > Transform
Definition: Camera.h:39
void UpdateMouseDragUI() override
Definition: ModelInteractorLogic.cpp:170
DragType
Definition: MatrixInteractorLogic.h:73
void RotateZ(int dx, int dy) override
Rotates about the forward axis of the matrix.
Definition: ModelInteractorLogic.cpp:81
virtual ~ModelInteractorLogic()
Definition: ModelInteractorLogic.cpp:43
Definition: PinholeCameraIntrinsic.cpp:35
RotationInteractorLogic(Camera *camera, double min_far_plane)
Definition: RotationInteractorLogic.cpp:33
ModelInteractorLogic(Open3DScene *scene, Camera *camera, double min_far_plane)
Definition: ModelInteractorLogic.cpp:38
void Pan(int dx, int dy) override
Definition: ModelInteractorLogic.cpp:121
void StartMouseDrag() override
Definition: ModelInteractorLogic.cpp:150
void Rotate(int dx, int dy) override
Definition: ModelInteractorLogic.cpp:57
void EndMouseDrag() override
Definition: ModelInteractorLogic.cpp:172