ModelSnap.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef GAZEBO_GUI_MODELSNAP_HH_
18 #define GAZEBO_GUI_MODELSNAP_HH_
19 
20 #include <memory>
21 #include <vector>
22 #include <ignition/math/Quaternion.hh>
23 #include <ignition/math/Triangle3.hh>
24 
27 #include "gazebo/util/system.hh"
28 
29 namespace gazebo
30 {
31  namespace common
32  {
33  class MouseEvent;
34  }
35 
36  namespace math
37  {
38  class Pose;
39  class Quaternion;
40  class Vector3;
41  }
42 
43  namespace gui
44  {
45  class ModelSnapPrivate;
46 
49  class GZ_GUI_VISIBLE ModelSnap : public SingletonT<ModelSnap>
50  {
52  private: ModelSnap();
53 
55  private: virtual ~ModelSnap();
56 
58  public: void Init();
59 
62  public: void Clear();
63 
65  public: void Reset();
66 
68  public: void Fini();
69 
78  public: void Snap(const std::vector<math::Vector3> &_triangleSrc,
79  const std::vector<math::Vector3> &_triangleDest,
80  rendering::VisualPtr _visualSrc) GAZEBO_DEPRECATED(8.0);
81 
89  public: void Snap(
90  const ignition::math::Triangle3d &_triangleSrc,
91  const ignition::math::Triangle3d &_triangleDest,
92  rendering::VisualPtr _visualSrc);
93 
105  public: void GetSnapTransform(
106  const std::vector<math::Vector3> &_triangleSrc,
107  const std::vector<math::Vector3> &_triangleDest,
108  const math::Pose &_poseSrc, math::Vector3 &_trans,
110 
121  public: static void SnapTransform(
122  const ignition::math::Triangle3d &_triangleSrc,
123  const ignition::math::Triangle3d &_triangleDest,
124  const ignition::math::Pose3d &_poseSrc,
125  ignition::math::Vector3d &_trans,
126  ignition::math::Quaterniond &_rot);
127 
130  public: void OnMousePressEvent(const common::MouseEvent &_event);
131 
134  public: void OnMouseMoveEvent(const common::MouseEvent &_event);
135 
138  public: void OnMouseReleaseEvent(const common::MouseEvent &_event);
139 
142  private: void PublishVisualPose(rendering::VisualPtr _vis);
143 
145  private: void Update();
146 
148  private: friend class SingletonT<ModelSnap>;
149 
152  private: std::unique_ptr<ModelSnapPrivate> dataPtr;
153  };
154  }
155 }
156 #endif
Generic description of a mouse event.
Definition: MouseEvent.hh:35
Encapsulates a position and rotation in three space.
Definition: Pose.hh:42
A gui tool for snapping one model to another.
Definition: ModelSnap.hh:49
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:44
Singleton template class.
Definition: SingletonT.hh:33
A quaternion class.
Definition: Quaternion.hh:48
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:302
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:113
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.