33 #ifndef DART_GUI_OSG_DEFAULTEVENTHANDLER_HPP_ 34 #define DART_GUI_OSG_DEFAULTEVENTHANDLER_HPP_ 42 #include <osgGA/GUIEventHandler> 44 #include "dart/common/ClassWithVirtualBase.hpp" 45 #include "dart/common/Observer.hpp" 46 #include "dart/common/Subject.hpp" 62 std::shared_ptr<dart::dynamics::Shape> shape;
63 Eigen::Vector3d position;
64 Eigen::Vector3d normal;
102 DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_BEGIN
115 MouseButtonEvent getButtonEvent(MouseButton button)
const;
118 int getModKeyMask()
const;
121 double getWindowCursorX()
const;
124 double getWindowCursorY()
const;
137 Eigen::Vector3d getDeltaCursor(
138 const Eigen::Vector3d& _fromPosition,
139 ConstraintType _constraint = UNCONSTRAINED,
140 const Eigen::Vector3d& _constraintVector
141 = Eigen::Vector3d::UnitZ())
const;
146 void getNearAndFarPointUnderCursor(
147 Eigen::Vector3d& near, Eigen::Vector3d& far,
double distance = 1.0)
const;
150 const std::vector<PickInfo>& getButtonPicks(
151 MouseButton button, MouseButtonEvent event)
const;
155 const std::vector<PickInfo>& getMovePicks()
const;
158 void suppressButtonPicks(MouseButton button, MouseButtonEvent event);
161 void suppressMovePicks();
164 void activateButtonPicks(MouseButton button, MouseButtonEvent event);
167 void activateMovePicks();
172 std::vector<PickInfo>& infoVector, const ::osgGA::GUIEventAdapter& ea);
182 const std::set<MouseEventHandler*>& getMouseEventHandlers()
const;
186 const ::osgGA::GUIEventAdapter& ea, ::osgGA::GUIActionAdapter&)
override;
190 void triggerMouseEventHandlers();
193 void eventPick(const ::osgGA::GUIEventAdapter& ea);
196 void clearButtonEvents();
198 void handleDestructionNotification(
208 std::vector<PickInfo> mButtonPicks[NUM_MOUSE_BUTTONS][BUTTON_NOTHING];
211 bool mSuppressButtonPicks[NUM_MOUSE_BUTTONS][BUTTON_NOTHING];
223 MouseButtonEvent mLastButtonEvent[NUM_MOUSE_BUTTONS];
232 DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_END
238 #endif // DART_GUI_OSG_DEFAULTEVENTHANDLER_HPP_ std::set< MouseEventHandler * > mMouseEventHandlers
Set of MouseEventHandlers that are tied to this DefaultEventHandler.
Definition: DefaultEventHandler.hpp:205
The Subject class is a base class for any object that wants to report when it gets destroyed...
Definition: Subject.hpp:57
Viewer * mViewer
dart::gui::osg::Viewer that this event handler is tied to
Definition: DefaultEventHandler.hpp:202
Eigen::Vector2d mLastCursorPosition
X/Y values of the cursor (in the window coordinates) during the last mouse event. ...
Definition: DefaultEventHandler.hpp:227
Definition: DefaultEventHandler.hpp:59
int mLastModKeyMask
Storage for the last modkey mask.
Definition: DefaultEventHandler.hpp:230
Definition: Aspect.cpp:40
bool mSuppressMovePicks
Suppress pick detection for moves.
Definition: DefaultEventHandler.hpp:217
std::vector< PickInfo > mMovePicks
The objects that were under the cursor during the last move.
Definition: DefaultEventHandler.hpp:214
Definition: MouseEventHandler.hpp:49
Definition: ShapeFrame.hpp:189
Definition: Viewer.hpp:111
Definition: DefaultEventHandler.hpp:103
The Observer class should be inherited by any class that wants to respond in a customized way to the ...
Definition: Observer.hpp:51
std::vector< PickInfo > mTempPicks
Cache for pick data.
Definition: DefaultEventHandler.hpp:220