EntityMaker.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-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 _ENTITYMAKER_HH_
18 #define _ENTITYMAKER_HH_
19 
20 #include <boost/function.hpp>
23 #include "gazebo/math/Vector3.hh"
24 #include "gazebo/util/system.hh"
25 
26 namespace gazebo
27 {
28  namespace common
29  {
30  class MouseEvent;
31  }
32 
35  namespace gui
36  {
39 
43  {
46  public: typedef boost::function<void(const math::Vector3 &pos,
47  const math::Vector3 &scale)> CreateCallback;
48 
50  public: EntityMaker();
51 
53  public: virtual ~EntityMaker();
54 
56  public: static void SetSnapToGrid(bool _snap);
57 
60  public: virtual void Start(const rendering::UserCameraPtr _camera) = 0;
62  public: virtual void Stop() = 0;
63 
65  public: virtual bool IsActive() const = 0;
66 
69  public: virtual void OnMousePush(const common::MouseEvent &_event);
70 
73  public: virtual void OnMouseRelease(const common::MouseEvent &_event);
74 
77  public: virtual void OnMouseDrag(const common::MouseEvent &_event);
78 
81  public: virtual void OnMouseMove(const common::MouseEvent &_event);
82 
86  protected: math::Vector3 GetSnappedPoint(math::Vector3 _p);
87 
89  protected: virtual void CreateTheEntity() = 0;
90 
92 
97  protected: CreateCallback createCB;
98 
99 
100  private: static bool snapToGrid;
101  private: static double snapDistance;
102  private: static double snapGridSize;
103  };
104  }
105 }
106 #endif
107 
108 
transport::PublisherPtr makerPub
Definition: EntityMaker.hh:95
Generic description of a mouse event.
Definition: MouseEvent.hh:35
Forward declarations for the common classes.
Definition: Animation.hh:33
CreateCallback createCB
Definition: EntityMaker.hh:97
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
transport::NodePtr node
Definition: EntityMaker.hh:93
transport::PublisherPtr requestPub
Definition: EntityMaker.hh:96
Forward declarations for transport.
boost::function< void(const math::Vector3 &pos, const math::Vector3 &scale)> CreateCallback
Definition: EntityMaker.hh:47
to make an entity base class
Definition: EntityMaker.hh:42
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
rendering::UserCameraPtr camera
Definition: EntityMaker.hh:91
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:91
transport::PublisherPtr visPub
Definition: EntityMaker.hh:94
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:66