ModelSnap.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2016 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_MODEL_SNAP_HH_
18 #define _GAZEBO_MODEL_SNAP_HH_
19 
20 #include <string>
21 #include <vector>
22 
25 
26 #include "gazebo/math/Pose.hh"
28 
30 #include "gazebo/util/system.hh"
31 
32 namespace gazebo
33 {
34  namespace gui
35  {
36  class ModelSnapPrivate;
37 
40  class GZ_GUI_VISIBLE ModelSnap : public SingletonT<ModelSnap>
41  {
43  private: ModelSnap();
44 
46  private: virtual ~ModelSnap();
47 
49  public: void Init();
50 
53  public: void Clear();
54 
56  public: void Reset();
57 
65  public: void Snap(const std::vector<math::Vector3> &_triangleSrc,
66  const std::vector<math::Vector3> &_triangleDest,
67  rendering::VisualPtr _visualSrc);
68 
79  public: void GetSnapTransform(
80  const std::vector<math::Vector3> &_triangleSrc,
81  const std::vector<math::Vector3> &_triangleDest,
82  const math::Pose &_poseSrc, math::Vector3 &_trans,
83  math::Quaternion &_rot);
84 
87  public: void OnMousePressEvent(const common::MouseEvent &_event);
88 
91  public: void OnMouseMoveEvent(const common::MouseEvent &_event);
92 
95  public: void OnMouseReleaseEvent(const common::MouseEvent &_event);
96 
99  private: void PublishVisualPose(rendering::VisualPtr _vis);
100 
102  private: void Update();
103 
105  private: friend class SingletonT<ModelSnap>;
106 
109  private: ModelSnapPrivate *dataPtr;
110  };
111  }
112 }
113 #endif
Generic description of a mouse event.
Definition: MouseEvent.hh:35
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
A gui tool for snapping one model to another.
Definition: ModelSnap.hh:40
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
#define GZ_GUI_VISIBLE
Definition: system.hh:284
Singleton template class.
Definition: SingletonT.hh:33
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:112
A quaternion class.
Definition: Quaternion.hh:42
Definition: ModelSnapPrivate.hh:36
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.