33 #ifndef DART_GUI_OSG_DRAGANDDROP_HPP_
34 #define DART_GUI_OSG_DRAGANDDROP_HPP_
38 #include <Eigen/Geometry>
55 class InteractiveFrame;
189 void move()
override;
250 void move()
override;
284 void move()
override;
309 ::osgGA::GUIEventAdapter::ModKeyMask modkey);
const CollisionOption & option
Collision option of DART.
Definition: FCLCollisionDetector.cpp:157
The Observer class should be inherited by any class that wants to respond in a customized way to the ...
Definition: Observer.hpp:52
The Subject class is a base class for any object that wants to report when it gets destroyed.
Definition: Subject.hpp:58
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:79
Entity class is a base class for any objects that exist in the kinematic tree structure of DART.
Definition: Entity.hpp:61
The SimpleFrame class offers a user-friendly way of creating arbitrary Frames within the kinematic tr...
Definition: SimpleFrame.hpp:52
TemplateInverseKinematicsPtr is a templated class that enables users to create a reference-counting I...
Definition: InverseKinematicsPtr.hpp:49
Definition: DragAndDrop.hpp:265
bool isUsingWholeBody() const
Returns true if this DnD is using the whole body.
Definition: DragAndDrop.cpp:861
void update() override
Called when mouse events are being handled.
Definition: DragAndDrop.cpp:680
dart::dynamics::BodyNode * getBodyNode() const
Get the BodyNode associated with this DnD.
Definition: DragAndDrop.cpp:674
Eigen::AngleAxisd mSavedRotation
The rotation of the BodyNode.
Definition: DragAndDrop.hpp:336
::osgGA::GUIEventAdapter::ModKeyMask getPreserveOrientationModKey() const
Get the key that will preserve the orientation of the body.
Definition: DragAndDrop.cpp:874
::osgGA::GUIEventAdapter::ModKeyMask mPreserveOrientationModKey
Key for preserving orientation.
Definition: DragAndDrop.hpp:345
void setJointRestrictionModKey(::osgGA::GUIEventAdapter::ModKeyMask modkey)
Set the key that will restrict which joints are used by the DnD.
Definition: DragAndDrop.cpp:881
std::size_t mAdditionalBodyNodes
Currently unused, but this will change in the future.
Definition: DragAndDrop.hpp:351
BodyNodeDnD(Viewer *viewer, dart::dynamics::BodyNode *bn, bool useExternalIK=true, bool useWholeBody=false)
Constructor.
Definition: DragAndDrop.cpp:658
void setPreserveOrientationModKey(::osgGA::GUIEventAdapter::ModKeyMask modkey)
Set the key that will preserve the orientation of the body.
Definition: DragAndDrop.cpp:867
void useWholeBody(bool wholeBody)
Tell this DnD to use the whole body.
Definition: DragAndDrop.cpp:855
bool isUsingExternalIK() const
Returns true if it is using an external IK.
Definition: DragAndDrop.cpp:849
::osgGA::GUIEventAdapter::ModKeyMask mJointRestrictionModKey
Key for restricting joint usage.
Definition: DragAndDrop.hpp:348
dart::dynamics::WeakBodyNodePtr mBodyNode
The BodyNode associated with this DnD.
Definition: DragAndDrop.hpp:322
bool mUseWholeBody
Whether to use the whole body.
Definition: DragAndDrop.hpp:342
void saveState() override
Called when a point gets picked, and is used to save the current state of the Entity.
Definition: DragAndDrop.cpp:802
Eigen::Vector3d mSavedLocalOffset
The offset of the pick from the BodyNode origin, expressed in local coordinates.
Definition: DragAndDrop.hpp:333
bool mUseExternalIK
Whether to use an external IK.
Definition: DragAndDrop.hpp:339
Eigen::Vector3d mSavedGlobalOffset
The offset of the pick from the BodyNode origin, expressed in global coordinates.
Definition: DragAndDrop.hpp:329
void move() override
Called to specify how the Entity should be moved.
Definition: DragAndDrop.cpp:727
virtual ~BodyNodeDnD()=default
Virtual destructor.
void release() override
Called when the user lets go of the object that they are dragging and dropping.
Definition: DragAndDrop.cpp:829
dart::dynamics::InverseKinematicsPtr mIK
The IK module being used by this DnD.
Definition: DragAndDrop.hpp:325
::osgGA::GUIEventAdapter::ModKeyMask getJointRestrictionModKey() const
Get the key that will restrict which joints are used by the DnD.
Definition: DragAndDrop.cpp:888
void useExternalIK(bool external)
Tell this DnD to use an external IK instead of the one embedded in the BodyNode.
Definition: DragAndDrop.cpp:843
DragAndDrop is a class that facilitates enabling various kinds of dart Entities to be dragged and dro...
Definition: DragAndDrop.hpp:60
Eigen::Vector3d mPivot
Point in space about which rotations should happen.
Definition: DragAndDrop.hpp:156
virtual void update()
Called when mouse events are being handled.
Definition: DragAndDrop.cpp:78
void setRotationOption(RotationOption option)
Set the option for triggering rotations instead of translations.
Definition: DragAndDrop.cpp:214
::osgGA::GUIEventAdapter::ModKeyMask mRotationModKey
Modkey for rotation.
Definition: DragAndDrop.hpp:171
dart::dynamics::Entity * getEntity() const
Get the Entity that this DragAndDrop is associated with.
Definition: DragAndDrop.cpp:72
void constrainToPlane(const Eigen::Vector3d &normal)
Constrain translation to only occur within the plane defined by the given normal, or constrain rotati...
Definition: DragAndDrop.cpp:201
Eigen::Vector3d mPickedPosition
The location in the world that was picked by the user.
Definition: DragAndDrop.hpp:149
virtual void saveState()=0
Called when a point gets picked, and is used to save the current state of the Entity.
RotationOption getRotationOption() const
Get the current rotation option for this DnD.
Definition: DragAndDrop.cpp:220
bool mAmMoving
Whether this DnD is currently moving.
Definition: DragAndDrop.hpp:165
virtual Eigen::AngleAxisd getConstrainedRotation() const
Default method for getting the rotation requested by the user.
Definition: DragAndDrop.cpp:150
virtual void move()=0
Called to specify how the Entity should be moved.
void handleDestructionNotification(const dart::common::Subject *subscription) override
Perform cleanup when the subject is destroyed.
Definition: DragAndDrop.cpp:239
::osgGA::GUIEventAdapter::ModKeyMask getRotationModKey() const
Get the modkey that will be used to toggle rotation for this DnD.
Definition: DragAndDrop.cpp:233
void setObstructable(bool _obstructable)
If true is passed in, this object will only be drag and droppable if there are no other objects betwe...
Definition: DragAndDrop.cpp:125
bool isObstructable() const
If this is true, then this object will only be drag and droppable if there are no other objects betwe...
Definition: DragAndDrop.cpp:131
bool isMoving() const
Returns the mAmMoving flag.
Definition: DragAndDrop.cpp:208
void constrainToLine(const Eigen::Vector3d &slope)
Constrain translation to only occur along the given slope, or constrain rotation to only occur about ...
Definition: DragAndDrop.cpp:194
virtual ~DragAndDrop()
Virtual destructor.
Definition: DragAndDrop.cpp:66
ConstraintType mConstraintType
Constraint type for this DnD.
Definition: DragAndDrop.hpp:159
RotationOption
Definition: DragAndDrop.hpp:63
RotationOption mRotationOption
Option for rotation settings.
Definition: DragAndDrop.hpp:168
virtual Eigen::Vector3d getConstrainedDx() const
Default method for getting the translation requested by the user.
Definition: DragAndDrop.cpp:143
Viewer * mViewer
Pointer to the DnD's Viewer.
Definition: DragAndDrop.hpp:143
virtual void release()
Called when the user lets go of the object that they are dragging and dropping.
Definition: DragAndDrop.cpp:137
void unconstrain()
Remove all constraints from the dragging and dropping.
Definition: DragAndDrop.cpp:188
Eigen::Vector3d mVector
Reference vector for constraint (slope for line constraint, or normal for plane constraint)
Definition: DragAndDrop.hpp:153
DragAndDrop(Viewer *viewer, dart::dynamics::Entity *entity)
Constructor.
Definition: DragAndDrop.cpp:51
void setRotationModKey(::osgGA::GUIEventAdapter::ModKeyMask rotationModKey)
Set the modkey that will be used to toggle rotation for this DnD.
Definition: DragAndDrop.cpp:226
dart::dynamics::Entity * mEntity
Pointer to the DnD's Entity.
Definition: DragAndDrop.hpp:146
bool mAmObstructable
Whether other objects can block this one from being picked.
Definition: DragAndDrop.hpp:162
Definition: DragAndDrop.hpp:235
void saveState() override
Called when a point gets picked, and is used to save the current state of the Entity.
Definition: DragAndDrop.cpp:652
virtual ~InteractiveFrameDnD()=default
Virtual destructor.
InteractiveFrame * getFrame() const
Get the frame associated with this DnD.
Definition: DragAndDrop.cpp:576
InteractiveFrame * mInteractiveFrame
Pointer to the interactive frame.
Definition: DragAndDrop.hpp:260
void move() override
Called to specify how the Entity should be moved.
Definition: DragAndDrop.cpp:646
std::vector< DragAndDrop * > mDnDs
Vector of DnD components that are united under this DnD.
Definition: DragAndDrop.hpp:257
void update() override
Called when mouse events are being handled.
Definition: DragAndDrop.cpp:582
InteractiveFrameDnD(Viewer *viewer, dart::gui::osg::InteractiveFrame *frame)
Constructor.
Definition: DragAndDrop.cpp:550
Definition: InteractiveFrame.hpp:110
SimpleFrameDnD is a DragAndDrop implementation for SimpleFrame objects.
Definition: DragAndDrop.hpp:177
void move() override
Called to specify how the Entity should be moved.
Definition: DragAndDrop.cpp:264
dart::dynamics::SimpleFrame * getSimpleFrame() const
Get the SimpleFrame associated with this DnD.
Definition: DragAndDrop.cpp:258
Eigen::AngleAxisd mSavedRotation
The saved rotation of the frame.
Definition: DragAndDrop.hpp:199
void saveState() override
Called when a point gets picked, and is used to save the current state of the Entity.
Definition: DragAndDrop.cpp:299
dart::dynamics::SimpleFrame * mFrame
SimpleFrame pointer.
Definition: DragAndDrop.hpp:196
virtual ~SimpleFrameDnD()=default
Virtual destructor.
SimpleFrameDnD(Viewer *viewer, dart::dynamics::SimpleFrame *frame)
Constructor.
Definition: DragAndDrop.cpp:250
SimpleFrameShapeDnD is a version of SimpleFrameDnD that allows a specific Shape within the SimpleFram...
Definition: DragAndDrop.hpp:207
SimpleFrameShapeDnD(Viewer *viewer, dart::dynamics::SimpleFrame *frame, dart::dynamics::Shape *shape)
Constructor.
Definition: DragAndDrop.cpp:306
void handleDestructionNotification(const dart::common::Subject *subscription) override
Perform cleanup when the subject is destroyed.
Definition: DragAndDrop.cpp:366
dart::dynamics::Shape * mShape
Shape associated with this DnD.
Definition: DragAndDrop.hpp:230
void update() override
Called when mouse events are being handled.
Definition: DragAndDrop.cpp:322
virtual ~SimpleFrameShapeDnD()=default
Virtual destructor.
dart::dynamics::Shape * getShape() const
Get the Shape associated with this DnD.
Definition: DragAndDrop.cpp:316
Definition: Viewer.hpp:112
ConstraintType
Definition: DefaultEventHandler.hpp:90
Definition: BulletCollisionDetector.cpp:65