ModelSnap.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2015 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 GAZEBO_VISIBLE ModelSnap : public SingletonT<ModelSnap>
41  {
43  private: ModelSnap();
44 
46  private: virtual ~ModelSnap();
47 
49  public: void Init();
50 
52  public: void Reset();
53 
61  public: void Snap(const std::vector<math::Vector3> &_triangleSrc,
62  const std::vector<math::Vector3> &_triangleDest,
63  rendering::VisualPtr _visualSrc);
64 
75  public: void GetSnapTransform(
76  const std::vector<math::Vector3> &_triangleSrc,
77  const std::vector<math::Vector3> &_triangleDest,
78  const math::Pose &_poseSrc, math::Vector3 &_trans,
79  math::Quaternion &_rot);
80 
83  public: void OnMousePressEvent(const common::MouseEvent &_event);
84 
87  public: void OnMouseMoveEvent(const common::MouseEvent &_event);
88 
91  public: void OnMouseReleaseEvent(const common::MouseEvent &_event);
92 
95  private: void PublishVisualPose(rendering::VisualPtr _vis);
96 
98  private: void Update();
99 
101  private: friend class SingletonT<ModelSnap>;
102 
105  private: ModelSnapPrivate *dataPtr;
106  };
107  }
108 }
109 #endif
Generic description of a mouse event.
Definition: MouseEvent.hh:32
Encapsulates a position and rotation in three space.
Definition: Pose.hh:40
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:43
Singleton template class.
Definition: SingletonT.hh:33
A quaternion class.
Definition: Quaternion.hh:41
Definition: ModelSnapPrivate.hh:36
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:102
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48