All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EntityMaker.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-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 _ENTITYMAKER_HH_
18 #define _ENTITYMAKER_HH_
19 
22 #include "gazebo/math/Vector3.hh"
23 #include "gazebo/util/system.hh"
24 
25 namespace gazebo
26 {
27  namespace common
28  {
29  class MouseEvent;
30  }
31 
34  namespace gui
35  {
38 
42  {
45  public: typedef boost::function<void(const math::Vector3 &pos,
46  const math::Vector3 &scale)> CreateCallback;
47 
49  public: EntityMaker();
50 
52  public: virtual ~EntityMaker();
53 
55  public: static void SetSnapToGrid(bool _snap);
56 
59  public: virtual void Start(const rendering::UserCameraPtr _camera) = 0;
61  public: virtual void Stop() = 0;
62 
64  public: virtual bool IsActive() const = 0;
65 
68  public: virtual void OnMousePush(const common::MouseEvent &_event);
69 
72  public: virtual void OnMouseRelease(const common::MouseEvent &_event);
73 
76  public: virtual void OnMouseDrag(const common::MouseEvent &_event);
77 
80  public: virtual void OnMouseMove(const common::MouseEvent &_event);
81 
85  protected: math::Vector3 GetSnappedPoint(math::Vector3 _p);
86 
88  protected: virtual void CreateTheEntity() = 0;
89 
91 
97 
98 
99  private: static bool snapToGrid;
100  private: static double snapDistance;
101  private: static double snapGridSize;
102  };
103  }
104 }
105 #endif
106 
107 
transport::PublisherPtr makerPub
Definition: EntityMaker.hh:94
Generic description of a mouse event.
Definition: MouseEvent.hh:32
CreateCallback createCB
Definition: EntityMaker.hh:96
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
transport::NodePtr node
Definition: EntityMaker.hh:92
transport::PublisherPtr requestPub
Definition: EntityMaker.hh:95
Forward declarations for transport.
boost::function< void(const math::Vector3 &pos, const math::Vector3 &scale)> CreateCallback
Definition: EntityMaker.hh:46
to make an entity base class
Definition: EntityMaker.hh:41
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:52
rendering::UserCameraPtr camera
Definition: EntityMaker.hh:90
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:84
transport::PublisherPtr visPub
Definition: EntityMaker.hh:93
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:44
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48