Open3D (C++ API)
ViewControlWithEditing.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 
30 
31 namespace open3d {
32 namespace visualization {
33 
35 public:
36  enum EditingMode {
37  FreeMode = 0,
44  };
45 
46 public:
47  void Reset() override;
48  void ChangeFieldOfView(double step) override;
49  void Scale(double scale) override;
50  void Rotate(double x, double y, double xo, double yo) override;
51  void Translate(double x, double y, double xo, double yo) override;
52 
53  void SetEditingMode(EditingMode mode);
54  std::string GetStatusString() const;
55 
57  void ToggleEditingX() {
58  if (editing_mode_ == EditingMode::OrthoPositiveX) {
59  SetEditingMode(EditingMode::OrthoNegativeX);
60  } else {
61  SetEditingMode(EditingMode::OrthoPositiveX);
62  }
63  }
64 
65  void ToggleEditingY() {
66  if (editing_mode_ == EditingMode::OrthoPositiveY) {
67  SetEditingMode(EditingMode::OrthoNegativeY);
68  } else {
69  SetEditingMode(EditingMode::OrthoPositiveY);
70  }
71  }
72 
73  void ToggleEditingZ() {
74  if (editing_mode_ == EditingMode::OrthoPositiveZ) {
75  SetEditingMode(EditingMode::OrthoNegativeZ);
76  } else {
77  SetEditingMode(EditingMode::OrthoPositiveZ);
78  }
79  }
80 
82  bool IsLocked() const { return is_view_locked_; }
83 
84 protected:
87  bool is_view_locked_ = false;
88 };
89 
90 } // namespace visualization
91 } // namespace open3d
Definition: ViewControlWithEditing.h:34
EditingMode GetEditingMode() const
Definition: ViewControlWithEditing.h:56
Definition: ViewControl.h:38
EditingMode
Definition: ViewControlWithEditing.h:36
void Scale(double scale) override
Definition: ViewControlWithEditing.cpp:81
ViewParameters view_status_backup_
Definition: ViewControlWithEditing.h:86
bool IsLocked() const
Definition: ViewControlWithEditing.h:82
void ToggleEditingZ()
Definition: ViewControlWithEditing.h:73
void Rotate(double x, double y, double xo, double yo) override
Definition: ViewControlWithEditing.cpp:90
void ChangeFieldOfView(double step) override
Definition: ViewControlWithEditing.cpp:72
Definition: ViewControlWithEditing.h:37
void ToggleEditingY()
Definition: ViewControlWithEditing.h:65
bool is_view_locked_
Definition: ViewControlWithEditing.h:87
void Translate(double x, double y, double xo, double yo) override
Definition: ViewControlWithEditing.cpp:110
void SetEditingMode(EditingMode mode)
Definition: ViewControlWithEditing.cpp:122
Definition: PinholeCameraIntrinsic.cpp:34
EditingMode editing_mode_
Definition: ViewControlWithEditing.h:85
void Reset() override
Definition: ViewControlWithEditing.cpp:32
Definition: ViewParameters.h:37
std::string GetStatusString() const
Definition: ViewControlWithEditing.cpp:135
void ToggleEditingX()
Definition: ViewControlWithEditing.h:57
void ToggleLocking()
Definition: ViewControlWithEditing.h:81