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 
59  public: void Fini();
60 
68  public: void Snap(const std::vector<math::Vector3> &_triangleSrc,
69  const std::vector<math::Vector3> &_triangleDest,
70  rendering::VisualPtr _visualSrc);
71 
82  public: void GetSnapTransform(
83  const std::vector<math::Vector3> &_triangleSrc,
84  const std::vector<math::Vector3> &_triangleDest,
85  const math::Pose &_poseSrc, math::Vector3 &_trans,
86  math::Quaternion &_rot);
87 
90  public: void OnMousePressEvent(const common::MouseEvent &_event);
91 
94  public: void OnMouseMoveEvent(const common::MouseEvent &_event);
95 
98  public: void OnMouseReleaseEvent(const common::MouseEvent &_event);
99 
102  private: void PublishVisualPose(rendering::VisualPtr _vis);
103 
105  private: void Update();
106 
108  private: friend class SingletonT<ModelSnap>;
109 
112  private: ModelSnapPrivate *dataPtr;
113  };
114  }
115 }
116 #endif
Generic description of a mouse event.
Definition: MouseEvent.hh:35
Forward declarations for the common classes.
Definition: Animation.hh:33
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
Singleton template class.
Definition: SingletonT.hh:33
A quaternion class.
Definition: Quaternion.hh:42
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:112
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.