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 gui
37  {
38  class ModelSnapPrivate;
39 
42  class GZ_GUI_VISIBLE ModelSnap : public SingletonT<ModelSnap>
43  {
45  private: ModelSnap();
46 
48  private: virtual ~ModelSnap();
49 
51  public: void Init();
52 
55  public: void Clear();
56 
58  public: void Reset();
59 
61  public: void Fini();
62 
70  public: void Snap(
71  const ignition::math::Triangle3d &_triangleSrc,
72  const ignition::math::Triangle3d &_triangleDest,
73  rendering::VisualPtr _visualSrc);
74 
85  public: static void SnapTransform(
86  const ignition::math::Triangle3d &_triangleSrc,
87  const ignition::math::Triangle3d &_triangleDest,
88  const ignition::math::Pose3d &_poseSrc,
89  ignition::math::Vector3d &_trans,
90  ignition::math::Quaterniond &_rot);
91 
94  public: void OnMousePressEvent(const common::MouseEvent &_event);
95 
98  public: void OnMouseMoveEvent(const common::MouseEvent &_event);
99 
102  public: void OnMouseReleaseEvent(const common::MouseEvent &_event);
103 
106  private: void PublishVisualPose(rendering::VisualPtr _vis);
107 
109  private: void Update();
110 
112  private: friend class SingletonT<ModelSnap>;
113 
116  private: std::unique_ptr<ModelSnapPrivate> dataPtr;
117  };
118  }
119 }
120 #endif
Generic description of a mouse event.
Definition: MouseEvent.hh:35
A gui tool for snapping one model to another.
Definition: ModelSnap.hh:42
Singleton template class.
Definition: SingletonT.hh:33
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:114
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.